I hope my question is in accordance with the rules of the site.

I'm doing a power meter using a voltage transformer, a current transformer and an arduino, besides the components to create the interface for the transformers for the arduino. For this, I am relying on an open-source project called OpenEnergyMonitor.

I do regular sampling of voltage and current, and then I can calculate the RMS voltage and RMS current to thereafter calculate the apparent power as the product of these two quantities.

But I am confused in calculating the real power. My references indicate that this calculation is quite simple: is the average product of voltage and current samples. But in the firmware available on the project, the voltage is considered "altered".

This voltage is calculated as follows:

shiftedV = lastFilteredV + PHASECAL * (filteredV - lastFilteredV);


  • ShiftedV is the voltage used to calculate the real power.
  • lastFilteredV is the instantaneous voltage of the sample immediately preceding it.
  • filteredV is the instantaneous voltage of the current sample.
  • PHASECAL is a coefficient calibrated by brute force. I could not find any explanation of its meaning.

After searching the entire site in search of explanations, I have been able to collect the following information:

shiftedV removed the phase offset associate with the different hardware components.

Phase calibration goes here.

I just can not understand the motivation to do something like that. Could anyone help me?


Let's see two graphs representing two circuits, the first is completely resistive and the second is reactive. (source of the images)

resistive circuit reactive circuit

In the first graph, because it is a resistive load, all the power is used, giving us a PF of 1. Why PF is equals to 1? Because the real power (the average of the product of instantaneous voltage and current) is maximum (and thus equal to apparent power) because the signals are always the same (positive and positive or negative and negative). That way, no energy is removed (negative).

In the second graph, because it is a reactive load, all the power is absorbed and then returned to the circuit, giving us an PF of 0. Because the real power (the average of the products of instantaneous voltage and current) is just zero because the signals are shifted and what is lost now is won just ahead.

You see my point? My "theory" is you do not need do anything too fancy (for example, use shiftedV) to calculate the real power, just pick up a large number of pairs of samples and average their product.

What I want is just a confirmation of what I'm thinking is correct, or because the method used in the project is correct.

After all, what I want to know is: Is there some reason the project that I have used that different voltage (whose understanding completely escapes me) to calculate the real power? And most importantly, should I do the same? Or should I just multiply the instantaneous samples and calculate the average?

Sorry about any english mistake, it is not my primary language.

  • \$\begingroup\$ Do you have a real time measurement of the current as well? \$\endgroup\$
    – Matt
    Commented Jan 18, 2012 at 14:03
  • \$\begingroup\$ @Matt, I'm using a current transformer to reduce the current to safe levels and a high wattage, very low resistance resistor to sample the voltage. Since I know the resistance and voltage, I can calculate the original current. \$\endgroup\$
    – borges
    Commented Jan 18, 2012 at 14:11
  • \$\begingroup\$ I feel that in that case, real and apparent power are the same anyway. But see my edit below. \$\endgroup\$
    – Matt
    Commented Jan 18, 2012 at 14:23

1 Answer 1


Real power is based on the difference in phase between the voltage and the current waveforms. You mainly see it in calculation of power factor. From wikipedia:

The ratio between real power and apparent power in a circuit is called the power factor. It's a practical measure of the efficiency of a power distribution system. For two systems transmitting the same amount of real power, the system with the lower power factor will have higher circulating currents due to energy that returns to the source from energy storage in the load. These higher currents produce higher losses and reduce overall transmission efficiency. A lower power factor circuit will have a higher apparent power and higher losses for the same amount of real power. The power factor is one when the voltage and current are in phase. It is zero when the current leads or lags the voltage by 90 degrees. Power factors are usually stated as "leading" or "lagging" to show the sign of the phase angle of current with respect to voltage.

In your application I believe they are using shiftedV as a way to see how much the phase has changed since the last value. With a purely resistive load, the power factor would be 1...so the real power=apparent power. So you are probably suppose to use a resistive load to determine your phasecal number(set it so real=apparent). Then you can find the power factor for various loads.

Edit: If you take the time average of the instantaneous product of voltage and current, you will surely have a real power measurement. As I (poorly) implied above, I believe the shiftedV is used to adjust for any reactance elements introduced by the measurement process. As a way to null out the effects of the electronics, so you get the real power of the load. Here good reading and pictures National Instruments

  • \$\begingroup\$ I appreciate your answer! But I am afraid that is not exactly what I'm looking for. I understand what is power factor and true power is directly related to the phase shift found between the curves of voltage and current. I'll edit my question to add some information. Please read it again. \$\endgroup\$
    – borges
    Commented Jan 18, 2012 at 13:45
  • \$\begingroup\$ After reflecting and researching, I think I understand what you're saying (unfortunately I am not an electronics engineer and I'm out of my area of knowledge). Probably the transformers and other components, in addition to the ADC itself, constitute a system that inserts some distortion. The attenuation in this case is not critical, but the possible phase shift is. And that shiftedV is correcting just that. I'm thinking correctly? The result: I still have to study hard! Anyway, thanks for the help. Certainly worth an up-vote. \$\endgroup\$
    – borges
    Commented Jan 19, 2012 at 20:49
  • \$\begingroup\$ I believe you are thinking correctly \$\endgroup\$
    – Matt
    Commented Jan 19, 2012 at 21:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.