Skip to content

Latest commit

 

History

History
57 lines (30 loc) · 5.08 KB

RPiPowerMeasurement.md

File metadata and controls

57 lines (30 loc) · 5.08 KB

Measuring Power Consumption of the Raspberry Pi

Power - 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 is defined by the product of voltage and current. For the dc/time-invariant case:

P = V × I

Measuring the RPi's power consumption requires the physical quantities of voltage and current be measured at the RPi's input terminals. Power consumption may be calculated in software, but its voltage and current must be measured with a transducer. The transducer's function is to convert a physical quantity to data that the software can read and use to make the calculations.

Off-the-shelf Power Measurement

In addition to general-purpose instruments such as voltmeters and ammeters, 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 outlets. At least one of these devices has a Bluetooth interface that may be used to fetch readings from the device for recording or analysis purposes. Otherwise, they mostly all display the data on a small screen in a similar fashion as the device below.

usb-power-meter

DIY measurement

This will require more effort.

Let's start with measuring voltage: The analog input of an "Analog-to-Digital Converter" (ADC) may be wired to the power input. 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. One way to build a prototype is with a USB breakout board. This one would work; it provides access to all of the wiring in a USB-C cable connection.

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 larger 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