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


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?


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.

  • 2
    \$\begingroup\$ Do you believe that a USB power bank expects to have 12V connected to its output? \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 29 '16 at 21:55

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.

| improve this answer | |

I think it depends on the USB battery pack. I have never seen one that can take 12V for charging but they might be out there.

If your pack only takes 5V then you will need to replace the D2 diode with something like a voltage regulator that has the appropriate current blocking directions.

| improve this answer | |
  • \$\begingroup\$ That was mistake, I will use standard usb battery pack for mobile phones. I will look into voltage regulator with current blocking direction. Thanks \$\endgroup\$ – Bobi Aug 29 '16 at 22:20
  • \$\begingroup\$ Your latest schematic edit looks good to me with the exception that the diode drop would prevent the battery from fully charging (or charging at all depending on the charger IC in the pack) \$\endgroup\$ – Daniel V Aug 29 '16 at 22:24
  • \$\begingroup\$ Can I fix this by selecting higher voltage regulator and select diode to drop voltage to 5v? \$\endgroup\$ – Bobi Aug 29 '16 at 23:00
  • \$\begingroup\$ In theory yes, but the diode drop is temperature dependent and hard to control in general. If your battery pack accepts 5V +/- some generous tolerance it might work. I would give it a try \$\endgroup\$ – Daniel V Aug 29 '16 at 23:10
  • \$\begingroup\$ I checked in store battery pack doesn't have any other information other than that it is usb and 1000ma max charge. \$\endgroup\$ – Bobi Sep 2 '16 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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