I use a power bank to power my Raspberry Pi, and I want to create script to turn off the Raspberry Pi when the battery level is low, but I cannot find any command to visualize the battery level.

I don't know if is possible. Does such a command exist?

No Raspberry Pi can correctly measure its input voltage without at least one additional component.

https://github.com/aboudou/picheckvoltage

  • This is using a sledge hammer to crack a nut! An ADC to convert voltage then a program to monitor voltage is overkill. If you wanted to do this all you need is a comparitor and 2 resistors. Using a linear regulator is inefficient, and 1A inadequate for the Pi. – Milliways Jul 27 '16 at 7:09
  • 3
    That gives only a yes/no answer to "Is the voltage too low ?'" , doesn't it ? I think the Pi can already "measure" that : raspberrypi.org/forums/viewtopic.php?t=82373 – flakeshake Jul 27 '16 at 7:16
  • 2
    As @MohammadAli said in the comments, monitoring the output voltage of a power bank is meaningless: the output will stay close to 5V until the cell is empty and you have to shut down. – Dmitry Grigoryev Feb 7 '17 at 8:48
  • This is quite interesting, thanks for the link! – uhoh Jun 4 at 12:39

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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