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?


1 Answer 1


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


Some Raspberries can detect whether the input voltage is below 4.65 V or not - and provide a simple answer of yes/no , true/false. They use this binary distinction to display the undervoltage symbol.

  • 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, 2016 at 7:09
  • 4
    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, 2016 at 7:16
  • 3
    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. Feb 7, 2017 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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