Battery and USB load sharing circuit
Build it step by step
0 of 7 doneWire the charger
Cell on B+ and B-.
Wire the Schottky
USB to the load.
Mount the MOSFET on a breakout
Drain, source, gate.
Add the gate resistor
100 k to ground.
Test with USB
Load runs, battery not drained.
Test without USB
Load runs from the battery.
Check charging
Charger LED lights.
How do you build a battery and USB load sharing circuit?
A P-MOSFET and Schottky diode let a gadget run from USB when it is plugged in and from its battery otherwise, while the battery charges. You need AO3401 P-channel MOSFET (SOT-23), Schottky Diode 1N5819, Resistor 100 kΩ, TP4056 module with protection (USB-C), Li-Po battery 3.7 V 1000 mAh and Digital multimeter. It takes 7 steps and about 120 minutes.
- Level
- Intermediate
- Time
- About 120 min
- Parts
- 6
Wiring
| From | To | Why |
|---|---|---|
| USB 5 V | TP4056 IN+ and the Schottky diode anode | Charger and load path |
| Schottky diode cathode | Load plus | USB feeds the load |
| Battery | TP4056 B+ and B- | Charged by the module |
| TP4056 OUT+ (protected battery) | P-MOSFET drain | Battery side |
| P-MOSFET source | Load plus | Battery feeds the load |
| P-MOSFET gate | USB 5 V, with 100 k from the gate to ground | Off with USB, on without it |
| Load minus, USB minus, TP4056 negatives | Common ground | Return |
No code needed
Many gadgets need to run from USB when it is plugged in and from a battery otherwise, without ever switching it off in between. Two parts do this. The Schottky diode lets USB power the load while stopping the load from feeding back into the USB port. The P-channel MOSFET passes battery power to the load only when the USB is absent: with USB present the gate is at 5 V, close to the source, so the MOSFET is off, and its body diode is reverse-biased so it blocks; without USB the 100 k resistor pulls the gate to ground, the MOSFET turns on and the battery runs the load. The TP4056 charger module charges the cell from USB at the same time. Check with a meter where the current comes from in each case: with USB it should come from the Schottky and the battery should not discharge. Use a protected module and a protected cell, a proper holder, and do not charge a cell unattended. The AO3401 is a tiny surface-mount part, so use a breakout board for it. There is no code for this build.
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| USB present | Load runs at about 4.7 V, battery charging |
| USB removed | Load keeps running from the battery |
| Battery current with USB | Charging, not discharging |
| Plug in again | No dip at the load |
If it does not work
Load dies when USB removed
Check the MOSFET orientation and the gate resistor.
Battery drains with USB
The MOSFET is on: check the gate connects to USB 5 V.
Load voltage low
Remember the Schottky drops about 0.3 V.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the battery and USB load sharing circuit?
AO3401 P-channel MOSFET (SOT-23), Schottky Diode 1N5819, Resistor 100 kΩ, TP4056 module with protection (USB-C), Li-Po battery 3.7 V 1000 mAh and Digital multimeter.
How long does the battery and USB load sharing circuit take to build?
About 120 minutes for a intermediate maker, in 7 steps.
How do I know the battery and USB load sharing circuit works?
USB present: Load runs at about 4.7 V, battery charging. USB removed: Load keeps running from the battery. Battery current with USB: Charging, not discharging.
Load dies when USB removed: what should I check?
Check the MOSFET orientation and the gate resistor.
Battery drains with USB: what should I check?
The MOSFET is on: check the gate connects to USB 5 V.
Load voltage low: what should I check?
Remember the Schottky drops about 0.3 V.
