My goal is to build a circuit that uses a battery (B) as backup when the current from a 5 VDC power supply goes away. When we have power there then we supply current to the load (R) and charge the battery. When the power goes away (assuming it is either 5 V or 0 V) we start discharging the battery.

The voltage at the load is supposed to be between 5 and 3.3 VDC and the current about 200-280 mA.

I have drawn a diagram of what I hope to accomplish (when the power supply goes away there is no more current in the top wire, that is when we start drawing current from the battery B).

enter image description here

What kind of circuit can I use instead of the box X? I was thinking to use an NPN or perhaps an opto-coupler, but the trouble is that I want the reverse behavior of what these circuits accomplish.

  • 1
    \$\begingroup\$ How about a couple of relays? \$\endgroup\$ Commented Jan 24, 2023 at 23:13
  • \$\begingroup\$ you cannot charge and discharge a battery at the same time ... the current flows in only one direction \$\endgroup\$
    – jsotola
    Commented Jan 25, 2023 at 2:27
  • \$\begingroup\$ @jsotola, that is what I thought aswell but if you google charging and dischargin powerbank at the same time 50% of the results say no and rest says yes. Also there is a term Pass Through Charging for some reason \$\endgroup\$
    – Clone
    Commented Jan 25, 2023 at 18:53
  • \$\begingroup\$ @ElliotAlderson, I would then need a controller to control the relay and then some power to power the switching '8that is what I think not necessarily correct) \$\endgroup\$
    – Clone
    Commented Jan 31, 2023 at 0:20
  • \$\begingroup\$ What voltage range can your load accept? If wide enough, you can get by with just two (Schottky) diodes. \$\endgroup\$
    – winny
    Commented Feb 2, 2023 at 8:36

1 Answer 1


It sounds to me like you want one of those "battery charging boost modules" available on eBay for around a dollar. They hook up to a power source, li-ion battery, and load. They charge the battery while powering the load when the power source is present and discharge the battery at a boosted voltage (above the nominal 3.6v, adjustable) while powering the load when the power source is removed. There are many similar variations on the module with different output voltages and protection features. Most of these boards feature the TP/TC4056 BMS chip.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.