Arduino AC Energy Meter Considering Power Factor

Hi guys,
I ve made AC ammeter using ACS 712 current sensor, but now i m thinking to extend this to AC energy meter which also includes power factor.

  1. If i calculate the RMS voltage and multiply it with RMS current i will get the apparent power, but how do i keep the track of time in order to make it energy meter.

  2. If someone can write a code here

Since you're already working with electronic IC's, why re-invent the wheel? http://www.digikey.ca/product-search/en/integrated-circuits-ics/pmic-energy-metering/2556716?k=ac%20energy%20meter

EDIT: http://openenergymonitor.org/emon/

Power is straightforward to calculate, you integrate VI over time. So you just sample the voltage (via a small mains-rated step-down transformer) alongside the current sampling, and separately sum/average I^2, V^2 and IV - from this you can determine the rms current, rms voltage and the power (and hence determine power factor).

I already have made ammeter which measure RMS value (by taking the square of instantaneous value then dividing by the no. of times and finally taking the sq root), i can also find RMS voltage the same way.

But i have two questions: 1. if i multiply VI, it will give me the apparent power, bt i want to find real power= VI p.f

  1. I am nt simply making a watt meter, i am making an energy meter, that keeps the track of the previous energy consumption (just as the utility meter ), i would be calculating KWh, not simply instantaneous KW. So question is do i have to interface extra memory (SD card to save the data)

So question is do i have to interface extra memory (SD card to save the data)

Probably not. In an electricity meter, all the energy readings (KWh, VAh, VARh, etc) are totalized, then stored in memory. Time of use metering works more like a data logger and allows creating load profiles, however there still isn't much memory used because the recording interval is relatively long (usually 1 min, 5 min or 15 minute).

EDIT:

  1. if i multiply VI, it will give me the apparent power, bt i want to find real power= VI p.f

I wouldn't underestimate the importance of measuring the phase accurately and with high precision. One may think that measurement within ±1 deg would be good enough, however note that at 0.5 pf this will add another ±3% to error to your KW and KWh. This is the most sensitive area of measurement, and is why all electricity meters include calibration 0.5 pf test load.

I guess I'm missing something here. How do you measure the Power Factor WITHOUT measuring the phase angle between voltage and current ?

I guess I'm missing something here. How do you measure the Power Factor WITHOUT measuring the phase angle between voltage and current ?

You're not missing anything ... you can't.

The point I'm making is to measure the phase angle as accurately as possible. All energy meters are calibrated with at least one test load at 0.5 pf (where current lags voltage by 60 degrees).

There's a reason for this - this is where a small change in phase has the greatest influence on the power (and energy) calculations. The varying phase influence on power is sinusoidal, where Watts = V*A*cos(deg)

The following results show what happens if the phase measurement is out by 1 degree when tested at 0.0 pf (0 deg) and when tested at 0.5 pf (60 deg). EDIT: (see reply #9) The following results show what happens if the phase measurement is out by 1 degree when tested at 1.0 PF (0 deg) and when tested at 0.5 PF (60 deg).

[b]
Test at 1.0 PF...
Volts  Amps  Deg  Watts  %Registration  %Error due to Phase
  240    10    0   2400         100.00                 0.00
  240    10    1   2399.63       99.98                [color=red]-0.02[/color]

Test at 0.5 PF...
Volts  Amps  Deg  Watts  %Registration  %Error due to Phase
  240    10   60   1200         100.00                 0.00
  240    10   61   1163.54       96.96                [color=red]-3.04[/color]

Usman93: I already have made ammeter which measure RMS value (by taking the square of instantaneous value then dividing by the no. of times and finally taking the sq root), i can also find RMS voltage the same way.

But i have two questions: 1. if i multiply VI, it will give me the apparent power, bt i want to find real power= VI p.f

  1. I am nt simply making a watt meter, i am making an energy meter, that keeps the track of the previous energy consumption (just as the utility meter ), i would be calculating KWh, not simply instantaneous KW. So question is do i have to interface extra memory (SD card to save the data)

1) Read my previous post, you integrate V.I.dt to get real power/energy. Integrate it over the whole waveform. The angle you can calculate later from the ratio real power / rms V x rms I

2) If you are measuring either energy of power you must be definition be measuring the other, since one is the integral of the other.

Power measurement IC's for energy metering independently measures volts, amps, phase and includes zero-cross detection. To calculate phase, you could use:

1) deg = arcsin(VAR/VA) 2) deg = arctan(VAR/Watt) 3) deg = arccos(Watt/VA)

