4

So I have a pi running Kodi, when it's in trouble it gives a powerbolt on the screen.
Great. Now I know.

Secondly I have a pi as a webserver headless 100% of the time.
How can I log/see if it suffers from undervoltage.

I know that you should use a decent Amp adapter, but that's not the question.

The question is:
how do I log undervoltage on a headless pi?

2 Answers 2

1

I'll sketch out a method which may work on some Pi models.

The A+, B+, and Pi2B have a red power LED connected to GPIO 35. This GPIO changes state while there is a power drop below 4.65V. I say changes state because I'm not sure if it is always low to high or high to low. The direction may depend on the Pi model.

For those Pi models you could monitor GPIO 35 for state changes and record the changes in a log.

In this answer @milliways points to a method for reading the Pi3 power LED.

3
2

When in headless mode, you can read out the diagnostic messages through the command line. If there is undervoltage, the dmesg command will output something like:

...
[47124.394081] Under-voltage detected! (0x00050005)
[47128.554071] Voltage normalised (0x00000000)
[47423.915258] rpi_firmware_get_throttled: 1 callbacks suppressed
[47423.915267] Under-voltage detected! (0x00050005)
[47428.075246] rpi_firmware_get_throttled: 1 callbacks suppressed
[47428.075252] Voltage normalised (0x00000000)
[47544.555780] Under-voltage detected! (0x00050005)
...

Hence, you can use the following command as a check:

dmesg | grep -iC 3 'under-voltage detected'
1
  • In my case the text to grep for was "Undervoltage detected".
    – sagacity
    Oct 30 at 20:22

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.