Hacker News new | ask | show | jobs
by fivesixzero 2403 days ago
RPi power consumption and power supply is a bit more complicated than it seems on the surface.

A large problem is that even “3A rated" supplies suffer large voltage droop under load. This can be seen pretty easily using a cheap USB DC load [0]. As load goes up, voltage tends to drop slowly at first, then heavily at a certain point.

Several I’ve bought drop as low as 4.1V at just 2A load which will almost definitely make any Pi very unhappy. I haven’t found an authoritative source but generally the Pi’s power management system starts complaining (flipping the “undervolt since boot” bitflag [1] in “vcgencmd get_throttled”) around 4.6-4.7V [2]

To monitor the throttled bitflags, which also report thermal throttling, I wrote a basic shell script that just converts the hex to bin then returns a Grok-ready string with the flags as booleans. I've already got Telegraf on the RPis sending basic host metrics to an InfluxDB instance so that script just gets called by an exec input to generate and persist the data for monitoring or analysis.

Eventually I'd love to write (or contribute to) a proper Golang Telegraf plug-in that just reads from the VC mailbox directly but that's still on the back burner.

As far as actual power consumption during use, I’ve recently started running tests using a decent USB power meter (WITRN/Qway U2 [3] and X models, in particular) to monitor load over time while running various workloads on a Pi Zero W, a Pi 3B+ and a 4GB Pi 4.

Power usage at idle is usually low but even that's unpredictable. Daemons are gonna daemon regardless of the user load. Generally though the load goes up substantially when powering peripherals - Ethernet, USB, BCM VideoCore enc/dec/CSI/SSI, SD card R/W, HDMI, fans, HATs, GPIO peripherals, etc. CPU load definitely factors in heavily, of course, but it’s only part of the picture.

For reducing power usage, some surprisingly simple things can help. As a very minor example, shutting off the activity LED [4] can save a few dozen mA. :)

[0] https://www.droking.com/Intelligent-USB-Adjustable-Constant-...

[1] https://raspberrypi.stackexchange.com/questions/48329/underv...

[2] https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=1477...

[3] https://usbchargingblog.wordpress.com/2018/08/11/web-u2-usb-...

[4] https://www.jeffgeerling.com/blogs/jeff-geerling/controlling...

2 comments

>drop as low as 4.1V at just 2A

the whole point of a 3A rated 5V power supply is it will not drop more than ~5% under its rated load. What you describe is being a victim of a fraud.

According to [1] a 1 meter USB cable can have a resistance of 286 milliohms, for a voltage drop of 0.8v over a meter (taking the resistance of four contacts and two lengths of cable into account).

So if you have a '3A 5V' power supply without a captive cable, you can still get 4.1v at the useful end of the USB cable.

The official RPi chargers include a captive cable, presumably to stop users substituting such standard USB cables.

[1] https://www.westfloridacomponents.com/blog/compensate-cable-...

The raspberry pi sells power supplies not chargers
A lot of the USB chargers most people see are way lower than the rating marked on them. That is why you should buy a special charger for your stuff, not the generic cheap stuff at the supermarket.
Thanks for your extensive analysis!

Did you ever publish the results of your power/load monitoring on the various boards?

Haven’t reached any degree of publishing quality yet, but it’s something I’m aiming to do if time allows.

Ideally I’d prefer to Yep people run their own testing and monitoring. This stuff isn’t rocket science, just requires a bit of knowledge, inexpensive tools, and a bit of logical framing. :)