I’m interfacing to emoncms using an ESP8266 interrupt based system that has 2 optical pulse counters, one for import and one for generation. Both meters are Landis & Gyr 5235 and the optical pulse counters are based on the cheap ‘IR Sensor Arduino’ modules on ebay.
After suppressing EMI etc, the generation counter works fine, accurately matching meter reading over several months now. The import meter seems to over-read however, and having monitored the system I think that happens only during the day, and not during the night.
The 5235 meter optical pulse output goes high to indicate reverse running of the meter. I’m wondering whether repeated reverse-forward-reverse-forward cycles of this meter are generating “pulses” that are not in fact indicating that 1Wh of electricity has been used (my counter interrupt should be on the trailing edge of the pulse, so I should be counting when the light goes out only), but its also possible that I’ve made a mistake somewhere.
Anyone else notice a similar issue, and have a solution?
One to rule out: ambient light?
If you really are counting when the LED comes on “continuously” (defining continuous as greater than 100 ms or whatever a normal import pulse is) then you should only count a pulse that is less than (say) 110 ms. Even this is not fool-proof – if you export for less than 100 ms, it’s still seen as a valid pulse.
Thanks for that, I did rule out ambient light, worth mentioning though.
I could easily make sure pulses that are too long are not counted - having read (on this forum) about an ‘energy bucket’, I had assumed (even though not in the meter manual), that the light comes on full time when its in reverse, then goes out only when 1Wh of import has been used. On that basis, not counting long pulses would be expected to under-read against the meter. That’s how my generation meter (5235E) seemed to work on the bench, so I sort of assumed that the import meter (5235B) would do the same thing. Its worth noting that the generation meter also goes into ‘reverse’ about 30mins or so after the sun sets, but that would only be 1 time per day so 3 months is probably not long enough to notice any issue.
If the “standard” pulse counter counts only 100mS pulses and below and ignores long pulses and this works well for all meters tested, then I should certainly change what I do, at least for my import meter. As it happens, its not too difficult to manage with ESP8266 as you can trigger interrupt on rising and falling edge.
I think that’s probably true, but a lot of our knowledge of meters is based on observed behaviour, not on manufacturers’ data. What’s true for one manufacturer (or even model from the same maker) won’t necessarily be true for another. If you establish for sure that it’s true, then counting the LED going off will solve the problem.
Having now got a reliable pulse counting solution (4 months with no missed 1Wh pulses and no noticeable extra ones), I thought I’d mention the following things I found helpful when implementing pulse counting:
- I replaced the IR led in the ebay ‘IR sensor 5 for £0.99’ with a photo-diode with better response in the visible spectrum, it gives a better signal to start with and is much easier to set up using the potentiometer level adjust on the sensor modules
- The modules are inverting, i.e. logic level low when the light is on and vice versa
- I used shielded cable to connect to the ESP8266 inputs, and ferrite on the power supply lead
- I used a Schmidt trigger on the output of the comparator in the sensor (on reflection this isn’t necessary and I wouldn’t recommend it)
- I then measured the pulse width (using the ESP8266) to make sure it was consistent and easily measured – 20mS in my case
- I get no ‘spurious’ pulses which had previously occurred on rare occasions e.g during thunderstorms
The issue I had with the apparent over-reading of import was only partly down to unsuppressed EMI issues, and mostly to a design error as I hadn’t realised that emoncms rounds kWh figures to 6 significant figures – OK for the generation meter which is currently XXX.XXX, but not for the generation meter which is XXXXX.XXX when counting Wh pulses.
I like the simplicity accuracy and ultra-low cost of pulse counting, but with only 2 meters I could not determine household usage when generation exceeds use. The ESP8266 has only one analogue input, so I’ve added a current transformer on the mains input to estimate household usage in these circumstances.