9

How can I see what the power consumption and/or distribution of my pi is via terminal?

I can only connect to the pi in question via ssh. So I can't see the "lightning bolt".

I am concerned about something plugged into the pi's 5V pin, and would like to see if there is a way to view how the pi is distributing power (if that's even a thing that CAN be viewed) to its various pins, and how much power the pi is consuming as a whole, stuff like that.

Like how vcgencmd measure_temp and top are very useful for their respective functions. Is there an equivalent for power consumption and/or distribution?

1
  • 2
    The lightning bolt should be accompanied by Under-voltage detected! in the system log.
    – goldilocks
    Commented Dec 20, 2019 at 16:04

2 Answers 2

4

vcgencmd get_throttled will show current/past under-voltage - which is what the lightning bolt / Red LED show.

The Pi has no means to monitor current.

Latest bits are

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
2

According to the comment below, the following is obsolete.

A little Google-fu finds this: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=82373&start=75#p739517 which may be the answer.

NB: The following is copied from the link above to comply with the Stack Exchange policy of not posting only links. This is not my work.

    import RPi.GPIO as GPIO , time

    redLED=35
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(redLED, GPIO.IN)

    powerlow=0
    while True:
            if(GPIO.input(redLED)==0):
                    print "POWER dipped below 4.63v"
                    powerlow += 1
            else:
                    powerlow =0
            if (powerlow  > 3):
                     print "Low power for " + str(powerlow) + " seconds"
            time.sleep(1)

Something simpler could be vcgencmd measure_volts <id> Shows voltage. id can be one of core, sdram_c, sdram_i, sdram_p, and defaults to core if not specified.

That came from this link: https://elinux.org/RPI_vcgencmd_usage. However, I doubt that will really do what you want. You could try both and stick with the one that actually works. On a properly-operating Pi 3B+ the core voltage indicated by that command is 1.20 V.

1
  • 1
    That code will only work on very old Pi. The power LED is NOT on pin 35 in current models.
    – Milliways
    Commented Dec 20, 2019 at 23:29

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.