Last Updated: 01/10/2021

Rain Drop Sensor

Components >> Rain Drop Sensor

Rain Drop sensor

Rain Drop sensor

Rain Drop sensor available from Ebay for about £3.00.

The unit gives an analog and digital output and can detect rain/snow and even humidity.

 

Rain Drop sensor issues

I am using the sensor as part of my Cat washer project. The Cat Washer V4 was being triggered because the PIR sensor was being triggered by rain drops.

The angle that you place the rain detector needs a bit of thought. It is probably best placed at an angle so that rain can run off as in my case I want the Cat washer running as soon as the rain stops. If the detector was horzontal water can pool on the unit. Too steeo an ange and water could run straight off even in the rain.

Also too shallow an angle could lead to dirt/moss build up if the unit is going to be outside for long periods of time.

Simple Circuit Diagram

VCC to 5V
Gnd to Gnd
DO to Pin 12
AO to Analog 0

 

Example 1: rainDropV1.ino


Click to Download code: rainDropV1.ino

Simple sketch showing how to read the analog and digital pins.

 

 
/* 01/10/2021
 * 
 * rainDropV1
 * 
 * Example script using a 
 * 
 * Works :-)
 * 
 * VCC to 5V
  Gnd to Gnd
  DO to Pin 12
  AO to Analog 0
 * 
 * 
 */

const int rainPin = 12;
const int rainAnalog = A0;
unsigned long myTimer;//better system when adding to other scripts
int digitalRainVal;
int analogRainVal;

void setup() {
  Serial.begin(9600);
  Serial.println("rainDropV1...");
  pinMode(rainPin,INPUT);
}


void loop() {
  if(millis() > myTimer){
    myTimer = millis() + 500;
   digitalRainVal = digitalRead(rainPin);
   analogRainVal = analogRead(rainAnalog);
   Serial.print("Digital: ");
   Serial.println(digitalRainVal); 
   Serial.print("Analog: ");
   Serial.println(analogRainVal);
   
  }
   


}

Additional Resource Links

Functions 2 : digitalRead() Reading a digital pin and pullup resistors

Functions 3 : analoglRead() Reading an Analog pin, converting to Voltage

Lesson 7: delay() v's millis(), controlling timing of programs

Comments


This site has been designed to be child friendly, this means that comments cannot be added to videos or directly to the site.
To add a comment or ask a question please email the address in this image: and use Rain Drop Sensor as a reference.