olehs / PZEM004T

Arduino communication library for Peacefair PZEM-004T Energy monitor
MIT License
225 stars 114 forks source link

Energy reading reset #5

Closed mohsh86 closed 7 years ago

mohsh86 commented 8 years ago

I know there isn't any software reset through serial, but i was wondering how i can handle Energy metering if the meter overflows after "99999" (if that was the max number).

the library returns energy in Wh not kWh, my question, what is the max reading it is going to hit before resetting back to 0, so i can do the math ((99999 - previous reading) + new reading) on every beginning on a month in case the new reading was less than the previous reading

olehs commented 8 years ago

Sorry, I don't know what is the max reading of this device. But if it was 99999, the correct math would be (100000 - previous_reading + current_reading)

mohsh86 commented 8 years ago

thanks for the tip, there is something i don't understand, i just contacted the seller and he said the max reading is 9999kWh , i was wondering how is it i am getting Wh not KWh from your library ? it goes back on how many digits your poll is returning ?

olehs commented 8 years ago

I had to delete my previous comment because it was completly wrong. According to communication protocol (see readme) the maximum Energy value is aprox 16777kWh (3 bytes). So the value 9999kWh seems to be correct.

mohsh86 commented 8 years ago

will keep the meter running and let you know when it turns over, i've been running it for a couple of days now it is 35097.00 Wh, (the decimal point is added by openhab), it is being historized i should be able to plot and see the max it reaches

mohsh86 commented 8 years ago

I had the reading going past 5 digits, it is now reading 156712 Wh

if 9999 kWh is the max reading according to AliExpress, i think it will go 9999999 Wh before it turns over ?!

mohsh86 commented 8 years ago

for who ever is still interested, the number just flipped to the 7th digit, its now > 1000000 and counting

WongKamFu commented 7 years ago

@mohsh86 Are you still using it? How's the reading? Have you reached the max energy reading value?

mohsh86 commented 7 years ago

I've got a snapshot of today's reading here

its 3426456 Wh

WongKamFu commented 7 years ago

Long way to go I guess :) Thanks anyway.

crosofg commented 7 years ago

Can the energy reading be reset to zero programmatically?

mohsh86 commented 7 years ago

i asked the vendor on aliexpress: nope

crosofg commented 7 years ago

Any comments on accuracy/reliability of this meter to use in production environment?

mohsh86 commented 7 years ago

if you're planning production environment, better use SDM series from eastron, this one is even hassle to install and has no casing, and no plan for casing

kamiliasana commented 6 years ago

there is a way for resetting the device, you can put a relay contact in parallel over the switch on the board . Just program a closed contact for 5 seconds , then release and then again for 1 second and the counter is 0