Projects / Battery and USB load sharing circuit

Battery and USB load sharing circuit

Intermediate2 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. Wire the charger

    Cell on B+ and B-.

  2. TP4056

    Wire the Schottky

    USB to the load.

  3. AO3401

    Mount the MOSFET on a breakout

    Drain, source, gate.

  4. Add the gate resistor

    100 k to ground.

  5. TP4056+

    Test with USB

    Load runs, battery not drained.

  6. TP4056+

    Test without USB

    Load runs from the battery.

  7. Check charging

    Charger LED lights.

In short

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

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
USB 5 VTP4056 IN+ and the Schottky diode anodeCharger and load path
Schottky diode cathodeLoad plusUSB feeds the load
BatteryTP4056 B+ and B-Charged by the module
TP4056 OUT+ (protected battery)P-MOSFET drainBattery side
P-MOSFET sourceLoad plusBattery feeds the load
P-MOSFET gateUSB 5 V, with 100 k from the gate to groundOff with USB, on without it
Load minus, USB minus, TP4056 negativesCommon groundReturn

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.

CheckExpected
USB presentLoad runs at about 4.7 V, battery charging
USB removedLoad keeps running from the battery
Battery current with USBCharging, not discharging
Plug in againNo 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 →

Ask Lark AI

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.