Rain Detector Using Arduino and Raindrop Sensor


This article will learn how to make a Rain Detector project using Arduino and Raindrop sensors.

In this project, we use a Raindrop sensor for detecting the rain and a dc motor for covering the roof. If you are new to this field please do check out more projects on Arduino.

Arduino is a microcontroller that uses ATmega328p IC for its functioning. There are many types of Arduino boards available in the market but we use Arduino UNO for this project. For controlling the dc motor we use the L293D motor driver module. Make the connections as given below in the circuit diagram and upload the Arduino code.

The system starts working as soon as you power the Arduino and motor driver by using 9 volts dc batteries. Also, check Weather Station with Arduino.

How Does the System Work?

The Rain Detector Using Arduino and Raindrop Sensor is used to alert the surrounding when it’s raining outside. The system is controlled with Arduino UNO. If the waterfalls on the Raindrop sensor it detects that it’s raining outside and a led connected with it will glow and alert the surroundings.

The dc motor starts moving when it rain and covers the roof s that rainwater can’t come inside the home in this Arduino project.

For controlling the dc motor L293D motor driver is used. So whenever it’s raining outside your roof will automatically cover with a shelter.

Arduino interface with rain Drop sensor

Components Required


Circuit Diagram of the Project

rain detector using Arduino circuit

Connection Table

Arduino UNORain Sensor
( +5V ) VCC
D4 Pin  ( SDA )D0 Pin
Arduino UNO9 Volt Battery
VinPositive  Terminal
GND Negative  Terminal
ArduinoLED 220 Ohm Resistor
D3 PinAnode Pin 
 Cathode PinTerminal 1
Arduino UNOL293D Motor Driver9 Volt Battery
D6 PinM 1 
D7PinM 2 

Make the connections according to the given diagram for the Arduino project. Connect the positive pin of the 9 Volt battery to the Vin pin of Arduino and the negative to the ground(GND) pin of Arduino.

From Arduino connect 5v to the positive rail of the breadboard and ground to the negative rail.

Connect the A0 pin of the Raindrop sensor to the digital 4 pins of the Arduino, VCC to the positive rail, and GND to the negative rail.

Connect the L293D motor driver pins with Arduino digital 6 and 7 pins as shown and motor 1 pins to the dc motor. Now connect 9 volts battery to the VCC and GND of the motor driver module.

Connect digital 3 pins of the Arduino to the positive leg of the LED and negative leg to breadboard ground via a 220-ohm resistor. After completing the circuit upload the given code.


Code of the Project

NOTE: Upload the Arduino code given below as it is. Click here if you don’t know how to upload the code.

 int val = 0 ;  
 void setup()  
  pinMode(4,INPUT); // rain sensor output pin connected  
  pinMode(3,OUTPUT); // led pin  
  pinMode(6,OUTPUT); // motor  
  pinMode(7,OUTPUT); // motor  
 void loop()   
  val = digitalRead(4); // rain sensor output pin connected  
  Serial.println(val); // see the value in serial mpnitor in Arduino IDE  
  if(val == 1 )  

What is Rain Sensor? Rain sensor explanation, Working & Uses

What is Rain Sensor? Rain sensor explanation, Working & Uses

Rain sensor Arduino Mini Project

DHT11 Temperature and Humidity Sensor | DHT11 sensor

Soil Moisture Sensor Working, explanation, Schematic

Thanks for visiting hope you learn the project well. Please do check out more Arduino tutorials.


Video sample

Spread the love, Share this post with friends

3 thoughts on “Rain Detector Using Arduino and Raindrop Sensor

  • January 24, 2022 at 7:01 am

    It’s not working
    Motor are continuously forward direction rotate and rain drop sensor module are two LEDs is directly on without water drop sense

    • January 24, 2022 at 8:22 am

      there is a potentiometer on the rain drop sensor module which is in blue colour. rotate this potentiometer until the one led will turn off

  • Pingback: Rain Drop Sensor | Rain Sensor | working | uses

Leave a Reply

Your email address will not be published.