How to Use a Rain Sensor

How to Use a Rain Sensor

This project will show you how to use a rain sensor.

  • 13,198 views
  • 2 comments
  • 13 respects

Components and supplies

Apps and online services

About this project

Operation

A rain sensor is composed of a rain detection plate with a comparator who manages intelligence.

The rain sensor detects water that comes short circuiting the tape of the printed circuits.

The sensor acts as a variable resistance that will change status : the resistance increases when the sensor is wet and the resistance is lower when the sensor is dry.

The comparator has 2 outputs connected to the rain sensor, a digital output ( 0/1 ) and an analog output ( 0 to 1023 ).

Sensor characteristics

  • Voltage : 3, 3v-5v
  • Sensor Dimension : 3.9 x 5.4 cm
  • Sensitivity potentiometer
  • 2 control leds

Connections

Arduino --> Comparator

5V --> VCC

GND --> GND

DO --> D4

AO --> A0

For the other two connections...

Adjust the sensitivity

You can also adjust the sensitivity by turning the potentiometer present on the comparator. So the detection can be realize on a drop or in a glass of water.

Code

Code for Rain sensor Arduino
const int capteur_D = 4;
const int capteur_A = A0;

int val_analogique;

void setup()
{
  pinMode(capteur_D, INPUT);
  pinMode(capteur_A, INPUT);
  Serial.begin(9600);
}

void loop()
{
if(digitalRead(capteur_D) == LOW) 
  {
    Serial.println("Digital value : wet"); 
    delay(10); 
  }
else
  {
    Serial.println("Digital value : dry");
    delay(10); 
  }
val_analogique=analogRead(capteur_A); 
 Serial.print("Analog value : ");
 Serial.println(val_analogique); 
 Serial.println("");
  delay(1000);
}

Comments

Similar projects you might like

Arduino Temperature - Humidity - Rain Sensor

Project showcase by Rick_Findus

  • 15,343 views
  • 6 comments
  • 19 respects

How to Use a Soil Moisture Sensor

by MisterBotBreak

  • 28,781 views
  • 12 comments
  • 40 respects

Smoke Detection using MQ-2 Gas Sensor

by Aritro Mukherjee

  • 322,667 views
  • 54 comments
  • 204 respects

How To Use DS18B20 Water Proof Temperature Sensor

Project showcase by Team IoTBoys

  • 89,360 views
  • 16 comments
  • 26 respects
Add projectSign up / Login