1. Introduction
Rain detection systems are useful in many practical applications such as weather monitoring, automatic window control, smart irrigation systems, and rain alarms. Detecting rain early can help protect equipment, clothes, and crops.
In this project, we will build a simple Arduino Rain Alarm using the YL-83 rain sensor module. The rain sensor detects water droplets falling on its plate. When rainwater touches the sensor surface, it changes the conductivity between the tracks on the plate.
The sensor module sends a signal to the Arduino, which then activates a buzzer and LED indicator to alert the user that rain has started.
This is an excellent beginner Arduino project that helps students understand how sensors, digital signals, and analog signals work with microcontrollers.
2. Components
The following components are required to build this project:
-
Arduino Uno
-
YL-83 Rain Sensor Module
-
Rain Sensor Plate
-
Buzzer
-
LED
-
220Ω Resistor
-
Breadboard
-
Jumper Wires
-
USB Cable for Arduino
3. Circuit and Connections
Make the following connections according to the circuit diagram.
Rain Sensor Plate to Module
The rain sensor plate connects directly to the rain sensor module.
-
Plate terminal → S+ on module
-
Plate terminal → S− on module
Rain Sensor Module to Arduino
-
VCC → Arduino 5V
-
GND → Arduino GND
-
DO → Arduino Digital Pin 7
-
AO → Arduino Analog Pin A0
The digital output (DO) gives a HIGH or LOW signal when rain is detected.
The analog output (AO) provides a variable voltage depending on the amount of water on the sensor plate.
Buzzer Connection
-
Buzzer Positive (+) → Arduino Pin 8
-
Buzzer Negative (–) → Arduino GND
LED Connection
-
LED Anode (+) → Arduino Pin 13
-
LED Cathode (–) → 220Ω Resistor → GND
The LED provides a visual indication when rain is detected.
4. Circuit Working
The rain sensor plate consists of parallel conductive tracks. When water droplets fall on the plate, the resistance between the tracks decreases.
The rain sensor module detects this change and produces an output signal.
The Arduino continuously monitors the signal from the digital output pin of the sensor module.
-
No Rain Condition
-
Sensor output = HIGH
-
Arduino keeps buzzer OFF
-
LED remains OFF
-
-
Rain Detected
-
Sensor output = LOW
-
Arduino turns buzzer ON
-
LED turns ON
-
At the same time, the analog pin A0 measures the water level intensity, which can be viewed using the Serial Monitor.
Thus the system works as a simple rain detection alarm system.
5. Code
int rainDigital = 7;
int rainAnalog = A0;
int buzzer = 8;
int led = 13;
void setup()
{
pinMode(rainDigital, INPUT);
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int rain = digitalRead(rainDigital);
int waterLevel = analogRead(rainAnalog);
Serial.print("Water Level: ");
Serial.println(waterLevel);
if(rain == LOW)
{
digitalWrite(buzzer, HIGH);
digitalWrite(led, HIGH);
}
else
{
digitalWrite(buzzer, LOW);
digitalWrite(led, LOW);
}
delay(500);
}
6. Code Working
First, the pins connected to the rain sensor, buzzer, and LED are defined in the program.
int rainDigital = 7;
int rainAnalog = A0;
int buzzer = 8;
int led = 13;
Inside the setup() function, the sensor pin is configured as input and the buzzer and LED pins are set as outputs.
pinMode(rainDigital, INPUT);
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
The Serial Monitor is also initialized to display the analog water level value.
Serial.begin(9600);
Inside the loop() function, the Arduino continuously reads the rain sensor.
If the digital output becomes LOW, it means rainwater has been detected on the sensor plate. The Arduino immediately turns ON the buzzer and LED.
If the digital output remains HIGH, it means there is no rain, so the buzzer and LED stay OFF.
The analog value from A0 is printed on the Serial Monitor to show the water level intensity.
7. Tips
-
Place the rain sensor plate in an open area to detect rain effectively.
-
Do not keep the sensor permanently wet because it may corrode over time.
-
Adjust the sensitivity potentiometer on the module to change detection sensitivity.
-
Use a protective enclosure for the Arduino board if the system is installed outdoors.
8. Uses
This rain detection system can be used in many applications such as:
-
Rain alarm systems
-
Smart irrigation systems
-
Weather monitoring stations
-
Automatic window closing systems
-
Automatic clothes drying alert systems
9. Conclusion
In this project, we built a simple Arduino Rain Alarm system using the YL-83 rain sensor module. The sensor detects rainwater on the plate and sends a signal to the Arduino, which activates a buzzer and LED alert.
This project demonstrates how environmental sensors can be used with Arduino to create practical automation systems. It is an excellent project for students and beginners who want to learn sensor interfacing and Arduino programming.