# Correct way to measure power consumption in AC

Just in case: Sorry for the bad English.

I'm trying to do a power consumption data logger. But I don't understand the calc behind this. I got more confused reseaching on internet.

Firts, there is three types of power: Apparent, reactive and real.

• Which of these do I have to consider?
• How do I measure each one?

I took this class many years ago, I don't remember anything. I know tha power is P = V * I, but the type of power keeps me insecure.

Also. If my sensor registers 500 watts every second:

• Do I need to sum to get total power in one hour and get watts per hour?
• Make sum and make average per hour?
• Convert watts per second to watts per hour and sum?

I will use an ESP32.

For the sensor of current and voltage, I'm still considering the model.

• First thing to learn is why watts per hour is nonsense, i.e. learn the difference between energy and power, There isn't watts per second or per hour, there's just watts. When you are clear on that, you can decide WHY you are measuring power : this will tell you which of real, apparent and reactive power matter to you. Aug 16, 2020 at 22:05
• You are making an energy meter. Power is given by P = V I and measured in watts (W). Energy is power multiplied by time, is calculated by E = V I t and measured in watt-seconds (Ws). Divide Ws by 3600 to convert to watt-hours (Wh) and divide again by 1000 to convert to kilowatt-hours (kWh). Aug 16, 2020 at 22:30
• Those different kinds of power are useful in AC power and distribution calculations, you probably can ignore those. For a device that can sample voltage and current many times a second, you can calculate the thing that "does work and makes heat" by averaging your volts*current measurements over a cycle of the sine wave or over a fairly long period of time. This is the average power being used by the device under test, which is most likely what you want to measure. Aug 16, 2020 at 22:41
• @DrMoishePippik If you use time-correlated V, I samples then compute their product to get instantaneous power P, you can ignore power factor: the reactive power will cancel itself out, and what is left is real power. Aug 17, 2020 at 3:45
• @DrMoishePippik regardless of the waveform, even for arbitrary repeating waveforms, the average power can always be computed by averaging the instantaneous power over an integral number of periods. AC is a special case which is often useful. But in the context of sampling meter, real power can readily be computed directly without resorting to phase angles. Aug 17, 2020 at 5:35

The three types of power relate as follows:

• Real power - power that does work.
• Reactive power - power that does no work, but nevertheless circulates back and forth to the source
• Apparent power - vector sum of reactive and real power

Your instantaneous current measurement will be giving you the sum of reactive and real (resistive) current. Multiply this by the voltage at the same instant and you get power at that instant.

The trick is, reactive loads have a +/- power polarity, while resistive loads are always positive or zero. When we sum these, whether we are computing averages or tallying energy, the reactive part cancels out, leaving real power as the result.

For example, we compute the average:

• avg. real power = [V0I0 + V1I1... + VnIn] / n

Over the sample set, on average all the reactive power will be equal to zero.

Here's a concise list of formulas for all these:

And a more scholarly treatment of the topic: http://engr.case.edu/merat_francis/eit/PE%20Review%20Chapter3.pdf

• I would like it if you would say "three types of AC power" instead of "three types of power." Aug 17, 2020 at 5:36
• All power is AC generally. DC is special a subset of AC. Aug 19, 2020 at 4:02
• Wrt @mkeith objection: it depends on what you mean with AC. Terminology varies. The most general terminology is "power drawn by circuits excited with time-varying signals" as opposed to "excited with DC signals". For some people AC strictly means that excitations are periodic sinusoidal signals (or at least the voltages are, while the currents are possibly distorted sinusoids). If you power a circuits with, say, a square wave, maybe PWM modulated, some people won't call that "AC". So you are both right, depending on how you call things (I've seen books taking both approaches). Apr 17 at 15:44