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, 4:28 AM EDT
thank you prasanna
Sr KarthigaPosted May 25, 2016, 4:28 AM EDT
thank you kumaresh
Prasanna MuraliPosted May 20, 2016, 6:16 AM EDT
Nice one...
Kumaresh RajalingamPosted Apr 8, 2016, 10:31 PM EDT
Nice share
Sr KarthigaPosted Mar 29, 2016, 4:23 AM EDT
Thank you Asfend yar sir
Sr KarthigaPosted Mar 29, 2016, 4:22 AM EDT
Thank you mohammed sir
Sr KarthigaPosted Mar 29, 2016, 4:22 AM EDT
thank you sibeesh sir
Sr KarthigaPosted Mar 29, 2016, 4:22 AM EDT
Thank you Debasis saha sir
Asfend YarPosted Mar 28, 2016, 10:49 AM EDT
ck
Karthik ElumalaiPosted Mar 28, 2016, 1:44 AM EDT
Very Innovative..Keep doing
Mohammed IbrahimPosted Mar 28, 2016, 12:09 AM EDT
nice
Sibeesh VenuTOP 100Posted Mar 27, 2016, 10:08 PM EDT
Nice Share
Debasis SahaTOP 100Posted Mar 27, 2016, 8:37 PM EDT
Good One..
Sr KarthigaPosted Mar 27, 2016, 4:58 PM EDT
Thank you vignesh mani sir
Sr KarthigaPosted Mar 27, 2016, 4:58 PM EDT
Thank you vignesh mani sir
Vignesh ManiTOP 100Posted Mar 27, 2016, 11:41 AM EDT
Nice one
Vignesh ManiTOP 100Posted Mar 27, 2016, 11:41 AM EDT
Good one
Sr KarthigaPosted Mar 27, 2016, 5:05 AM EDT
Thank you kumaresh sir
Kumaresh RajalingamPosted Mar 27, 2016, 4:54 AM EDT
Nice share