Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
RainDrop Detection Using Arduino Uno
WhatsApp
Kumaresh Rajalingam
4y
15.5k
0
2
100
Article
RainSensor.rar
Introduction
In my previous article, I explained about
soil moisture sensor
to sense irrigation and in this article, I'll show you working with Rain Sensor to sense raindrops and some other applications. The Rain Module Sensor Sense the following conditions based upon the temperature, irrigation, raindrops, etc.
There are two main applications for Rain Sensor
Water Conservation device connected to an automatic irrigation system.
Protect the interior of an automobile from rain.
Requirements
Arduino
Uno
Rain Sensor Module
Bread Board
Led
Connection
Figure:
Rain Sensor
Analog pin to Arduino A0
Gnd to Gnd
Vcc to 5v
Led Connection:
Anode pin to the Arduino digital pin13
Cathode pin to the Gnd
Coding:
int
RainSensor=0;
int
Alert=7;
int
led=13;
int
count=0;
void
setup()
{
Serial.begin(9600);
pinMode(Alert,OUTPUT);
pinMode(RainSensor,INPUT);
pinMode(led,OUTPUT);
}
void
loop()
{
int
Sense=analogRead(RainSensor);
Serial.println(Sense);
delay(100);
if
(count >=44){
digitalWrite(led,HIGH);
digitalWrite(Alert,HIGH);
}
while
(Sense < 400){
count++;
}
do
{
digitalWrite(led,LOW);
digitalWrite(Alert,LOW);
count=0;
}
while
(Sense > 400);
delay(1000);
}
Explanation
Declare the variables
Rainsensor
Alert
led
Count as integer datatype and Initialize the value to the variables i,e analog pin and digital pin.
Functions
Void setup()
Set the PinMode as OUTPUT and INPUT
Set the BaudRate (9600)
Void loop()
The loop function is the one type of the condition function based upon our condition the Rain Sensor will work.
It reads the Analog Pin value I,e Rain sensor value and then prints the sense the value that has been sensed by the rain sensor and make the condition to the count value if ( count >=44) the led will ON and the alert will be a HIGH while (sense <400) and increment the count value using ++ operator then do the led will goes LOW and alert also LOW while (sense>400) and set the delay time (1000).
Applications
Condensation Sensing
Irrigation Control
Drop Detection
Read more articles on
Arduino
:
Remote Control Using Arduino
Arduino LCD display
Arduino Uno
Internet of Things
IoT
RainDrop Detection Sensor
Up Next
Ebook Download
View all
Raspberry Pi -Sensorial Symphony of Connectivity
Read by 693 people
Download Now!
Learn
View all
Membership not found