Rain Drop Sensor Features
The raindrop sensor module is used for rain detection. The module includes two parts. The first part is a printed circuit board that has a network of copper paths. When rain drops fall on this board, some parts of copper paths are connected to each other and the overall resistance of the board is reduced.
The second part is a board converting analog output to digital output. The sensitivity of the sensor can be adjusted using the potentiometer on the board.
Tip
The raindrop sensor has both analog and digital outputs. You can use any of these outputs or both depending on your need.
Rain Drop Sensor Pinout
This module has 6 pins:
- VCC: Module power supply – 3.3-5 V
- GND: Ground
- DQ: Digital Output
- AQ: Analog output
- +: To connect pads
- -: To connect pads
You can see pinout of this module in the image below.
Required Materials
Hardware Components
Software Apps
Interfacing Rain Drop Sensor with Arduino
Step 1: Circuit
The following circuit shows how you should connect Arduino to rain drop Sensor. Connect wires accordingly.
Step 2: Digital Interfacing Code
Upload the following code to your Arduino. You can see the result in the serial monitor. When a drop of water is falls on the board, the module output will be LOW.
/*
Rain Sensor - Digital
modified on 14 Sep 2020
by Mohammad Reza Akbari @ Electropeak
Home
*/
#define sensor_DO A0
//#define sensor_AO A1
void setup() {
Serial.begin(9600);
}
void loop() {
int val = digitalRead(sensor_DO);
Serial.print("Digital Output: ");
Serial.print(val);
if (val == 1) {
Serial.println(" Status: Dry");
} else {
Serial.println(" Status: Wet");
}
delay(1000);
}
After running the code, you will see the following image in the serial output.
Step 3: Analog Interfacing Code
Upload the following code to your Arduino. You can see the result in the serial monitor.
/*
Rain Sensor - Analog
modified on 14 Sep 2020
by Mohammad Reza Akbari @ Electropeak
Home
*/
//#define sensor_DO A0
#define sensor_AO A1
void setup() {
Serial.begin(9600);
}
void loop() {
int val = analogRead(sensor_DO);
Serial.print("Analog Output: ");
Serial.print(val);
delay(500);
}