Description
The rain sensor module is an easy tool for rain detection. The module features, a rain board and the control board that is separate for more convenience, power indicator LED and an adjustable sensitivity though a potentiometer.
Specifications:
- 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;
- PCB size: 3.2cm x 1.4cm;
- Uses a wide voltage LM393 comparator.
Getting started with Raindrops Detection sensor
In this tutorial you will learn how to use the raindrops sensor module with Arduino uno. Rain Sensors are used in the detection of water beyond what a humidity sensor can detect.
Parts required
- jumper wires
- Source of water
- Arduino Uno
- Breadboard
- Raindrops Sensor module
Connecting the Hardware
Make sure to watch sensor from front side:
- Connect the Vcc pin to 5 Volts (5V) if you use analog pin or connect Vcc pin to 3.3 Volts(3.3V) if you use digital pin
- Connect the A0 pin to pin A0
- Connect the GND pin to ground (GND)
- + pin of sensor to + pin of module
- – pin of sensor to – pin of module
The code
if the sensor Board has water droplets on it. ” case 0″ will be activated and ” Rain Warning” will be sent to the serial monitor.
if the sensor Board is dry ; “case 1″ will be activated and ” Not Raining ” will be sent to the serial monitor.
upload the code from here and open it with Arduino IDE
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(“Rain Warning”);
break;
case 1: // Sensor dry
Serial.println(“Not Raining”);
break;
}
delay(1000); // delay between reads
}
Serial Monitor
If the Sensor Board is dry.
If the Sensor Board has water droplets on it.