Optical pulse counting with the EmonTH

In addition to temperature and humidity sensing the EmonTH has a digital input (with interrupt) that can be used for pulse counting.

This can be used for wired pulse counting or with the Optical LED pulse sensor.

To use the Optical LED Pulse sensor the easiest way is to remove the RJ45 connector and then strip back the black sheathing to reveal the red (3.3V power), black (GND) and blue (pulse) wires.

Connect the red wire to the 3.3V terminal, the black wire to the GND terminal and the blue wire to the terminal labelled D3 (top) or IRQ1/D3 Pulse Counting (bottom of the board).

There are two firmware examples available for the EmonTH for pulse counting, the first is for Pulse counting in addition to DHT22 Temperature + Humidity sensing or DS18B20 temperature sensing:

The second is for pulse counting only if the temperature and humidity sensing is not needed:

To upload these firmware examples you will need the Arduino IDE and libraries installed and a USB to serial programmer to upload the firmware to the EmonTH.

The pulse count is accumulated on the EmonTH until the EmonTH is reset either by an outage or by turning off and on the power.

To record the total accumulated pulse count in emoncms use the wh_accumulator input process which detects resets continuing the total pulse count accumulation from the last value before the reset. To engage in discussion regarding this post, please post on our Community Forum.