rain detection

Rainwater alert system

Rain alert alarm with code

In this post we are creating an arduino based rain alert alarm circuit with the code explanation line by line.Here we also discuss about the working of the rain water sensor which includes the intensity of rain falls into the circuit

Rain water sensor working

This module works on the basics of opamp LM393, The sensor board is coated with Nickel as lines which helps analyse the moisture content in the board. when there is moisture content the resistance is low and when the board is dry the resistance will be high and the opamp amplifies the output

Specifications

  • Adopts high quality of RF-04 double sided material.
  • Area: 5cm x 4cm nickel plate on side,
  • Anti-oxidation, anti-conductivity, with long use time;
  • Comparator output signal clean waveform is good, driving ability, over 15mA;
  • Potentiometer adjust the sensitivity;
  • Working voltage 5V;
  • Output format: Digital switching output (0 and 1) and analog voltage output AO;
  • With bolt holes for easy installation;
  • Small board PCB size: 3.2cm x 1.4cm;
  • Uses a wide voltage LM393 comparator
Hexcodeplus
Hexcodeplus

Arduino code

//paste this code in arduino IDE 

const int sensorMin = 0; // set minimum sensor value 

const int sensorMax = 1024; //set maximum sensor value

//void setup is single time running program in Arduino 

void setup()

{

Serial.begin(9600);//here we initialize the baud rate to 9600

}

//loops are continuously executing the programme in Arduino programming

void loop() 

{

  int sensorReading = analogRead(A0); //to read analog value from the A0 pin

  int range = map(sensorReading, sensorMin, sensorMax, 0, 3); //map funtion to map the values to our rated range 

  switch (range) 

  {

    case 0: // Sensor getting completely wet

      Serial.println(“RAINING”);

      break;

    case 1: // Sensor getting partially wet

      Serial.println(“RAIN WARNING”);

      break;

    case 2: // Sensor dry

      Serial.println(“NOT RAINING”);

      break;

  }

  delay(1000); //delay 1 second

}

 

Hexcodeplus

Add a Comment

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