Interpreting the values from PZEM-004

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
edstobi
Normal user
Posts: 39
Joined: 28 May 2020, 20:33

Interpreting the values from PZEM-004

#1 Post by edstobi » 14 Nov 2022, 20:30

Hello
I have successfully connected my modules to an ESPeasy 32 and see all values in ESPeasy, mqtt or node red.
However, I have problems to bring them together logically into my home automation system
Volt 232V,
Current 0,074A
W 9,20
Wh 0,705
cosphi 0,54
Hz 50

U x I x cosphi =W
232 x0.074 x0.54 = 9.2

Up to here I understand it.

Only the Wh give me a headache :(
The 9.2 W are constant over 24 hours.
I would like to represent this now graphically. According to my thinking this should be 0.22 kWh per day or per hour 9.2Wh but after 3 days not 0.705Wh.
I do not understand the Wh. Where does the time come from and how should I interpret it? how often is wh generated?
At constant consumption, the Wh increase linearly, that is correct, now it should still be a meaningful value.

Here I am also dependent on your knowledge, because I do not get ahead

Can it be that in the ESPeasy not Wh but kWh are displayed?
My measurement runs almost 77 hours that would be ~0.716 kWh and would fit to Wh 0.705 to some extent

TD-er
Core team member
Posts: 8753
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Interpreting the values from PZEM-004

#2 Post by TD-er » 14 Nov 2022, 22:45

What meter does generate these values?
This may help me to estimate whether these values all make sense.

Just to help you understand the values.

You know Volt * Amp = Watt.
For DC current this is very simple to grasp.
Power in Watt is "instantaneous" or in other words, it lacks "time".
Let's assume you're running a lamp using 10 Watt, for an hour.
Then you have used 10 Watt * 1h = 10 Wh.
Now let's assume your heater uses 1000 Watt (1 kWatt) for an hour, then you have used 1 kWh.

This kWh is an amount of energy you'll see on your electricity bill.
However, Wh is also an amount of energy, only it is 1/1000th of a kWh. (or 1000 Wh = 1 kWh)

Now the slightly more complicated AC we use as mains electricity.
If you're using a resistor as load (e.g. a heating element, or old fashioned Tungsten light), then the ratio between voltage and current remains constant. (I = U / R and R = U / I)
When drawing a chart from both current and voltage on the same time axis, both would show the same sine wave. Only the amplitude would differ.
So when voltage is 0, current is 0. When voltage = max, current = max.

However some devices do not behave like this.
For example when using a dimmer, or (cheap) LED lights, you would see the current would start at some point (not always when voltage just passed 0) and it may suddenly go to 0 at some point in the sine wave.
Other devices, like an electromotor, TL lights, etc. may still show a sine curve for the current, but it is slightly "shifted".
This means the current will not be at its peak when the voltage is at its peak.
Shifting a sine wave like that is like adding some value to the "angle". This we call a phase shift and is expressed in degrees. This angle we call "phi".
Since shifting the current like this does effectively lower the amount of energy, we need to compensate for it.
The amount of energy you actually use is exactly a factor cos(phi) lower.
This can be expressed by a value ranging from 0...1 (or 0% ... 100%).

The apparent power (Volt * Amp) is expressed in the unit VA.
The actual power is in Watt. (Volt * Amp * cos(phi))

Now some energy meters cannot determine this cos(phi) factor very well.
This may result in some error when measuring a load which doesn't have a pure "resistive" load, like a heating element.


Now back to your meter.
It states a cos phi of 0.54.
Let's assume this value is correct (which probably isn't), then the apparent power of 9 VA would mean it is actually using 0.54*9 = 4.86 Watt.
The reason why I think it isn't correct is that this appliance is probably "pulsating".
For example the Philips Senseo in standby is really terrible.
It will only draw current for a fraction of the sine period and only every N periods.

Such terrible loads make it next to impossible to measure a proper cos phi value.
This way the reported apparent power (VA) may be something like 9 Watt while the actual consumed energy (in Watt) is much less than what you would expect based on the VA and cos phi.

