# EmonLib - V and I are good but Pf is wrong

Hello guys,

I am working with an ESP32 arduino (Heltec) using CT013 000 sensor and a AC/AC 9V transformer.

Everything works perfectly in my EmonLib implementation, my calcVI gives me a perfect voltage and a perfect intensity.

However, the powerfactor is wrong and thus the reactive power too.

Actually, I have tested using a wattmeter and my home power factor is around 0.9. However, the PF calculated in emonlib is around 0.7. Have a look at my power factors graph calculated using emonlib :

What could be wrong ? I am really annoyed because i have a solar production and solar injection and i want to use this power factor to know if I am consuming (PF > 0) or producing (PF < 0)…

Can someone help me ? Thanks a lot.

Did you follow the calibration procedure in the ‘Learn’ section?

Over what range did you try to adjust the phase error correction (PHASECAL)?

Real power is a much more reliable indicator, because as real and apparent powers tend towards zero, power factor becomes increasingly error-prone, because 0 ÷ 0 has no meaning.

Yes I follow the calibration procedure.

My PHASECAL is currently at 1.7.

Since I am on this issue for weeks, I’ve tried almost everything before sending a post here. Including trying to set PHASECAL to various values (between 0 and 2 with 0.01 increment).

And yes, I’ll use the real power insteaf of PF. you are right.

EmonLib was designed for speeds at which the Atmel '328P works, and your ESP32 will be very different.

I don’t have an ESP32 Arduino, so I need more information about yours. In particular, I need to know the time between the voltage and current readings and the speed at which it reads and processes pairs of values - because the value for phasecal depends on both of those.

Can you time say 1000 loops of:

``````{
`calcVI( )` running for say 100 half-cycles and 1100 half-cycles (this is so that I calculate the time to read the samples and do the immediate maths, but not the final calculations, i.e. the while loop at line 97).