On thing that is missing from my weather station is automatic reporting of rain fall. I have a manually read CoCoRaHS rain gauge which is more accurate than say a tipping bucket gauge but I thought it would be nice to have a automatic gauge to compare with the CoCoRaHS readings and also to see the timing of the rain fall. The idea was to mount the tipping bucket sensor next to the CoCoRaHS gauge in the same Alter wind screen. It turns out there is not enough room in the wind screen for both gauges. So the tipping bucket gauge is on its own post near the CoCoRaHS gauge. The rain gauge is not located near the weather sensor tower but it is close enough to the WiFi signal beam to use WiFi for communicating. The location also means that the sensor will have to be solar powered.
The tipping bucket sensor is from the weather meters sold by SparkFun electronics. It provides a reed switch closure each time the bucket tips. A cable with an RJ11 connector is provided.
For the electronics I chose a SparkFun ESP8266 DEV. This board has an ESP8266 WiFi chip along with a USB serial port for debugging and provisions to connect an external WiFi antenna if needed. I mounted this along with a tiny switching regulator on a piece of perf board.
For the solar power I used a small motorcycle size lead acid battery and started out with a 1.5 watt solar panel intended to trickle charge car batteries. I thought about using a rechargeable lithium battery but most of them will not charge when cold and I did not want the hassle of taking it inside during the winter. The 1.5 watt solar panel turned out to be inadequate and let the battery go dead after a week or so. A 5 watt panel would have worked but I could not find a suitable one so I settled on a 10 watt panel. Some software work on power saving might have allowed the smaller panel to work.
There were problems with the tipping bucket sensor. Spiders and earwigs got into the sensor by way of the drain holes in the bottom. The funnel has a grid to keep trash and insects out but the bottom had large holes. The earwigs would mess up the inside and the spiders would build webs that would prevent the tipping bucket from working. A piece of window screen and some duct seal solved that problem.
The battery and electronics are mounted in a plastic electrical junction box. The WiFi signals pass through the box easily so there is no need for an external antenna.
The software uses an interrupt to increment a count every time the bucket tips. For some reason I got 2 counts for each tip. Something to do with the way the interrupt works I suppose. There is timeout for contact bounce so that was not the cause of the 2 counts. No problem though just divide the count by 2. Initially I was only going to send the tip count each time it incremented but there were problems with this approach. Without some activity the WiFi link would disconnect. I did not see anything in the software samples I looked at to deal with this problem. I settled on sending out the tip count every 5 minutes and whenever the bucket tips. This keeps the WiFi link connected and gives an assurance that the sensor is still working.
The tip count is sent as a HTTP get message to my web server. A PHP script on the web server then sends the tip count along with a time stamp to a MySQL server. Finally a PHP web page script accesses the SQL data, produces a plot and sends it to the user. The plot shows the accumulated rain from midnight to the current time or the whole 24 hours if asking for data from a previous day.
There are a few enhancements I can think of that I will be working on.
- Display the rainfall rate
- Add a display of the rain for my CoCoRaHS reporting period 7 AM to 7 AM
- Add some way to tell if the system is up and running
CoCoRaHS Community Collaborative Rain, Hail and Snow Network https://www.cocorahs.org/
Rain sensor data http://www.ocrslc.net/sensors/rain.php