I have a electricity measuring device that outputs 1000pulses per kWh. I have set up a esp8266 that would count pulses. It is connected to D12. I have it running for a few months but the manual measurement is different from pulse count.
Month: ESPcounter measurement / Data from electricity meter diplay
July: 140.93 kWh / 173.44 kWh
August: 125.69 kWh / 157.94kWh
September: 127.27 kWh / 153.28 kWh
So it seems the ESP somehow counts less pulses but why? How could I correct it?
Assuming that your measuring device outputs 1000 pulses per kWh your code should be correct.
However, looking at your results it looks like there is a reduction of approx. 20 %, and this difference is reasonable constant over these three months:
So how sure are you about the 1000 pulses / kWh?
What kind of power sensor is this? Is it a S0 pulse meter?
One solution could be to modify your filters such that the measured value comes closer to the real value, by multiplying the filter values by 1.23 like this:
The image you posted clearly shows this meter to be a S0 meter, indeed giving 1000 pulses/kWh:
So next step could be to test one of the suggestions I gave, and personally I would start with setting the internal_filter to 50ms as this is recommended for S0 meters (the default value is 13 us which are microseconds).
But I did notice that my nodemcu was acting weird. I couldn’t install new fw with wifi. Using USB worked.
Then I let it run and it died again after about 10 minutes. So I think that nodemcu is near death.
I then used a wemos d1 mini and soldered it to the place. Used pin4 and other schematic stayed the same.
I’ll test it for few days and see how is the result.
Update.
Alpha count device after about 13 hours: 2,69kWh
Home assistant count after 13 hours: 2,72kWh
1% difference, pretty good.
I also had problems with wifi coverage in the room. I have fireproof door between the counter and access point. I closed the door and tried to update wemos mini through wifi. It failed. I tried couple times more and it failed. Then I opened the door and it updated successfully. With closed door the wifi was about 86dbm. With the door open was 66dbm.
I also had a access point in the same room as the counter so I enabled wifi on that access point.