# Measuring Energy (Watt-hour) from Microcontroller

I have microcontroller device (ESP32) that doing some process and the begin to sleep. This cycle is for 12 hours (00:00-12:00). And after that, begin full sleep for 12 hours (12:00-00:00). So my timing diagram will be like this: and then i calculate average power drawn each day, like this:

P = V * I(average current each day) = 5V * 12.25mA = 61,25 mWatt

So, to calculate energy (watt-hour) consumed by my device is, i need to multiply it by 3600s, like this:

E = 0,06125 * 3600 = 220,5 watt-hour

Is this correct?

• At no point in your calculation you take the process time/sleep time into account, so no, it is probably incorrect, unless it is already taken into account within the 12.25mA figure. What is 12.25mA? The average current consumption, or the consumption during process time? What is the consumption during sleep time?
– dim
May 28, 2019 at 7:27
• 12.25mA is average current each day May 28, 2019 at 7:39

That 1 Watt-hour is 1 Watt (= 1 Joule per second) of energy consumption during 1 hour.

Your device consumes less than 1 Watt so it cannot consume more than 1 Watt hour in one hour.

Your device consumes 61.25 mWatt so that means in one hour it consumes 61.25 mWatt-Hour.

That's 61.25 mW * 3600 seconds = 220.5 Joule

You calculated the amount of Joule consumed, not the amount of WattHour.

One Watt Hour = 1 W * 3600 seconds = 3600 Joule, see the table in the Wikipedia page about KiloWatt Hour (you need to scroll down a bit).

Also you didn't take into account that during the Active time the device isn't consuming 12.25 mA during 100% of the time.

If it is consuming that current only for 10% of the time then the average current is only

10% * 12.25 mA = 1.225 mA.

So it makes a lot of difference what the Duty Cycle of the device is in the active time.

• 12.25mA is average current each day, i have already calculate average of process and sleep time. May 28, 2019 at 7:49