Electrical – Backup power source from usb battery

batteriespower supply

I am trying to use usb battery bank as a backup power source for my diy project.

Project is using arduino to control transistors and to turn few devices (like
pumps and lights) on and off. Power source is 12v 3a adapter.

I would like to have usb with battery connected always and if possible to charge
it when main power is available.

Controller must know when main power is not available that it is running on battery.

This schematic is based on answer of
Automatic Power Selection Circuit

schematic

simulate this circuit – Schematic created using CircuitLab

N Mosfet is added to detect if main power is not available.

Will battery charge if I remove D2 diode? If not how could I get charging to work?

Is there anything wrong with this circuit or is there better way to
do this?

Update:

I added voltage regulator from 12v and diode to 5v. Is there something
else required for battery charging? Battery is standard 2200ma usb battery pack for phones.

Best Answer

I would suggest a PowerPath circuit topology. You could easily find many ICs for that job.

Linear Technology has very affordable solutions. The most cheap common is the LTC4412, a tiny PowerPath controller. In page 10, Figure 2 and 3 show some solutions that might fit your demands.

Consider the "WALL ADAPTER INPUT" as your main 5V input. If you want always 5V output from a rechargeable battery even when the main 5V power is absence, just put a DC to DC step-up converter after the battery charger and before the Primary mosfet.

Related Topic