Optical Pulse Counting on Import Meter

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.

1 Like

I’ve got a generation meter where the pulse counting works fine. However, one of my import meters (for our ASHP) similar to this has 2 little pulse windows. As it’s only used for import I hoped that I could sense just one of the pulse windows. This device works well with the generation meter. I was hoping to use another of those. Is this feasible and which of the pulse windows do I need to use?

Can you see a pulse coming from the meter? If you cannot see a pulse it’s unlikely that the optical pulse detector will - the clue is in the name “optical”. If you cannot see a pulse, try with a webcam or mobile phone camera. Some are sensitive to IR (check with a TV remote control) and it’s possible our pulse detector is insensitive to IR. I have no idea what the sensitivity range is in terms of wavelength.

As to which window - I suspect one is for programming or meter reading and the data is most likely encrypted.

Thx Robert.
I do see a pulse on the right hand window. However, I don’t see 10 pulses per change of meter display (2 decimal places) like with the generation meter. I guess the difference may be between IR and visible. There may also be some encoding on one but not the other so a pulse does not mean .001 KWh. Wish we had specs.

Normally, the front of the meter has a definition of what a pulse means. In your case, it might be in a menu somewhere.

Sorry Robert. I forgot to mention that the meter says 1000 imp/ KWh. Hence my looking for 10 pulses to change the display’s LS digit. I now have pulses coming through on both meters after adjusting the wiring. I was using the wrong type of RJ45 jack on one of them. So the above sensor works OK.

That makes no sense at all. You have never mentioned where the pulses are going. Are you trying to say you have an emonPi and you plugged it in using the Ethernet RJ45 rather than the one labelled “RJ45 I/O”?

Sorry. The sensors I am using had RJ-45 plugs. I used a jack to connect to my system (via ESP8266 with interrupt). This requires TTL type-levels and the jack on the one of them was evidently not a straight-though connection ( probably has a built-in isolation transformer). I have now wired the sensors direct.