# Power Factor and Real power seems wrong

Hello there,Currently i have a project to measured Volt Amp Real power and Power factor by using ACS712 30A and zmpt101b with Arduino UNO R3 and i got Vrms and Irms correct but can’t seems to get Real power and Power factor right.Can you help me? My power factor from coding is 0.75 while from meter it showed 0.95. My calibration value for zmpt101b and ACS712 were 530 and 12 if i change it to other value Vrms and Irms result will go wrong so i don’t really know what to do.

Power Factor is the ratio of real power to apparent power.
Apparent power is the product of the rms average current and the rms average voltage.
Real power is the average of the product of the instantaneous values of current and voltage.

When calibrating, you must first get the values for voltage and current correct. That will give you the correct value for apparent power.

The real power is affected by the phase relationship between voltage and current, That can be affected by three things - a phase error when measuring the voltage, a phase error when measuring the current, and the time between measuring the voltage and the current.

In your case, you might have a very small phase error from your ACS712 and ZMPT101B, but I think the big error will be the time difference between measuring the voltage and current samples.

You do not say how you are computing those values, so all I can say is you should look at our library, which we use to convert the readings into useful values, and study and understand the mathematics of “phasecal”. There is a detailed explanation at Learn→Electricity Monitoring→Current & Voltage→Advanced: Explanation of the phase correction algorithm→Explanation of the phase correction algorithm. And then do something similar in your computations.

Thank you for your reply here is what i do with my code all i change is calibration for ACS712 from 0.3 to 12
emon_all.ino (1.1 KB)
can you help me identify the things i need to change? thank you

Why did you not write that you are using emonLib? There is a very simple way when you are using emonLib:

Look at emonlib.cpp, and at line 26:

``````void EnergyMonitor::voltage(unsigned int _inPinV, double _VCAL, double _PHASECAL)
``````

PHASECAL is the variable you must change. In your sketch, you use the value 1.7, here:
` emon1.voltage(1,530, 1.7);`
which is a good number when you are using the UK a.c. adapter and SCT-013-000 current transformer. That value will be very wrong for your sensors.

Follow the instructions in Learn→Electricity Monitoring→Current & Voltage→1. Calibration Procedure→Calibration Procedure to set it correctly.

Thanks and i want to know that do i have to use emonTx shield to be able to use emonlib or not nessessary

No, you do not need to use the emonTx Shield. But if you are using your Arduino Uno, or another microprocessor which also has an analogue to digital converter that only accepts positive voltages, you must have a circuit that is the equivalent of the analogue parts of the emonTx Shield.

Thank you so much.one more question if i use ACS712 and zmpt101b with Arduino UNO R3 i have to build circuit from Learn | OpenEnergyMonitor and change the calibration and PhaseShift value right?

I think that should be OK in general, but you must not use an operational amplifier with the ZMPT101B, because the output needs to be biased to 0.5 × VCC, and provided that you choose the correct value for resistor “R” (on the data sheet) to give approx 1.2 V at your normal mains voltage, you do not need the 10 kΩ & 100 kΩ resistors.
And because the output from the ACS712 is already biased to 0.5 × VCC, you do not need the capacitor and the 2 × 470 kΩ resistors there.

1 Like

So i can just connect both my sensors directly to arduino uno and use emonlib without have to connect anymore circuit right? If i use acs712 and ZMPT101B

No, I didn’t say that. Carefully read again what I wrote. You still need the bias components for the ZMPT101B - the capacitor and the 2 × 470 kΩ resistors.

1 Like

Oh sorry didn’t see that so i just connect acs712 directly to arduino and ZMPT101B connect with the circuit of 2 x 470 kOhm and the capacitor to arduino right?

I think you have it right, now.

I try it on L load ( ballast and fluorescence light ) but PF still wrong i got voltage and current right. I tried change phaseshift but still get the wrong result. Can you help me? I use acs712 and 9V AC - AC transformer.

How do you know that? What are you comparing against? Is that correct?
Do you read the correct power factor on a pure resistive load?
Does the phase error of your transducers vary with voltage and current, and if so, by how much?

SO sorry for the late reply . I compare the value with Portable power factor meter and now i got PF the same as the meter reading when measure with ballast and fluorescence light. But now i try measure it with transformer but PF seems wrong from the meter reading even though i use same code and value. Do you happend to know why?

No. My best guess is that either your Portable power factor meter, or one or both of your transducers, or everything you are using, has errors that are not constant and change with the current or the power factor of the load you are measuring.

The method that emonLib uses to calculate power factor is very sensitive to small errors in phase angle when the power factor is small, which it is with the sort of loads you are using.

Thank you for the help.Then if i use external inturrupt method to find phase difference instead will it work with the circuit suggesting from Learn | OpenEnergyMonitor

Here is the code i will try.
try_time.ino (1.5 KB)

Thank you again .

You can try that sketch. It will work only if both current and voltage waveforms are “well-behaved”, so that they are very close to pure sinusoids.

Having looked a little more closely at that sketch, but not having actually tested it, it would seem that it needs to take its inputs from some analogue processing that “squares off” the input waveforms. And even then, it would be susceptible to any distortion that moves the zero crossings.
Without that, I suspect it will also be sensitive to the amplitude of the signals.
[/Edit]

I’m told that this: Emontx3-continuous - New continuous monitoring firmware
does things differently to emonLib, so you could also try that. I have not yet managed to find time to look at it, so I can’t make any comment about it.

can you send me all code pleaseee?