AC Power Theory – Arduino maths
Instantaneous Voltage and current
As the name suggests, AC Voltage and current continually alternate. If we draw a picture of the voltage and current waveform over time, it will look something like the image below. Depending on the type of load consuming power, the current waveform – blue in the diagram below – is what you get if you look at a typical laptop computer power supply. (There’s an incandescent light bulb present, as well).
The image was made by sampling the mains voltage and current at high frequency, which is exactly what we do on the emontx or Arduino. We make between 50 and 100 measurements every 20 milliseconds. 100 if sampling only current. 50, if sampling voltage and current. We’re limited by the Arduino analog read command and calculation speed.
Calculating real power on an Arduino
Real power is the average of instantaneous power. The calculation is relatively straightforward.
First we calculate the instantaneous power by multiplying the instantaneous voltage measurement by the instantaneous current measurement. We sum the instantaneous power measurement over a given number of samples and divide by that number of samples:
As RMS voltage is generally a fixed value such as: 230V (+10% -6% in the UK). It’s possible to approximate apparent power without making a voltage measurement by setting the RMS voltage to 230V. This is a common practice used by commercially available energy monitors.
For More Details: AC Power Theory – Arduino maths