Index

Introduction
Raindrop Sensor is a tool used for sensing rain. It consists of two modules, a rain board that detects the rain and a control module, which compares the analog value, and converts it to a digital value. The raindrop sensors can be used in the automobile sector to control the windshield wipers automatically, in the agriculture sector to sense rain and it is also used in home automation systems.
Required Components
- Arduino UNO
- Rain Drop Sensor
- Jumper wires
- Breadboard
Pinout

Circuit Diagram / Wiring
- Rain Sensor VCC → 5V (Arduino)
- Rain Sensor GND → GND (Arduino)
- Rain Sensor DO → D2 (Arduino)
- Rain Sensor AO → A0 (Arduino)

Arduino Code / Programming
// Define sensor pins
const int analogPin = A0; // Analog output pin from the sensor
const int digitalPin = 2; // Digital output pin from the sensor
void setup() {
// Start the serial communication
Serial.begin(9600);
// Set the digital pin as input
pinMode(digitalPin, INPUT);
}
void loop() {
// Read the analog value from the sensor
int analogValue = analogRead(analogPin);
// Read the digital value from the sensor
int digitalValue = digitalRead(digitalPin);
// Print the analog value to the Serial Monitor
Serial.print("Analog Value: ");
Serial.print(analogValue);
// Print the digital value to the Serial Monitor
Serial.print(" | Digital Value: ");
Serial.println(digitalValue);
// Wait for a second before taking the next reading
delay(1000);
}
Explanation
- Reads both analog (A0) and digital (D2) signals from a sensor.
- Prints the values to the Serial Monitor every second.
- Helps monitor and test sensor activity in real time.
Troubleshooting
- Ensure the sensor is properly powered with 5V and GND connections.
- If values are not changing, try tapping or moving the sensor gently.
- Check the Serial Monitor baud rate is set to 9600 to view correct output.