19

I'm a newbie to Raspberry Pi's, but one of the things I was thinking about doing is running it off batteries (I see many people do this) - that led me to concerns about shutting down gracefully. Is there a software only solution that would allow me to detect input voltage?

1
  • See also this answer for how to detect undervoltage with software. Commented Jul 18, 2021 at 0:23

3 Answers 3

10

you'll need some external circuitry to do that, because afaik the raspberry does not provide the battery voltage anywhere in the system: http://raspi.tv/tag/raspberry-pi-monitoring-its-own-battery-voltage

2
  • Apparently this is not true anymore, since newer boards show an thunderbolt icon when underpowered. Commented Jan 19, 2017 at 11:46
  • @DmitryGrigoryev: Is the "Low Voltage Warning" no longer asserted on GPIO 35?
    – Seamus
    Commented Oct 10, 2020 at 18:17
12

vcgencmd will show the internal voltages for core, sdram_c, sdram_i, and sdram_p:

vcgencmd measure_volts core

The output will look something like this:

volt=1.20V

The following shell commands will display all the voltages:

for id in core sdram_c sdram_i sdram_p
do
    echo -e "$id:\t$(vcgencmd measure_volts $id)"
done
2
  • what should be the voltage for each?
    – HelpNeeder
    Commented Dec 20, 2016 at 4:56
  • 7
    Unfortunately these are all things inside the 3.3V regulator, meaning not so handy for detecting a gradual decline on the 5V rail.
    – goldilocks
    Commented Jan 18, 2017 at 19:22
1

No, but MoPi is a tidy little board that provides the capability.

1
  • 1
    Can you explain how to use MoPi?
    – Kachamenus
    Commented Oct 14, 2015 at 21:51

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.