Connected to my pi is an adafruit fona (a cellular phone), and a manhattan usb hub with external power. My pi, as well as the fona, are connected to a 3.7V 1200mAh backup battery. The pi is configured to detect when the AC power supply is disconnected, and shutdown properly. This whole system works perfectly, except for one thing; the USB hub draws power from the pi when it's AC power is cut off (which it would be when the pi's power is cut off) This happens even when the pi is completely off, and this is a serious problem, as it drains the backup battery which is only intended to allow the pi to shutdown properly.

My question is, how can I stop the battery from providing power after the pi shuts down?

I've considered both relays and transitors used as switches to turn the power off (when not running but powered, some of the pi GPIO's output a resting 3.3V, so that could be used in logic even when the pi is off), but both of those require a voltage to turn off the power, and once pi is shutdown and the battery power cut off, there's no voltage to logically turn the battery off. Thus, a bit of an infinite loop problem. Maybe there's a transistor that only allows power through when the base provides voltage? In that case, the pi could turn on and off the battery, but it would be shut off and stay that way when the pi turns off.

  • Hello and welcome. I'd recommend to take the question to electronics.stackexchange.com to get an electronics hardware answer (essentially it does not matter whether it's connected to the Pi or something else).
    – Ghanima
    Commented Nov 18, 2015 at 22:28

1 Answer 1


This problem was solved using a normally open reed relay. When starting up, the pi would apply power to the relay via gpio, closing it's circuit with the battery. When it powers down, the power to the relay is cut, opening the circuit, and effectively cutting off it's own backup power and disallowing connected devices from draining the battery while the pi is turned off.

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.