i got 2600 mAh powerbank for Pi and it manages to stay for some time for my use..But i want to avoid wrong shutdowns due to power failures so ..

Which will be the best way to avoid power failure shutdown ...

  1. How to know that how much battery power is remaining ?
  2. and then after at certain stage of battery, how to make Pi SHUTDOWN auto ?

if it is not possible, then how android devices manages to do that ?

3 Answers 3


In the scenario of a USB power pack, you'd have to add a circuit to the Pi that monitored its own voltage, e.g. through an ADC (analogue-to-digital converter). This would give you the capability to estimate when battery was low enough to trigger the internal power pack cut-off. A simple service running in the background would check the voltage every few seconds and could trigger the shut down as necessary.

There's some circuitry out there that already does this. The MoPi board should be shipping soon. It has all of the hardware and software to do the monitoring and shut down from batteries. Something like it is probably the best bet for an easy solution to battery power.

  • It has shipped and is available, also worth considering is the UPS Pico from PiModules.
    – SlySven
    Commented Dec 18, 2015 at 0:05

This is not possible due to the fact that the Raspberry Pi does not have the drivers to handle power management in terms of batteries. I am not sure how mobiles do it, but I believe they have a built in chip for the regular battery, but in these USB powered ones I believe it may just be measuring the voltage, correct me if I am wrong.

  • so is there no way to know that the powerbank is about to drain completely Zero ? Commented Feb 22, 2014 at 12:21
  • Quite possibly, unless there is a kernel module. The way the Pi is built is really not good for this thing. You might be able to wire up a circuit that sends data through USB on the battery charge, but for that I really dont know. Commented Feb 22, 2014 at 12:22

I hope this is usefull: http://raspi.tv/2013/controlled-shutdown-duration-test-of-pi-model-a-with-2-cell-lipo



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.