I designed a food dispenser using a rPi+touchscreen, a h-bridge L293DN and a Mercury stepper motor SM-42BYGO11 (from Sparkfun). The system works great except that I need to have it powered by a battery. I have a 5V LiPo rechargeable micro-USB battery for the rPi and a 9V alkaline battery for the stepper motor through the h-bridge. Unfortunately something draws a lot a power on the batteries and if I leave them plugged in, they both discharge overnight even though the system is turned off. I'm unclear why and it's inconvenient because the system enclosure is hard to open so I don't want to have to unplug them all the time.

The h-bridge is powered by the rPi, so is the touchscreen. So when I turn it off they should stop drawing power, yes? And because the h-bridge is off, it should also stop drawing power on the 9V battery. So why are the batteries discharging so quickly and how could I prevent it? Also, when I turn off the rPi I have to unplug and replug the battery to boot it again. Is there an easy way to make the rPi boot without having to unplug the battery?

  • 1
    The Pi draws circa 100 mA even when off. Could that be the problem?
    – joan
    Dec 1, 2017 at 20:38
  • Good to know. But when I used the the Pi without the motor I I could still use the same battery for days without recharging it. So I strongly suspect the motor is the problem. But I don't know why or how to fix it.
    – baca
    Dec 1, 2017 at 21:08

2 Answers 2


Your 2 issues are actually symptoms of the same problem: when the Raspberry Pi is turned off, it isn't really turned off. Indeed, the hardware remains powered and will continue to draw power. Since you have other things connected to the Pi, they will continue to draw power as well.

To bypass this "feature", you will need to hardwire a toggle switch into the battery's micro-USB wire, and you may want to do the same for the other battery. Make sure you poweroff the Pi using a software shutdown command first or your SD card will get corrupted by just yanking the power.

  • Thanks. I'll look into that. Can a Pi turned off really draw so much power as to empty a fully charged 5Ah battery and a new duracel 9V battery in less than 24h? This seems like a serious design flaw.
    – baca
    Dec 1, 2017 at 21:29
  • @baca I'm not a fan of this feature either, but the power draw is accentuated by all your peripherals.
    – tlhIngan
    Dec 1, 2017 at 21:34
  • Ok thanks. I was hoping there could be a simpler fix than putting switches.
    – baca
    Dec 1, 2017 at 22:14

One thing a lot of people don't know is that the 5V GPIO PWR pins are directly connected to the input power supply to the board. Even with the board off, any load between those pins (or the 3.3v pin) and the GND pins will result in increased power draw.

So, you may want to look at what you have connected to the GPIO to see what's happening there.

Hope this helps!

  • Ha! Thank you very much. I suspected something like that. It makes sense now, the h-bridge is powered by the VCC output of the gpio. So it stays powered even when the Pi is off, and therefore also continues to draw power from the 9V battery. In any case, it seems I don't have a choice except putting switches to unconnect the batteries.
    – baca
    Dec 1, 2017 at 23:42

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.