Index
Introduction
The Raindrop Sensor is used to detect rainfall using a rain-sensing board and a control module.
The sensor provides both analog and digital outputs, which the ESP32-S3 can read to determine rain intensity or presence.
It is commonly used in automatic wiper systems, agricultural irrigation, and home automation for smart weather response.
Required Components
- ESP32-S3 Board
- Rain Drop Sensor
- Jumper wires
- Breadboard
Pinout

Circuit Diagram / Wiring
- Rain Sensor VCC → VIN (ESP32-S3)
- Rain Sensor GND → GND (ESP32-S3)
- Rain Sensor DO → 14 (ESP32-S3)
- Rain Sensor AO → 13 (ESP32-S3)

Code / Programming
/*
Filename: ESP32-S3_raindrop_sensor.ino
Description: Reads analog and digital values from a raindrop sensor using ESP32-S3.
Digital pin reports rain detection. Analog pin gives intensity.
Author: www.oceanlabz.in
Modification Date: 1/4/2025
*/
// Define sensor pins
const int analogPin = 13; // Use an ADC1-compatible analog pin on ESP32-S3
const int digitalPin = 14; // Digital output pin from the sensor
void setup() {
Serial.begin(115200); // Start serial communication at 115200 baud
pinMode(digitalPin, INPUT); // Set digital pin as input
Serial.println("Raindrop Sensor Initialized");
}
void loop() {
int analogValue = analogRead(analogPin); // Read analog value
int digitalValue = digitalRead(digitalPin); // Read digital output
Serial.print("Analog Value: ");
Serial.print(analogValue);
Serial.print(" | Digital Value: ");
Serial.println(digitalValue == LOW ? "Rain Detected" : "No Rain");
delay(1000); // Delay before next reading
}
Explanation
- The sensor detects the presence and intensity of rain using a conductive surface that changes resistance when wet.
- The analog pin on ESP32-S3 measures moisture level, while the digital pin detects rain presence (HIGH = dry, LOW = wet).
- This setup is ideal for automating actions like alerts, wipers, or irrigation during rainfall.
Troubleshooting
- Analog Value Always 0 or 4095: Ensure the sensor’s analog pin is connected to an ADC1-compatible GPIO (e.g., GPIO13) and the board is powered with at least 3.3V.
- Digital Output Always HIGH or LOW: Adjust the sensitivity potentiometer on the sensor module to detect correct rain levels.
- No Serial Output: Make sure Serial Monitor baud rate is set to 115200, and the correct COM port is selected in the Arduino IDE.