Mobile Phone Charger Circuit from 12V Battery Using 7805 and USB Socket
During power cuts, a 12 V inverter battery, solar battery or bike battery holds plenty of energy that can keep a phone alive. This project builds a USB charging point that converts 12 V DC to a regulated 5 V using the 7805 linear regulator. Along the way you will learn how linear regulators waste power as heat, how to choose a heatsink with a thermal calculation, and what the USB data pins tell a phone about how much current it may draw.
The phone itself contains the lithium-ion charging controller. Your circuit only supplies a clean, protected 5 V, exactly like a USB port. Never connect this circuit directly to a bare lithium cell.
Components Required
| Part | Value / Type | Quantity |
|---|---|---|
| Regulator U1 | 7805 (LM7805 / L7805), TO-220 | 1 |
| Heatsink | TO-220 heatsink, 15 C/W or better, with insulating pad if needed | 1 |
| F1 | 1 A fuse with inline holder | 1 |
| D1 (reverse polarity) | 1N5819 Schottky or 1N4007 | 1 |
| C1 (input bulk) | 100 microfarad, 25 V | 1 |
| C2 (input) | 330 nanofarad ceramic | 1 |
| C3 (output) | 100 nanofarad ceramic | 1 |
| C4 (output bulk) | 100 microfarad, 16 V | 1 |
| Power LED and resistor | Green LED, 330 ohm | 1 each |
| USB socket | USB Type-A female, PCB mount | 1 |
| Battery leads | Red and black wire with clips | 1 set |
| Test load | 10 ohm, 5 W resistor | 1 |
Circuit Explained Stage by Stage
Stage 1: Input protection
F1 sits right at the battery clip, because a lead-acid battery can supply enormous short-circuit current that would melt wiring. D1 in series blocks current if the clips are connected the wrong way round. A Schottky diode drops about 0.3 to 0.5 V instead of about 0.7 V for a 1N4007, slightly reducing the heat in the regulator.
Stage 2: The 7805 regulator
The 7805 keeps its output at 5 V as long as its input stays roughly 2 V or more above the output. C2 close to the input pin and C3 close to the output pin follow the datasheet recommendation and prevent oscillation; C1 and C4 add bulk capacitance for load changes. The regulator has built-in current limiting and thermal shutdown, so a short circuit on the output will not destroy it immediately.
| 7805 pin (TO-220, front view) | Function | Connection |
|---|---|---|
| 1 (left) | Input | After F1 and D1; C1, C2 to GND |
| 2 (middle) and tab | Ground | GND |
| 3 (right) | Output | USB VBUS, C3, C4, power LED |
Stage 3: Heat and the heatsink
A linear regulator drops the excess voltage across itself, and that power turns into heat. This is the single most important design calculation in this project.
P = (V_in - V_out) x I V_in after D1 is about 12.2 V with a charged battery, I = 0.5 A: P = (12.2 - 5) x 0.5 = 3.6 W Allowed total thermal resistance (T_j max 125 C, ambient 40 C): (125 - 40) / 3.6 = about 23.6 C/W Subtract junction-to-case (from your datasheet) and the pad: heatsink must be about 15 C/W or better
At 1 A the same regulator would dissipate over 7 W, which needs a much larger heatsink. That is why this design is intended for about 500 mA, and why higher-current chargers use switch-mode converters.
Stage 4: USB output
A USB Type-A socket has four pins: pin 1 VBUS (5 V), pin 2 D-, pin 3 D+ and pin 4 ground. A phone reads the data pins to decide how much current to take. If D+ and D- are shorted together, the port identifies as a dedicated charging port under the USB Battery Charging specification, and the phone may draw 1.5 A or more. For this 7805 version, leave D+ and D- unconnected so most phones limit themselves to a low current that the regulator can supply. Some phones charge very slowly, or show a slow-charging message, in this mode.
How It Works
Current flows from the battery through the fuse and protection diode into the 7805, which compares its output with an internal reference and adjusts an internal pass transistor to hold 5 V. The phone connected to the USB socket sees a normal 5 V port and its internal charger controls the battery charging current and termination.
Faster charging option
For 1 A or more, replace the 7805 with a ready-made buck converter module based on a switching regulator such as the LM2596, set to 5.1 V and rated for at least 2 A. A buck converter wastes far less power as heat. Only then short D+ to D- on the USB socket so the phone can draw higher current.
Assembly and Testing
- Bolt the 7805 to the heatsink with thermal compound. The tab is connected to ground, so it can touch a grounded case.
- Wire F1, D1 and the input capacitors, then the output capacitors and LED, keeping capacitor leads short.
- Before connecting any phone, power the circuit from the battery and measure the USB socket: VBUS to ground should read between 4.75 and 5.25 V.
- Connect the 10 ohm, 5 W resistor across the output for ten minutes. It draws 500 mA. Recheck the voltage and feel the heatsink; it may be hot but should not be too hot to touch for a second.
- Only then plug in a phone with a known-good cable and check that it shows charging.
- Enclose the circuit in a ventilated box with the fuse accessible.
Troubleshooting
- Output is 0 V: fuse blown, D1 reversed or battery reversed. Check each in order.
- Charging starts and stops repeatedly: the 7805 is reaching thermal shutdown. Use a larger heatsink or move to a buck converter.
- Output above 5.25 V: the regulator is faulty or oscillating. Check C2 and C3 are right at the pins.
- Phone says it is not charging: try another cable, and test with the data pins shorted only if you have upgraded to a buck converter.
- Battery goes flat: remember the battery also needs recharging; a phone charge takes only a small fraction of a 100 Ah battery.
Summary
A fuse, a reverse-polarity diode and a 7805 with proper capacitors turn a 12 V battery into a safe 5 V USB supply. The heatsink calculation explains why linear regulators suit modest currents, and the USB data pins explain how a phone decides how much current to draw.