Rain Detector Using Arduino and Raindrop Sensor

Arduino Projects


This article will learn how to make a Rain Detector project using Arduino and Raindrop sensor. 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.


Components Required

  • Arduino UNO
  • Raindrop Sensor
  • Breadboard
  • Jumper Wires
  • L293D Motor Driver
  • DC Motor
  • LED and Resistor 220 ohm
  • USB cable for uploading code into Arduino UNO
  • 9-Volt Batteries

Components Table / Buy link

S.NoComponent RequiredQuantityBuy Link
1.Arduino UNO1https://amzn.to/3ue2vmh
2.Arduino UNO Cable1https://amzn.to/3obXjht
3Rain Sensor1https://amzn.to/3aaBTJy
4.L293D Motor Driver1https://amzn.to/3uLl2pX
5.BO Motor1https://amzn.to/3uGUI0p
7.220-ohm Resistor1https://amzn.to/3oioZkQ
8.Jumper Wire40https://amzn.to/39q43jr
10.9 Volt Battery2https://amzn.to/3zUDj5l



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 pin 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 )  

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

Leave a Reply

Your email address will not be published. Required fields are marked *