I'm trying to design a circuit that provides backup LiPo battery power to a +5v rail. The rail is sometimes powered by an external USB supply and sometimes not - I want my circuit to act as a power sink when the USB supply is present and act as a source when it is not. The main difficulty is that the USB supply and the load are joined together in an external system and cannot be separated - the only interface I have to this system is the +5v rail at point A in the schematic below:

enter image description here

This is the best solution, I can think of, but it is incomplete. My main questions are,

  1. Will the small resistance in series with the boost converter effectively prevent the battery discharging when Vusb is present?
  2. How can I obtain the active-low enable input (EN) for the battery charger, that is high when the boost converter is providing current and low otherwise?
  3. Can anyone suggest a better solution that charges/discharges a LiPo according to whether another power source is present or not, where the USB source and load are hardwired together and cannot be separated?
  • 2
    \$\begingroup\$ I'm surprised you would try to build a complex power supply/charger with BBU when you can buy one so cheaply. I've used this one many times for driving small embedded systems: adafruit.com/products/1944 they tell you the chips on board so you can work out how it's built, but it relieves you of so much toil. \$\endgroup\$ Nov 29, 2016 at 5:27
  • \$\begingroup\$ Unfortunately the Powerboost (and all other power supplies I've come across) need to be placed BETWEEN the USB source and the load. The problem I'm trying to solve is how to implement a BBU when the USB supply and the load are hardwired together. \$\endgroup\$ Nov 29, 2016 at 9:23
  • 1
    \$\begingroup\$ The powerboost uses a 5 V (USB connector) supply to both supply the load and charge the LiPo. The fact that (as in your diagram) you have another hardwired USB connection would seem irrelevant. In your diagram to the right of the dotted line would be a Powerboost and to the left your existing USB connection. If the USB connection has Polyfuse then you need to be aware you will potentially have reverse current flow into the USB system. \$\endgroup\$ Nov 29, 2016 at 16:54
  • \$\begingroup\$ That's an option but unfortunately it isn't an answer to my question. I'm specifically interested in designing for the situation when the USB source and the load are hardwired together. Adding a second USB source to the right of the dotted line isn't an acceptable solution. \$\endgroup\$ Nov 30, 2016 at 8:14
  • 1
    \$\begingroup\$ You are not adding a USB source to the right. You are adding a power supply and backup that uses a USB connector....there is no USB data pins. On the Powerboost I used the USB output connector was shipped separately, though I installed it. \$\endgroup\$ Nov 30, 2016 at 17:24

1 Answer 1


You need to sense if there is 5v on the USB rail, and know where that voltage is coming from. Here is my solution to your problem:

enter image description here

In summary, you need to provide a reference voltage using the Lipo battery. Compare this reference voltage to the USB 5v rail using an op amp to sense if there is 5v present on the rail. Also, use the output of the boost converter (before the diode) to sense if the boost converter is on. Feed the "boost converter on" signal and the "5v present" signal into a NAND gate to get an active low signal for the charger circuit. To enable the boost converter, feed the "5v present" signal into a not gate, and connect the output to the boost converter enable terminal.

The resistor dividers including R1, R2, R3, and R4, need to be set up so that the output voltage is 0.5v. (Or anything less than your reference voltage, the important part is that they are the same.)


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.