Pulse counting with the RFM69PI and RaspberryPi EmonBase basestation
By connecting a optical pulse sensor directly to the rfm69pi adapter board this can make a relatively low cost solution for internet connected pulse counting (or local logging to emoncms running on the raspberrypi).
Setup
1) The RJ45 connector on the optical pulse counter needs to be removed and individual wires exposed. Connect the red wire to 3.3V, the black wire to GND and the blue wire to D3:
2) To use the rfm69pi adapter with pulse counting the pulse counting firmware needs to be uploaded to the rfm69pi adapter board, the steps to upload this firmware are:
- SSH into your raspberrypi running the standard OpenEnergyMonitor image.
- Place raspberrypi in write mode:
$ rpi-rw - Stop emonhub:
$ sudo service emonhub stop - Pull in latest changes to RFM2Pi git directory:
$ cd RFM2Pi
$ git pull - Upload pulse counting firmware:
$ avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400 -U flash:w:/home/pi/RFM2Pi/firmware/dev/RFM69CW_RF12_Demo_ATmega328_Pulse/RFM69CW_RF12_Demo_ATmega328_Pulse.cpp.hex - Start emonhub:
$ sudo service emonhub start
[[15]]
nodename = rfmpi_pulse
firmware = RFM69CW_RF12_Demo_ATmega328_Pulse
hardware = rfm69pi
[[[rx]]]
names = power,count
datacodes = h,L
scales = 1,1
units = W,Wh
The pulse count is accumulated on the rfm69pi until the rfm69pi 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.