Site icon Circuit Ideas for You

Rain Detector Circuit using Arduino

This project for Rain Detector Circuit using Arduino shows how to detect rain.

Rain sensor plate feels water drops.

Module gives analog and digital signal.

Arduino reads signal.

LED glows when rain starts.

This is low cost and easy project for beginners.

Arduino Coding:

int rainAnalog = A0;     // analog signal from sensor
int rainDigital = 7;     // digital rain signal
int redLed = 13;         // red LED for rain alert
int greenLed = 9;        // green LED for no rain
int buzzer = 8;          // buzzer pin

void setup() {
  pinMode(rainDigital, INPUT);
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  Serial.begin(9600);
}

void loop() {

  int analogValue = analogRead(rainAnalog);
  int rain = digitalRead(rainDigital);

  Serial.print("Analog Value: ");
  Serial.println(analogValue);

  if (rain == 0) {  
    digitalWrite(redLed, HIGH);    
    digitalWrite(greenLed, LOW);   
    digitalWrite(buzzer, HIGH);    
  }
  else {           
    digitalWrite(redLed, LOW);     
    digitalWrite(greenLed, HIGH);  
    digitalWrite(buzzer, LOW);     
  }

  delay(300);
}

Code Explanation:

Circuit Working:

Parts List:

ComponentQuantity
Resistor 220Ω 1/4 watt2
Arduino UNO1
Rain Drop Detection Sensor Module1
LED Red and Green1 each
Buzzer 5V1
USB Cable1

Rain plate has two metal lines.

Water makes conduction between lines.

Resistance decreases when water present.

Sensor module converts resistance change to voltage.

Arduino reads voltage from analog pin.

Arduino also reads digital output from DO pin.

Buzzer gives sound when rain is detected.

If rain is detected then Red LED1 turns on to show rain is present.

If no rain then Green LED2 turns on to show no rain.

Formulas with Calculations:

Sensor acts like a variable resistor.

With water, resistance goes low and AO voltage goes high.

Circuit uses voltage divider formula:

Vout = Vin * (R2 / (R1 + R2))

here,

Example assume:

Dry sensor example:
R2 = 100k ohm

Vout = 5 * (100k / (50k + 100k))
Vout = 5 * (100k / 150k)
Vout = 5 * 0.666
Vout = 3.33V

Wet sensor example:
R2 = 20k ohm

Vout = 5 * (20k / (50k + 20k))
Vout = 5 * (20k / 70k)
Vout = 5 * 0.285
Vout = 1.42V

Arduino reads these voltages as numbers from 0 to 1023.

How to Build:

To build a Rain Detector Circuit using Arduino following are the steps one should follow:

Conclusion:

This is simple and easy Rain Detector Circuit using Arduino.

Rain sensor plate gives water level.

Arduino shows rain condition with LED.

Useful for automatic windows, weather station, farms and home systems.

Easy to build and with low cost.

References:

Rain Detection System Using Arduino and Rain Sensor

Exit mobile version