edstobi
Normal user
Posts: 39
Joined: 28 May 2020, 20:33

Re: Interpreting the values from PZEM-004

#3 Post by edstobi » 14 Nov 2022, 23:51

Hi
I am using PZEM-004Tv30-Multiple on ESP_Easy_mega_20221105_energy_ESP32_4M316k_ETH
For Energy_WH I get the reading eg. 9.2 Wh from Espeasy
In my opiniun that output of the espeasy is wrong and shoud be 9.2 kWh

TD-er
Core team member
Posts: 8753
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Interpreting the values from PZEM-004

#4 Post by TD-er » 15 Nov 2022, 09:26

edstobi wrote: 14 Nov 2022, 23:51 Hi
I am using PZEM-004Tv30-Multiple on ESP_Easy_mega_20221105_energy_ESP32_4M316k_ETH
For Energy_WH I get the reading eg. 9.2 Wh from Espeasy
In my opiniun that output of the espeasy is wrong and shoud be 9.2 kWh
For a load of 9 Watt to use 9 kWh, it must be running 1000 hours.
Still, running for 72 hours would not make it to 0.7 Wh.

To make sure where the error comes from, I suggest to add some purely resistive load for some time to see how that's being measured.
Also 9 Watt is nearly at the lowest possible end the device can measure, so a single count higher or lower on the ADC will probably jump quite a bit in reported values.
So it is best to run some higher load (purely resistive), like a 60Watt light bulb or 230V halogen lamp not using electronics.
After running this for some time (e.g. 10 - 60 minutes), you can add your other load parallel to it and see how much the reported energy consumption increases.
With a resistive load, which is also more significant in energy consumption compared to the other device, you make it easier for the meter to determine a more useful cos-phi.

Are you using a shunt resistor, or a Rogowski coil?
According to the datasheet the coil version (100A version) starts measuring at 20 mA.
With a load of 9 Watt, the average current should be about 39 mA.
Not sure how its behavior is upto the stated 20 mA. It could be that this is considered to be the noise floor and measurements below this are simply ignored, or it might be possible the entire current measurement has some "DC offset" and thus every measurement should be compensated by some offset.

The stated resolution of 1mA doesn't mention whether it applies for the 10A version or the 100A version.
But given the fact that a 0.001A resolution on a 10A range already needs a max. count of 10'000, I think we can safely conclude the 100A version doesn't have a 0.001A resolution.
In order to achieve a count of +/- 8192 (both positive and negative), you already need a 14 bit ADC.
I really doubt there will be a 16 bit ADC in this sensor and even 14 bit would already be more than I'd expected.
Let's assume it has a 14 bit ADC, then for the 100A version the actual resolution is roughly 10 mA, which may even be worse when there is some calibration being used.
This means at a load of 9 Watt, the current will be below the 20 mA threshold for 1/3rd of the time.
But if the connected device is drawing current like this:
Image
You can be sure the computed current and cos-phi will absolutely not make any sense in the low end of its measurement range.
By adding some pure resistive base load in parallel, like I suggested (using a 60 Watt Tungsten light), you'll lift the measurement more into its usable range.

You could also try measuring multiple of these devices in parallel, to get some idea of the true cos-phi. But this will only work if their current draw is showing exactly the same pattern for each device.

TD-er
Core team member
Posts: 8753
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Interpreting the values from PZEM-004

#5 Post by TD-er » 15 Nov 2022, 09:34

edstobi wrote: 14 Nov 2022, 20:30 [...]
Can it be that in the ESPeasy not Wh but kWh are displayed?
My measurement runs almost 77 hours that would be ~0.716 kWh and would fit to Wh 0.705 to some extent
I just re-read the starting post and now it starts making sense...
Given you run 9-ish Watt for 77 hours, you would indeed be somewhere around 700 Wh.

Sorry, I missed this part of your post yesterday evening...

I think section 1.6 of the datasheet is causing the confusion here.
< 10 kWh, the display unit is in Wh
>= 10 kWh, the display unit is in kWh.

What value does your active energy count show?

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 132 guests