Introduction
Parts Of List
- Arduino Mega 2560
- Rain sensor
- Bread Board
Rain Sensor

Figure 1: Rain Sensor
- The Raindrop Detection Sensor module is an easy-to-use and low cost drop recognition sensor.
- The sensor works through a series of exposures.
- Parallel traces on board produce electrical variations when drops or water volume changes.
- By using microcontrollers or ADC ICs (Arduino and PIC) its fairly easy to convert the analog output from the sensor to digital values.
- This can be directly read by an Arduino or a comparator circuit if you wish to use it as a rain detection alarm. It can be used to monitor a variety of weather conditions.
Connection
- VCC: positive power supply (3-5V)
- GND:power supply is negative
- DO:TTL switching signal output
- AO:analog signal output.
Programming
- /* Flame Sensor analog example.
- Code by Reichenstein7 (thejamerson.com)
- For use with a Rain Sensor with an analog out!
- To test view the output, point a serial monitor such as Putty at your Arduino.
- - If the Sensor Board is completely soaked;
- "case 0" will be activated and " Flood " will be sent to the serial monitor.
- - If the Sensor Board has water droplets on it;
- "case 1" will be activated and " Touched " will be sent to the serial monitor.
- - If the Sensor Board is dry;
- "case 2" will be activated and " Not Touched " will be sent to the serial monitor.
- */
- // lowest and highest sensor readings:
- const int sensorMin = 0;
- // sensor minimum
- const int sensorMax = 1024;
- // sensor maximum
- void setup()
- {
- // initialize serial communication @ 9600 baud:
- Serial.begin(9600);
- }
- void loop()
- {
- // read the sensor on analog A0:
- int sensorReading = analogRead(A0);
- // map the sensor range (four options):
- // ex: 'long int map(long int, long int, long int, long int, long int)'
- int range = map(sensorReading, sensorMin, sensorMax, 0, 3);
- // range value:
- switch (range)
- {
- case 0:
- // Sensor getting wet
- Serial.println("Flood");
- break;
- case 1:
- // Sensor getting wet
- Serial.println("Touched");
- break;
- case 2:
- // Sensor dry - To shut this up delete the " Serial.println("Not Raining");
- " below.
- Serial.println("Not touched");
- break;
- }
- delay(1);
- // delay between reads
- }
Explanation
- If the Sensor Board is completely soaked; "case 0" will be activated and "Flood" will be sent to the serial monitor.
- If the Sensor Board has water droplets on it; "case 1" will be activated and "Touched" will be sent to the serial monitor.
- If the Sensor Board is dry; "case 2" will be activated and "Not touched" will be sent to the serial monitor.
- The output in "case 2", "Not Raining" is just for this demonstration.
- When I used this code in production I omitted the output for this case and just had the alert.
Output

Figure2:Output
Read more articles on Arduino:

Sr KarthigaPosted May 25, 2016, 8:28 AM
thank you prasanna
Sr KarthigaPosted May 25, 2016, 8:28 AM
thank you kumaresh
Prasanna MuraliPosted May 20, 2016, 10:16 AM
Nice one...
Kumaresh RajalingamPosted Apr 9, 2016, 2:31 AM
Nice share
Sr KarthigaPosted Mar 29, 2016, 8:23 AM
Thank you Asfend yar sir
Sr KarthigaPosted Mar 29, 2016, 8:22 AM
Thank you mohammed sir
Sr KarthigaPosted Mar 29, 2016, 8:22 AM
thank you sibeesh sir
Sr KarthigaPosted Mar 29, 2016, 8:22 AM
Thank you Debasis saha sir
Asfend YarPosted Mar 28, 2016, 2:49 PM
ck
Karthik ElumalaiPosted Mar 28, 2016, 5:44 AM
Very Innovative..Keep doing
Mohammed IbrahimPosted Mar 28, 2016, 4:09 AM
nice
Sibeesh VenuPosted Mar 28, 2016, 2:08 AM
Nice Share
Debasis SahaPosted Mar 28, 2016, 12:37 AM
Good One..
Sr KarthigaPosted Mar 27, 2016, 8:58 PM
Thank you vignesh mani sir
Sr KarthigaPosted Mar 27, 2016, 8:58 PM
Thank you vignesh mani sir
Vignesh ManiPosted Mar 27, 2016, 3:41 PM
Nice one
Vignesh ManiPosted Mar 27, 2016, 3:41 PM
Good one
Sr KarthigaPosted Mar 27, 2016, 9:05 AM
Thank you kumaresh sir
Kumaresh RajalingamPosted Mar 27, 2016, 8:54 AM
Nice share