Directly connecting to Optical Pulse Counter with RPi?

You can indeed use the optical pulse counter directly with a Pi.

I use a python script with 2 pulse counters, their data pins are connected to gpio pins 13 and 15, and are powered by pins 9 and 17 so that a simple 1x5 header socket could be plugged directly on the gpio pins (9-17 odds).

Rather than chop the rj45’s off the pulse counters I use a surface mount double rj45 socket with just 4 wires between the sockets and the Pi gpio.

The pulse counters are just a logic level switch, it just translates the light pulses to a distinct on or off signal. there is no baud as such although there is probably a maximum switching speed, but there is very little in the way of info on the shop sold device, We don’t even know what components are used. (hint hint @glyn.hudson can you share some tech info/schematic?)

[Edit: That information is now available here: First try with EmonPi - Pulsecount stuck at 1 - #16 by Robert.Wall - RW]

The python code I use sends an accumulating count for each pulse counter to emonhub via a web socket. It may not suit your needs exactly but should get you started at least, there are notes but do ask if anything is unclear.

pulses.py.txt (3.5 KB)

And here’s a couple of pic’s of 2 pulse counters in situ, you can see the double rj45 socket in the top left corner of the enclosure.

3 Likes