Rain Detection System Using Arduino

A rain detection system using an Arduino microcontroller is an excellent project for monitoring rainfall and triggering actions such as activating an alarm or sending alerts. This project utilizes a rain sensor module that detects the presence of rainwater and a buzzer to provide an audio alert.

 

This project demonstrates how to build a rain detection system using an Arduino microcontroller. The system detects the presence of rainwater and triggers an action, such as playing an audio alert using a buzzer.

 

 

Components and Supplies

 

 

1 Arduino Uno - Buy Now

 

 

Immagine

5V Passive Buzzer - Buy Now

 

 

7-12 V DC Battery (in our case lipo 2s battery)

 

 

Jumper-Wires - BUY NOW

 

 

Rain drop Sensor Module Snow RainWeather For Arduino - Rain drop sensor  module for arduino - raindrop sensor / rainWeather :

Rain Sensor Module - BUY NOW
 

 

How It Works

The rain sensor module detects water through its resistance-based mechanism. The sensor's resistance changes depending on the amount of water present. When water is detected, the resistance decreases, and this data is read by the Arduino. If the sensor value falls below a predefined threshold, the Arduino activates the buzzer to indicate rain.

 

 

Step 1: Understanding the Rain Sensor

 

The rain sensor module consists of a detection board that measures the presence of water. It operates by changing resistance based on the amount of water detected:

Higher resistance → Less or no water

Lower resistance → More water present

The sensor provides an output in the range of 0-1023, where 1023 indicates no water and lower values indicate water presence. The threshold is set below 102 to trigger the alert.

 

Step 2: Circuit Connections

 

Rain Sensor to Arduino:

VCC → 5V (Arduino)

GND → GND (Arduino)

Signal Pin → A0 (Arduino)

 

Buzzer to Arduino:

Positive (VCC) → Digital Pin 9 (Arduino)

Negative (GND) → GND (Arduino)

 

 

Step 3: Uploading the Code

Use the Arduino IDE to upload the following code to your Arduino Uno:

 

Step 4: Monitoring the Sensor Readings

Connect the Arduino to your computer via USB.

Open the Serial Monitor in the Arduino IDE.

Observe real-time sensor values and adjust the threshold if needed.

 

Step 5: Testing the System

Power the Arduino with a 7-12V DC battery.

Simulate rain by placing water droplets on the sensor.

The buzzer should activate when rain is detected.

Dry the sensor and observe the buzzer turning off.

 

Testing and Calibration:

Upload the code to the Arduino using the Arduino IDE.

Open the Serial Monitor to observe real-time sensor values.

Simulate rain by placing water on the sensor.

Check the buzzer response – it should activate when the sensor value is below 102.

Adjust the threshold in the code as needed for different sensitivity levels.

CODE
#define RAIN_SENSOR A0
#define BUZZER 9

void setup() {
    pinMode(RAIN_SENSOR, INPUT);
    pinMode(BUZZER, OUTPUT);
    Serial.begin(9600);
}

void loop() {
    int sensorValue = analogRead(RAIN_SENSOR);
    Serial.println(sensorValue);
    
    if (sensorValue < 102) { // Threshold for rain detection
        digitalWrite(BUZZER, HIGH);
    } else {
        digitalWrite(BUZZER, LOW);
    }
    delay(1000); // Delay for stability
}
License
All Rights
Reserved
licensBg
0