Energy = Power x Time If you are measuring power and reading time (derived from an IC/MCU), then you can calculate energy

The following results show what happens if the phase measurement is out by 1 degree when tested at 0.0 pf (0 deg) and when tested at 0.5 pf (60 deg).

Ok, now I'm confused. If the phase measurement is 0 degrees , (as in a RESISTIVE load) shouldn't the PF (CAPS not lowercase) be "1" and not "0" the following is from Wikopedia, Based on the following , your statement should read :

The following results show what happens if the phase measurement is out by 1 degree when tested at 1.0 PF (0 deg) and when tested at 0.5 PF (60 deg).

When power factor is equal to 0, the energy flow is entirely reactive, and stored energy in the load returns to the source on each cycle.

that being the case, if the phase was 90 degrees then the PF should be 0, shouldn't it? 60 degrees is 66.6 % REACTIVE so shouldn't it be a PF of about 0.3333 ?

If a purely resistive load is connected to a power supply, current and voltage will change polarity in step, the power factor will be unity (1),

http://en.wikipedia.org/wiki/Power_factor

I'm all confused.

Yeah, it was kind of late over here (I really thought I had it at 1). Anyways, sorry about that - it's edited and referenced to your reply.

Well, your correct on all counts except that phase at 60 deg represents 0.5 PF (not 0.3333). EDIT: As an example, if current lags the voltage by 60 degrees (0.5 PF) and we measure 300W, then VA=600 and VAR=519.

The power factor is the ratio of the true power to the product of the rms voltage and rms current. It is not linearly related to the phase difference, it is the cosine of the phase difference.

Note that the phase shift relation only applies to sinusoidal signals, whereas the power ratio is well defined for any waveform.

The power factor is the ratio of the true power

It seems we need to know the REACTANCE (XL and/or XC) to know REACTIVE power.

Do we know that ? (Can we calculate REACTANCE from Phase angle ? (leading or lagging )

OK so thats what i concluded

REAL POWER = average power means you have to take instantaneous values and then divide it by number of times to get the average value = REAL power while Apparent power = Irms x Vrms

Now this real, apparent issue is solved to me but i have few questions nd confusions:

  1. i used ACS 712 to measure Current RMS, but now i want to do that with CT .
  2. and for voltage i guess i would need step down transformer nd bridge rectifier

can someone plz post exact circuit diagram for this + some idea for coding

Since i need to find large no of instantaneous values per cycle (like 200 samples per cycle) for both current and voltage, how do i do it?

for voltage if i use step down transformer nd then through rectifier make it DC, then from this DC i can only only calculate RMS value of voltage by some calculations but i need instantaneous values of voltage?

and for the current if i use the CT, i also need instantaneous values of currents.

Plz provide me the circuit diagram, nd sketch

Thanks

Download AVR465, it explains all your questions.

Since i need to find large no of instantaneous values per cycle (like 200 samples per cycle) for both current and voltage, how do i do it?

200 samples per cycle (at 50Hz) with 2 inputs would require the microcontroller to handle 20,000 sps ADC with many calculations required for each sample. It would also have to handle measuring zero crossings, frequency, phase and all instantaneous calculations and more. Its all too easy to overwhelm the microcontroller if not careful and advanced techniques are used.

One technique is to reduce the samples per cycle, then vary the sample timing in such a way that meaningful information is accumulated after multiple periods of the waveform, rather than trying to measure determine everything within 1 cycle.

Its amazing what the energy metering ICs do and their relative low cost. Anyways, their datasheets provide a wealth of information.

I have been thinking of doing a project that would measure three phase parameters such as voltage, current, kilowatt, power factor, unbalance, power disturbances, kilovar, phase angle, etc. I initially though this could be possible using the arduino and shields. But I found out that it would be better to use metering ICs as they are relatively low cost, powerful, and has everything i need. It now just becomes a question of interfacing these ICs to the arduino.

Has anyone tried or tested this?

What sort of loads are you to be measuring? The traditional definition of power factor where the voltage is phase shifted from the current only works for loads that comprise R , L and C . It doesnt work for loads which have switch mode power supplies where the current waveform is not sinusoidal. To measure power factors with loads like this , you need to sample the current waveform extremely fast so you pick up the current spikes which can last very short times , especially in things like CFL lamps or low power plug packs.

You can calculate the power factor for any waveform, although its of questionable value for highly distorted ones:

power factor = rms(VI) / rms(V).rms(I)

(integrated over the whole waveform, ie V is V(t), I is I(t))