Gravity: Tipping Bucket Rainfall Sensor - DFRobot

Introduction

Based on the principle of tipping bucket rainfall, the rainfall sensor provides users with rainfall values in millimeters and system operating time. The sensor has no electronic components inside and features a hollow bottom design that allows rainwater to automatically drain, making it more stable and sensitive.

It supports I2C and UART data outputs, compatible with micro:bit, Arduino, ESP32, Raspberry Pi. Integrated with the easy-to-use Gravity interface, this rainfall sensor can be used to set up a rain monitoring system easily with the provided ready-to-go libraries. The tipping bucket rainfall sensor can provide high-quality rainfall data for weather stations, environmental monitoring stations, or smart farms.

What is tipping bucket rain gauge?
The tipping bucket rain gauge is most commonly used in meteorological monitoring. The tipping bucket rain gauge is composed of measuring parts and rain receiver parts. When it rains, rainwater enters the water receiver from the uppermost water-receiving port, falls into the water-receiving funnel, and flows into the tipping bucket through the funnel mouth. When the water accumulation reaches a certain height, the tipping bucket loses balance and overturns. And every time the bucket dumps, the switch turns on the circuit and sends a pulse signal to the recorder. The recorder controls the self-recording pen to record the rainfall so that the rainfall process can be measured back and forth.

Note: The signal adapter board is not waterproof. Do not expose the signal adapter board to rain.

Specification

Board Overview

Num Label Description
1 D/T I2C data line SDA/UART data transmit-TX
2 C/R I2C clock line SCL/UART data receive-RX
3 - GND
4 + 3.3V/5V

Tutorial

Download program to Arduino UNO and check rainfall data in serial monitor.

Read Sensor Data via I2C

Requirements

Connection Diagram

Sample Code

#include "DFRobot_RainfallSensor.h"

//#define MODE_UART
#ifdef MODE_UART //UART communication

   #include "SoftwareSerial.h"
   SoftwareSerial mySerial(/*rx =*/10, /*tx =*/11);
   DFRobot_RainfallSensor_UART Sensor(/*Stream *=*/&mySerial);

#else //I2C communication
  DFRobot_RainfallSensor_I2C Sensor(&Wire);
#endif

void setup(void)
{
#ifdef MODE_UART
    mySerial.begin(9600);
#endif 
  Serial.begin(115200);

  delay(1000);
  while(!Sensor.begin()){
    Serial.println("Sensor init err!!!");
    delay(1000);
  }
  Serial.print("vid:\t");
  Serial.println(Sensor.vid,HEX);
  Serial.print("pid:\t");
  Serial.println(Sensor.pid,HEX);
  Serial.print("Version:\t");
  Serial.println(Sensor.getFirmwareVersion());
  //Set the rain accumulated value, unit: mm
  //Sensor.setRainAccumulatedValue(0.2794);
}

void loop()
{
  //Get the sensor working time, unit: hour
  Serial.print("Sensor WorkingTime:\t");
  Serial.print(Sensor.getSensorWorkingTime());
  Serial.println(" H");
  //Get the accumulated rainfall during the sensor working time
  Serial.print("Rainfall:\t");
  Serial.println(Sensor.getRainfall());
  //Get the accumulated rainfall within 1 hour of the system (function parameter optional 1-24)
  Serial.print("1 Hour Rainfall:\t");
  Serial.print(Sensor.getRainfall(1));
  Serial.println(" mm");
  //Get the raw data, the number of tipping buckets for rainfall, unit: times
  Serial.print("rainfall raw:\t");
  Serial.println(Sensor.getRawData());
  delay(1000);
}

Expected Result

Open serial monitor to get the final data.

Read Sensor Data via UART

Requirements

Connection Diagram

Sample Code


#include "DFRobot_RainfallSensor.h"

#define MODE_UART
#ifdef MODE_UART //UART communication

#include "SoftwareSerial.h"
SoftwareSerial mySerial(/*rx =*/10, /*tx =*/11);
DFRobot_RainfallSensor_UART Sensor(/*Stream *=*/&mySerial);

#else //I2C communication
  DFRobot_RainfallSensor_I2C Sensor(&Wire);
#endif

void setup(void)
{
#ifdef MODE_UART
    mySerial.begin(9600);
#endif 
  Serial.begin(115200);

  delay(1000);
  while(!Sensor.begin()){
    Serial.println("Sensor init err!!!");
    delay(1000);
  }
  Serial.print("vid:\t");
  Serial.println(Sensor.vid,HEX);
  Serial.print("pid:\t");
  Serial.println(Sensor.pid,HEX);
  Serial.print("Version:\t");
  Serial.println(Sensor.getFirmwareVersion());
  //Set the accumulated rainfall value, unit: mm
  //Sensor.setRainAccumulatedValue(0.2794);
}

void loop()
{
  // Get the sensor operating time, unit: hour
  Serial.print("Sensor WorkingTime:\t");
  Serial.print(Sensor.getSensorWorkingTime());
  Serial.println(" H");
  //Get the accumulated rainfall during the sensor operating time
  Serial.print("Rainfall:\t");
  Serial.println(Sensor.getRainfall());
  //Get the accumulated rainfall in the past 1 hour (function parameter can be 1-24)
  Serial.print("1 Hour Rainfall:\t");
  Serial.print(Sensor.getRainfall(1));
  Serial.println(" mm");
  // Get the raw data, number of tipping bucket counts
  Serial.print("rainfall raw:\t");
  Serial.println(Sensor.getRawData());
  delay(1000);
}

Expected Results

Open serial monitor to get the final data.

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents