Rain Guage Project
When I got tired of replacing rain guage tubes (forgot to bring in before freeze) I replaced it with a wireless guage. [Acurite 899] Now, being wireless, could I capture the readings and show the rain on my dashboard. The simple answer is yes but getting there required several pieces and thankfully, several bits of existing software.
The raw data is captured with an RF USB Dongle. (NooElec NESDR Mini 2 SDR) is one that I use. Google for SDR dongle - many available… The software is RTL_433 from github - again - Google rtl_433 for lots of information.
Having captured the data from the rain guage sender it goes through the mqtt server to node-red for processing. I parse the data from rtl_433 and send it on with mosquitto-pub.
getwx.sh
#!/bin/bash
get temperature and send to red server
rtl_433 -G -F json -U | mosquitto_pub -h 192.168.2.4 -t bigd/rtl433 -l
You may note that the -G argument say decode everything. That’s because the same packet is used for temperature and such as well. (other project) As an aside, when I opened the collection to allI discovered that my 24 hr and weekly temperature displays were looking blurred. Discovered that I was reading 3 temperatues. The outside one that I wanted, the inside one that I had forgotten about, and then one probably from a neighbor.
The collected data is place in a mysql db table - [id, timestamp, count] so I can browse for rain counts for any period. I quickly note the the frequent count transmissions were filling up the db in a hurry so I changed the flow to pick it up every minute or so and then add it to the db rather that add it directly.
I display today’s rain in a text node by pulling min and max counts from the db once a minute. Hope you find this interesting and/or useful.
Flow:
[{"id":"730da0e8.5adc4","type":"function","z":"d447052e.ca0748","name":"get rain","func":"// get weather pieces\nvar xxx = JSON.parse(msg.payload);\nrain = xxx.raincounter_raw;\nflow.set(\"count\" , rain);\n","outputs":1,"noerr":0,"x":278.00002098083496,"y":2615.0004482269287,"wires":[[]]},{"id":"d8102a79.524f38","type":"mysql","z":"d447052e.ca0748","mydb":"b6159249.c33b5","name":"save rain","x":807.9999980926514,"y":2612.000177383423,"wires":[[]]},{"id":"68456bbc.3b5a14","type":"function","z":"d447052e.ca0748","name":"get rain","func":"// get weather pieces\nrain = flow.get('count');;\nmsg.payload = rain;\nmsg.topic = 'insert into rain (counts) value (' + rain + ')'\nif (rain > 0) { return msg; }\n","outputs":1,"noerr":0,"x":630.0173320770264,"y":2612.3439044952393,"wires":[["d8102a79.524f38"]]},{"id":"9be5f764.212e38","type":"inject","z":"d447052e.ca0748","name":"","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"x":464.1840343475342,"y":2616.295358657837,"wires":[["68456bbc.3b5a14"]]},{"id":"dcccc4cf.cada18","type":"mqtt in","z":"d447052e.ca0748","name":"wx from bigd","topic":"bigd/rtl433","qos":"0","broker":"f6fb3ac4.9a0c18","x":75,"y":2621.34375,"wires":[["730da0e8.5adc4"]]},{"id":"b6159249.c33b5","type":"MySQLdatabase","z":"","host":"192.168.2.3","port":"3306","db":"wx","tz":""},{"id":"f6fb3ac4.9a0c18","type":"mqtt-broker","z":"","broker":"192.168.2.4","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]