# How to measure True Power (Not Apparent Power) consumption in Alternating Current using ESP8266-12F Microcontroller?

Currently, I am using the ACS712 current sensor module for measuring the peak current then computing RMS Current and thus the Apparent Power (Vrms × Irms = Apparent Power).

Currently, I am not using any method for measuring the Vrms, I am measuring Vrms directly using the Digital Multimeter and putting it in the calculation.

Now, the factor missing is the Power Factor for the calculation of True Power (Vrms × Irms × Power Factor = True Power) which is producing an error of about 20%.

I am facing problem in the measuring the Power factor of the appliance using ESP Microcontroller.

Following is the circuit diagram I am implementing, Please have a look at it and let me know if I am making any mistake which is also responsible for the error.

I am facing problem in the measuring the Power factor of the appliance using ESP Microcontroller.

Trying to measure the power factor seems easy but in reality it's a tortuous path and I'll cut to the chase - don't bother because you'll be dissapointed. The only way you can reliably measure power factor is calculate apparent power, calculate real power and take the ratio.

For relatively pure sine waves you could use zero crossing detectors and calculate phase angle and take the cosine but this is not practical in a real-world situation. Harmonic distortion of the current waveform is such that there is no reliable method. Consider the current taken by a household appliance that uses a bridge rectifier and smoothing capacitor: -

As you can see the current is not sinusoidal but pulsing in nature and trying to establish phase angles from the above is a waste of time.

My answer here goes into greater detail about why zero-crossing is so problematic.

To measure true power you mutiply the voltage waveform and the current waveform and take the average: -

Vrms × Irms = Apparent Power

Your equation here is actually the equation for the magnitude of your real power (P) or true power as you call it, not apparent power (S).

However, if your reactive power is equal to zero VARs, your equation would produce the correct value. This is because when a load is purely resistive (only real power) the apparent power and real power are equal.

Keep in mind that apparent power is the magnitude of some number of Volt-Amperes. Complex power (S) is the same value with the phase angle. This is a subtle nuance and most people interchange the apparent power and complex power while calling both the apparent power. I will try to distinguish to make it easier for you to understand.

Apparent Power² = Real Power² + Reactive Power²

(Apparent Power = Sq. Root of Real Power² + Reactive Power²)

Complex Power = Real Power + Reactive Power

(S∠θ = P∠θ + jQ∠θ)

Power Factor for the calculation of True Power

The power factor can be calculated by the taking the cosine of the phase angle difference between your voltage and your current.

Power Factor = cos(voltageθ - currentθ)

There are other ways of calculating the power factor by using the complex power, apparent power, real power and reactive power.

It would seem the easiest to me to calculate your real power, then determine your impedance to get your reactive power, then calculate your power factor=cos(arctan(Q/P). But if you can't can't determine your impedance, then that means you can't calculate your phase quantities for complex or reactive power. The power factor is about calculating an angle so if you don't have the complex phase quantity which includes an angle, then you can't use that route. It is really important to try to work in the phasor domain as opposed to the time domain when working with power.

True Power (Vrms × Irms × Power Factor = True Power)

Your equation here actually shows you are calculating:

True Power = True Power * Power Factor

By rearranging the terms you are saying your Power Factor is equal to 1. This may be true but I do not think this is what you are trying to calculate.

• Appreciate your answer, My main purpose is to accomplish Energy Monitoring in one of my projects. I use Home appliances in the project that are operated on Alternating Current. Can you suggest an efficient and accurate way to achieve that? Jul 19, 2018 at 7:27
• Since I'm assuming you are measuring single phase power then the most accurate way I suggest would be to purchase a digital wattmeter with power factor and/or reactive power measurement. There are other ways to do this, such as using a dual trace oscilloscope, or other circuit designs with a multimeter. Jul 19, 2018 at 19:12