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?

janw
  • 533
  • 3
  • 8
  • 19

2 Answers2

3

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

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.

joan
  • 71,852
  • 5
  • 76
  • 108