2

Responses to this post: How does RPi "know" when it hasn't got enough power indicate that there is a digital input somewhere on the RPi which indicates what the supply voltage has dropped off too low.

How can this be accessed by a script, please? Ideally, it would be Python, but if I can find the Linux file containing the data, I can work with that.

(I'm hoping to get really lucky and get access to the supply voltage, but the indications are that the RPi only has access to a digital signal indicating "too low".)

Thanks.

2
  • I don't believe there is anything built into the Pi that can ready the supply voltage, only the 'too low'. Why do you want to ready the voltage? Why not just use an ADC and voltage divider circuit?
    – CoderMike
    Oct 25, 2020 at 12:06
  • I suspect you're correct. I could easily add an I2C ADC to a GPIO. this particular device isn't in an electronic project, though, so I'd just as soon employ any built-in hardware, if available, though, and keep it as "off-the-shelf" as possible. Thanks.
    – KDM
    Oct 25, 2020 at 12:11

1 Answer 1

2

Use vcgencmd get_throttled

This is the only reliable method, as the hardware changed between Pi models and in later models is only available from the kernel.

Interpretation of the results

https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=147781&start=50#p972790 https://www.raspberrypi.com/documentation/computers/os.html#get_throttled

0: under-voltage
1: arm frequency capped
2: currently throttled
3: Soft Temp limit reached  3
16: under-voltage has occurred
17: arm frequency capped has occurred
18: throttling has occurred
19: Soft Temp limit has occurred

If bit 0 is 1 under-voltage is detected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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