Build it step by step
0 of 8 donePrint the parts
Print a funnel, a see-saw bucket and a frame.
Fix the magnet and switch
Glue the magnet to the arm and place the reed switch so it closes once per tip.
Test the switch
Tip the bucket by hand and watch the count rise by one each time.
Wire the Nano
Connect the RTC, LCD and reed switch as in the table.
Upload the sketch
Set the RTC time using an example sketch once.
Calibrate
Pour 100 ml slowly through the funnel and note the tips, then work out mm per tip.
Update MM_PER_TIP
Enter the calibrated value in the sketch.
Install
Mount it level outdoors and check it after rain.
How do you build a tipping-bucket rain gauge?
A 3D-printed tipping bucket with a magnet and reed switch counts each 0.2 mm of rain and an Arduino totals daily rainfall. You need Arduino Nano, Reed switch (glass, 2 × 14 mm), Neodymium magnets (10 × 3 mm) × 2, DS3231 RTC module, 16x2 LCD with I2C backpack (PCF8574), Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and 3D printer PLA filament 1.75 mm (1 kg). It takes 8 steps and about 180 minutes.
- Level
- Intermediate
- Time
- About 180 min
- Parts
- 8
Wiring
| From | To | Why |
|---|---|---|
| Reed switch | Nano D2 and GND | Counts tips, uses the internal pull-up |
| DS3231 module VCC | Nano 5V | Power |
| DS3231 module GND | Nano GND | Ground |
| DS3231 module SDA | Nano A4 | I2C data |
| DS3231 module SCL | Nano A5 | I2C clock |
| LCD I2C VCC | Nano 5V | Power |
| LCD I2C GND | Nano GND | Ground |
| LCD I2C SDA | Nano A4 | I2C data, shared |
| LCD I2C SCL | Nano A5 | I2C clock, shared |
Code
The mm of rain per tip is the volume of one bucket divided by the funnel area. For a funnel of 100 cm² and a bucket that tips at 2 ml, each tip is 2 ÷ 100 × 10 = 0.2 mm. Measure your own funnel and calibrate by pouring a known volume slowly through it. Fix the magnet on the see-saw arm so that it passes the reed switch once per tip, and seal the electronics against water. Keep the gauge level and away from trees and walls, with the funnel at least a metre above the ground. A tipping bucket under-reads in very heavy rain, so treat the result as a good estimate and not a reference. Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Libraries: RTClib (Adafruit), LiquidCrystal_I2C (Frank de Brabander).
#include <Wire.h>
#include <RTClib.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
const float MM_PER_TIP = 0.2; // change after calibration
volatile unsigned int tips = 0;
volatile unsigned long lastTip = 0;
unsigned int savedTips = 0;
byte savedDay = 0;
RTC_DS3231 rtc;
LiquidCrystal_I2C lcd(0x27, 16, 2); // try 0x3F if blank
void onTip() {
unsigned long n = millis();
if (n - lastTip > 50) { tips++; lastTip = n; } // 50 ms debounce
}
void saveState(byte day) {
EEPROM.put(0, savedTips);
EEPROM.update(4, day);
}
void setup() {
pinMode(2, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(2), onTip, FALLING);
lcd.init(); lcd.backlight();
rtc.begin();
DateTime now = rtc.now();
EEPROM.get(0, savedTips);
savedDay = EEPROM.read(4);
if (savedDay != now.day() || savedTips == 0xFFFF) { savedTips = 0; savedDay = now.day(); saveState(savedDay); }
tips = savedTips;
}
void loop() {
DateTime now = rtc.now();
if (now.day() != savedDay) { // new day, reset the total
noInterrupts(); tips = 0; interrupts();
savedTips = 0; savedDay = now.day(); saveState(savedDay);
}
noInterrupts(); unsigned int t = tips; interrupts();
if (t != savedTips) { savedTips = t; saveState(savedDay); } // EEPROM is rated for about 100000 writes
lcd.setCursor(0, 0);
lcd.print("Today ");
lcd.print(t * MM_PER_TIP, 1);
lcd.print(" mm ");
lcd.setCursor(0, 1);
lcd.print(now.hour()); lcd.print(":");
if (now.minute() < 10) lcd.print("0");
lcd.print(now.minute());
lcd.print(" tips "); lcd.print(t); lcd.print(" ");
delay(500);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Bucket tipped by hand | Count rises by one |
| 100 ml poured slowly | A consistent number of tips |
| Power cycle | Today's total is restored |
| After midnight | Total resets to zero |
If it does not work
Count jumps by two or more
Increase the debounce or move the magnet.
No count
Check the reed switch position and the D2 wire.
LCD blank
Try address 0x3F and adjust the contrast trimmer.
Total wrong
Recalibrate MM_PER_TIP with a measured volume.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the tipping-bucket rain gauge?
Arduino Nano, Reed switch (glass, 2 × 14 mm), Neodymium magnets (10 × 3 mm) × 2, DS3231 RTC module, 16x2 LCD with I2C backpack (PCF8574), Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and 3D printer PLA filament 1.75 mm (1 kg).
How long does the tipping-bucket rain gauge take to build?
About 180 minutes for a intermediate maker, in 8 steps.
How do I know the tipping-bucket rain gauge works?
Bucket tipped by hand: Count rises by one. 100 ml poured slowly: A consistent number of tips. Power cycle: Today's total is restored.
Count jumps by two or more: what should I check?
Increase the debounce or move the magnet.
No count: what should I check?
Check the reed switch position and the D2 wire.
LCD blank: what should I check?
Try address 0x3F and adjust the contrast trimmer.
Total wrong: what should I check?
Recalibrate MM_PER_TIP with a measured volume.
