44

Is it possible to measure (with software, like PowerTOP) the Pi's current power consumption, on my Raspberry Pi?

3
  • 1
    "On" your Pi... as I think you mean, or "of" your Pi, which others think you mean?
    – user59377
    Commented Jan 4, 2017 at 21:03
  • 1
    @user59377 - whilst I have up voted your comment, due to its call for clarification... I believe that the OP actually wants to measure the consumption using software running on the Pi - so "on" is correct, and "of" is not. Commented Apr 23, 2017 at 11:43
  • I find it amazing that none of the 4 answers here actually showed any results to substantiate their claims that powertop was inaccurate or not useful. To be clear: I am not arguing that it is (I haven't tried it yet), but dismissal without substantiation certainly isn't best practice.
    – Seamus
    Commented Oct 2, 2020 at 21:37

5 Answers 5

17

No. You cannot accurately measure the power consumption of your Raspberry Pi by just software. There needs to be some hardware in place in order to do this and devices rarely have this by default.

The easiest option would be to use a wall outlet power meter or usage monitor. You can buy these for $10-$20 at a local store.

Without such hardware, the best you can get are estimations.

4
  • i have outlet power meter, but i'm too lazy :D...and for devices with intel cpu i can use powertop. So my idea was to use something like powertop, but for arm ;)
    – cupakob
    Commented Oct 8, 2012 at 18:23
  • 4
    PowerTOP gives you an estimation, not a real measurement. The estimations are intended for comparison when you want to try different power saving features out. For laptops PowerTOP can make better estimations by doing measurements on your battery level and performing calculations. That is something you cannot do on a PC or Raspberry Pi. Read more about it here.
    – Derecho
    Commented Oct 8, 2012 at 21:05
  • 2
    The easiest option would be to use a wall outlet power meter or usage monitor. That's fine if you want to know how much power your setup is using, but not if you want to know how much power your Pi is actually getting. Power adapters and even USB cables can waste significant power. I've read of USB cables dropping a whole Watt or Volt (I can't remember which was said, but they'd be about the same in some conditions).
    – Nateowami
    Commented Jan 5, 2016 at 11:44
  • I tried using my outlet meter, and it's accuracy was too low. It reported a constant 2 watts, even when the PI was off.
    – Iain
    Commented Aug 14, 2016 at 0:08
18

Your best bet is to use a USB voltmeter/ammeter between your USB power source and the Pi.

USB Voltmeter

In addition, you will require:

  • a USB micro to USB 'A' convertor from the power source to the USB voltmeter;
  • a USB 'A' to USB micro cable from the USB voltmeter to the Pi.

There are many different types ranging from $1 to $5, depending if you want a single display, a dual display, as pictured, or up to a quad display that also shows power (Watts) and charge (Coulombs)

2
  • 3
    This solution is superior to the one proposed in the accepted answer ` wall outlet power meter ` because it factors out the power supply unit efficiency, which is probably not constant over the working range.
    – Vorac
    Commented Apr 22, 2017 at 20:44
  • 1
    @Vorac - please feel free to upvote my answer, if you feel that it is a superior solution. :-) Commented Apr 23, 2017 at 11:38
11

Whilst you can't directly monitor the power consumption you can obtain information about the operating voltage of the: core (default), sdram_c, sdram_i, and sdram_p (see here for more details).

vcgencmd measure_volts <id>

e.g. To check the core voltage:

pi$ vcgencmd measure_volts
volt=1.2000V
4
  • Thanks for answer, i wonder why this doesn't work with the new user and works only with pi as user, any idea ? Commented Jan 2, 2018 at 18:35
  • @VinodSrivastav i don't have one here but check pi's groups and add relevant ones to your user (usermod -aG <group> <user>), don't forget to logout and login for the changes to take effect. Commented May 22, 2019 at 15:39
  • 2
    Power = V x I Voltage measurements alone are useless for power measurement.
    – Seamus
    Commented Oct 2, 2020 at 21:28
  • 3
    As @Seamus said, under normal operation voltages will be constant. So voltage measurement is only useful for detecting poor cables, bad charger, malfunctioning circuits on the PI, or stress tests (high load, high temperature), etc. You need the current (amps) or power (watts)
    – MestreLion
    Commented Nov 28, 2021 at 8:03
