In my application, the raspberry pi (A+) is remotely located and is powered using Powerboost 1000c. The powerboost is connected to a battery (lipo) and a solar panel. The battery is rechargeable and is charged via solar power. In the ideal case, I would love my Rpi to run 24/7, but since I have limited battery and solar power only works in the daytime, I need to shutdown Pi whenever it is not feasible to run it anymore.

In my understanding, the powerboost chip works as follows:
If V_usb==ON (i.e. solar power is ON), then it powers the pi and charges the battery (if required).
If V_bat > 3.2v (critical voltage), LBO is shown as HIGH. But if V_bat drops below 3.2v, it is pulled down to LOW

We can classify the operation into the following cases:
Case 1: V_usb (solar power) == ON and LBO == HIGH -- Trivial
Rpi is powered by solar power
Case 2: V_usb == ON and LBO == LOW -- Trivial
Rpi is powered by solar power and the battery is also charged simultaneously.
Case 3: V_usb == OFF and LBO == HIGH
Rpi is powered by the battery.
Case 4: V_usb == OFF and LBO == LOW
Shutdown the Rpi and wait for the solar panel to re-charge the battery.

So far with the help of community, I came up with the following circuit:
Rpi safe shutdown circuit

The idea behind the circuit is as follows:
The diodes (A, B) are used in parallel to create a logic OR gate, the purpose is to keep the power ON if either V_usb==ON or LBO==High. The output of the logical OR gate is fed to the capacitor+resistor discharging circuit, which takes around 10secs to discharge after the power is switched OFF (i.e. V_usb==OFF and LBO==Low) which is enough time to execute a shutdown script on the PI.
So far the circuit works as expected i.e. Keep the Pi ON if either V_usb==ON or LBO==High, otherwise execute complete shutdown.
But, since the powerboost chip is not disabled after the complete shutdown, it continues drawing the power which can damage the battery. To handle this issue, what I did was fed the capacitor voltage to the base of a PNP transistor, where the collector is grounded and the emitter is connected to the Enable pin on Powerboost. The idea is to ground the En pin as soon as the capacitor is completely discharged (to disable the powerboost chip).

Now what happens is after the capacitor is completely discharged (10 secs after LBO==LOW and V_usb==OFF is detected), the chip is disabled with the help of the above logic. But right after that, the LBO pin is detected as High (I am not sure why this is happening, but I think it is because there is no load on the powerboost chip and that's why LBO goes to high again). This causes pi to boot up again because the voltage at the base of PNP transistor > 0 which in turn enables the En pin, but since the battery is already at the critical voltage and there is no solar power, the pi goes back to halt. In summary, the above logic is causing the pi to boot in a loop (boot --> shutdown --> boot ...). Is there way I can avoid this undesired bootup+shutdown behavior?

Any help is appreciated!

  • \$\begingroup\$ The problem that I see in your circuit in its current form is that when LBO goes LOW, you turn your Pi off, which is desired. However this removes the load which will then cause LBO to go HIGH due to voltage fluctuations. What you need to solve this is an additional form of logic, that says "Once LBO is LOW, ignore LBO is HIGH until VUSB is HIGH". You need to set it up so that your Pi powers down on LBO is LOW, but powers up when VUSB is HIGH. \$\endgroup\$ Jun 16, 2016 at 2:03
  • \$\begingroup\$ @Samuel, I agree that the rebooting loop is coming from putting on/taking off the load from powerboost, and therefore an additional logic is required to stop this behavior. Let me do a rough sketch of the logic. I'm thinking of adding another switch between LBO and the OR gate input, essentially let LBO pass if capacitor+resistor circuit still has charge, else block it. \$\endgroup\$
    – redM0nk
    Jun 16, 2016 at 2:12
  • \$\begingroup\$ That's a good point. Why not put a transistor (NPN?) between LBO and Diode B. Connect the base to the capacitor side of Diode B (appropriate resistor needed). When LBO goes HIGH again, the transistor should block the signal, until the base is powered by V_USB. \$\endgroup\$ Jun 16, 2016 at 2:25

2 Answers 2


The circuit you designed works as specified. The issue is in you spec:

Case 3: V_usb == OFF and LBO == HIGH: Rpi is powered by the battery.

This requirement doesn't do anything to prevent the boot-shutdown-boot loop you're seeing. You could avoid this behavior by specifying, for example:

Case 3: V_usb == OFF and LBO == HIGH: If Rpi is running, keep it powered by the battery. Otherwise, don't start it.

This change makes it obvious that your system either needs to keep track of the state, or use an additional signal (RPI_RUN) which your Rpi should pull to HIGH when running. Those possibilities can be illustrated as follows:


simulate this circuit – Schematic created using CircuitLab

  • 1
    \$\begingroup\$ Thanks @Demitry, The logic makes sense. I have a spare DM7409 chip, I will test it today. \$\endgroup\$
    – redM0nk
    Jun 16, 2016 at 18:13
  • 1
    \$\begingroup\$ The 'and' gate before diode B with LBO and RPI_RUN gpio as two inputs fixed the issue. Now, Rpi wait for solar power to recharge the battery. \$\endgroup\$
    – redM0nk
    Jun 17, 2016 at 14:33

Without knowing too much about the circuit, if there is unknown behaviour, it wouldn't hurt to tie LBO low so that it's not floating if it's not being driven by the Powerboost 1000C.

Also, the PNP transistor base voltage will drop slowly, putting it in the analog, non-linear region. The diode drop across your OR gate may not help?

Good luck! Feel free to correct me if I'm wrong :)

  • \$\begingroup\$ Hello @Brian, thanks for the response. So LBO pin is controlled by the powerboost chip and it's an indicator is the battery (V_bat) is > V_critical (HIGH) or < V_critical (LOW). The above circuit is something I came up by picking bits of information from here and there. I'm open to change/modify the circuit if it makes it efficient. What I'm trying to do (where the current logic is failing) is if the battery is below threshold and there is no solar power, then shut everything off (pi + powerboost chip) and wait for the solar panel to recharge the battery. \$\endgroup\$
    – redM0nk
    Jun 16, 2016 at 2:03

Your Answer

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

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