# Measure power consumption of a MCU based project

#### artez

Joined Apr 26, 2023
1
Hello! I'm new to electronics and I'm building a device based on the PIC16 with XLP. I plan to power it from a battery.

Essentially, the MCU will not run all the time, but mostly be in sleep mode, waking up a few times per minute. I understand how to theoretically calculate power consumption and determine how long the device could run on a battery.

However, what is the way to measure actual power consumption for a low voltage (3V) device over, let's say, an hour? I found this device on Amazon: https://www.amazon.com/gp/product/B07X3HST7V/ref=ox_sc_act_title_2?smid=A3G9TPEINXPSG9&th=1 . Would this be something that works? What would you recommend? How do you determine how long your device would work from a battery?

#### Papabravo

Joined Feb 24, 2006
20,385
IMHO, you can infer the power consumption by knowing the capacity of the battery in milliamp-hours and the battery voltage as a function of time. For a low power system, you could take one voltage measurement every 24 hours, and use the discharge characteristics of the battery to compute the power consumption. This could be confirmed over a number of days until the battery reaches its discharged voltage target. I do not see any point in knowing the instantaneous power consumption over short intervals of time.

For example: Suppose the battery begins at 3.7 volts and discharges to 2.8 volts in 36 days. Further suppose the battery capacity is 2800 milliamp hours. Now 36 days is 864 hours, so 2800 mA-hrs = 3.24 mA/hr. So an estimate would be:

$$\cfrac{(3.7+2.8)\text{ volts}}{2}\times3.24\text{ mA}\;\approx\;10.53\text{ mW}$$

It might be interesting to compare this estimate to an actual measurement to see which method best suits your purposes.

#### nsaspook

Joined Aug 27, 2009
11,768
For a reasonable power consumption total with known operation conditions and regular wake modes.

You can do static current with voltage reading in each possible power mode, place the values in a table and let the device make the simple power calculations with an active run internal timer when it's not sleeping from a start time reset for the timed period. For the external timed test period you only need the timer to track device active time.

A decent low burden amp meter with at least 1mA resolution is a must.

No sleep mode here, only display back-light blanking on/off.

#### activerfid

Joined May 30, 2020
9
Hello! I'm new to electronics and I'm building a device based on the PIC16 with XLP. I plan to power it from a battery.

Essentially, the MCU will not run all the time, but mostly be in sleep mode, waking up a few times per minute. I understand how to theoretically calculate power consumption and determine how long the device could run on a battery.

However, what is the way to measure actual power consumption for a low voltage (3V) device over, let's say, an hour? I found this device on Amazon: https://www.amazon.com/gp/product/B07X3HST7V/ref=ox_sc_act_title_2?smid=A3G9TPEINXPSG9&th=1 . Would this be something that works? What would you recommend? How do you determine how long your device would work from a battery?
If you want to actually plot, measure and determine averages you will need something like a profiler. These are not low cost and would depend on the size / scope of your project. As an example, see the youtube video from Andreas Spiess (#386 how to measure low currents) which is for ESP32, but the principles and profilers used are the same.

#### Jerry-Hat-Trick

Joined Aug 31, 2022
362
How about trying it with a 3.3V linear regulator powered by a 9V battery into a resistor coming before the regulator. The current flowing through the resistor will have a voltage drop allowing you to measure that voltage with a multimeter, giving current by I = V/R. Two readings, one when the MCU is asleep, one when it's awake. With potential dividers (to sniff the voltage before and after the resistor) you could even get the processor to measure it's own current - not when it's asleep obviously! Increasing the resistor to a value where the regulator still has sufficient headroom will improve accuracy.

#### vanderghast

Joined Jun 14, 2018
67
You didn't mention the MCU, but if is it an MSP430, there is the EnergyTrace technology which can "profile" the energy used and even the instant power, which is useful to see how and when the sleeping mode help. There is a video, on YouTube, by TI, at EnergyTrace for MSP430