7

Q: Is it possible to measure (with software, like PowerTOP) the Pi's current power consumption, on my Raspberry Pi?

You can't actually measure power with software; that would be like attempting to measure time with a spoon. PowerTOP doesn't measure power - it only identifies software entities that utilize system resources which the clever people at Intel know cause more power to be consumed by the CPU.

Power, or in this case Electrical Power is a measure of the energy transferred/consumed per unit of time. The unit of measure for power is called a watt, and it's defined by the product of voltage and current. For the dc/time-invariant case:

P = V × I

And so - to measure the RPi's power consumption, we must measure the physical quantities of voltage and current at its input terminals. Neither of these can be measured by software; these measurements must be done with an instrument or transducer that converts a physical quantity to data that the software can read and use to make the calculations.

Off-the-shelf Power Measurement

There are a huge number of USB gadgets that measure current, voltage and power. A quick Internet search reveals many of these, mostly available from the usual suspects. If it's important to get software involved, at least one of these devices has a Bluetooth interface that may be used to fetch readings from the device for recording measurements. Otherwise, they mostly all display the data on a small screen.

USB & Bluetooth

DIY measurement

This will require more effort - and more software.

Let's start with measuring voltage: The analog input of an "Analog-to-Digital Converter" (ADC) may be wired to the power input - or anywhere on the 5V dc bus to serve as a voltmeter. The voltage readings are (typically) transferred to the CPU for processing via a serial port - SPI or I2C. This is reasonably straightforward, and there are many hardware and software examples available online.

Measuring voltage is "non-invasive" in that it only requires a wiring connection from the ADC analog input to an existing contact on the RPi. Current measurement is a different animal... current flows, and if you want to measure the flow, you must break the connection coming into the board, and insert your ammeter there. Yeah - a bit messy. Perhaps the cleanest way to do this is with a USB breakout board - this one would work

USB C breakout board

Now that we've got a point to insert the ammeter, we must choose the type of ammeter to use. We'll limit ourselves here to two alternatives, although there are others:

  1. a current shunt

  2. a Hall Effect sensor

What are the primary specifications to consider in selecting an ammeter?

  • For a Raspberry Pi, a measurement range of 0-5 Amps will be sufficient
  • The current sensor should not cause a significant voltage drop

With respect to current shunt vs Hall Effect, one trade-off is that the current shunt (a small resistance) will reduce the voltage delivered to the RPi, whereas the Hall Effect device will be (almost) too small to measure.

Allegro Microsystems' ACS712 uses Hall Effect technology to measure current over a claimed range of 0 - 50 amps with an effective series resistance of only 1.2x10-3𝛀. It may also be purchased as a sensor module from various vendors, similar to the picture below:

Hall Effect Ammeter

Perhaps a more salient consideration in choosing the voltmeter and ammeter is the integration effort. Texas Instruments' INA260 measures current with an integrated shunt resistor, and will also serve as a voltmeter. Both voltage and current readings are transferred over a single I2C interface. DIY power measurement could scarcely be any easier - and coding examples are available from numerous sources. The INA260 is said to measure 0-15 Amps, with a shunt resistance of 2x10-3𝛀. This equates to a voltage drop of approximately 2 mV at the RPi input terminals - only 800𝛍V more than the Hall Effect device.

enter image description here

The INA260 is also available as a sensor module to simplify hardware integration:

enter image description here

1

Use a multimeter in series with a bench top power supply, or look at the bench power supply itself if it has a built-in ammeter.

Measuring the whole setup (with power supply) won't give you an accurate reading of the Raspberry Pi's actual usage since you will also be measuring inefficiencies in the power supply you use.

1
  • 4
    Measuring with the power supply would however be an accurate representation of the costs associated with the usage. It depends on the goal whether you want to measure before or after the power supply.
    – Derecho
    Commented Dec 6, 2012 at 8:05

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.