This will show you how to make your own "tipping bucket" rain gauge with a NodeMCU, that makes it easy to send data to an online service of your choice. In this tutorial we are going to collect data from the rain gauge and then transmit it every 30 minutes to the readiness.io service.
The nodeMCU uses the ESP8266 Chip from Espressif. It has built-in Wifi and is compatible with the Arduino IDE. If you haven't used a NodeMCU before check out this quick start guide.
Tipping buckets are a fairly common tool for measuring rainfall. It is a simple device that consists of a funnel which directs the water into a bucket. Once the bucket fills up it tips over activating a switch, tipping out the water and begins filling up the bucket on the other side. - See wikipedia for more info
For your own rain gauge the simplest option is to buy one. Something like this or this would work with our setup. If you do buy one - you don't need to worry about the Hall effect sensor or magnet. If you're looking for something a bit more agricultural you can out one together from parts you can pick up at your local hardware store. Check out the design from these guys
In our case we've 3D printed one. We've based ours on this one by BulldogLowell. We've modified it slightly to fit our sensor and magnet.
The STL files can be found in our Github repository
Every time the the bucket tips, the switch registers one count, which we can convert into a height of rainfall. The height of rainfall can be determined by the ratio of the volume of rain collected to the collection area:
rainfall height (cm) = volume collected (mL) / collection area (cm2)
For our collector we have a collection area of 5.5cm x 3.5cm (19.25cm2) and a collection per tip of the bucket of 2.5mL. This gives us a rainfall height of 0.1298cm or 1.298mm per tip.
A couple of notes when installing the unit
For the rain gauge we will be posting the data every 30 minutes to the readiness.io service. We'll be using the readiness.io library that manages the wifi and service connections. We've also split out all of the configuration variables in a separate .h file.
Within the RainGauge.ino code we have three interrupts performing the key functions
You can download the full source code here
Here is the final rain gauge. The nodeMCU is housed in the enclosure with the wires for the tipping bucket entering through the cable gland to ensure that its water tight and safe to be install outside. Our wires are fairly should but you can make them as long as you need.
You can also see the inside of the tipping bucket. The sensor is attached to the wall, whilst the magnet is fixed to the swing arm of the tipping bucket, so that every time it fills up and tips over it registers a reading. The hardest part of assembling the tipping bucket it positioning the sensor and magnet correctly. Just close enough to take a reading but not tool close that it always remains on.