Reference
MH-RD Raindrop Detection Module
A low-cost rain sensor built from two boards: a copper-trace sensor plate and an LM393 comparator breakout. Covers the pinout, how the analog/digital outputs behave when the plate gets wet, and wiring it to an ESP32 or Arduino.
Whether you’re building an automated greenhouse, a smart irrigation system, or want to detect the first drops of rain on a weather station, the Raindrop Detection Module (MH-RD) is a straightforward sensor for the job. This guide covers its pinout, how it works, and how to wire it into a real ESP32 or Arduino project.
What is the Raindrop Detection Module?
The MH-RD rain sensor is a low-cost module designed to detect water presence. It consists of two boards:
- Sensor plate (rain board): a PCB with exposed parallel copper traces. When raindrops land on the board, they create a conductive path between the traces, allowing current to flow. More water means lower resistance.
- Signal conditioning board: the blue breakout board, carrying an LM393 voltage comparator, a sensitivity potentiometer, digital and analog outputs, and indicator LEDs. It converts the sensor plate’s analog signal into a clean digital output.

It’s used in rain alarms, automatic window closers, agricultural automation, smart weather stations, and DIY car-windshield sensors.
Key Features
- Analog output (AO): a voltage relative to how wet the plate is.
- Digital output (DO): high or low, depending on a threshold set by the onboard potentiometer.
- Onboard LM393 comparator: drives the digital switching logic.
- LED indicators: power and digital-output status.
- Voltage range: 3.3V-5V, compatible with ESP32, Arduino and Raspberry Pi.
- Mounting holes: for fixing it in an outdoor enclosure.
| Pin | Label | Description |
|---|---|---|
| 1 | AO | Analog output signal (variable) |
| 2 | DO | Digital output signal (0 or 1) |
| 3 | GND | Ground |
| 4 | VCC | Power supply (3.3V to 5V) |
How It Works
Dry condition: no water between the copper traces means high resistance, a low analog voltage, and a digital output that reads HIGH (no rain).
Wet condition: water bridges the traces, resistance drops, analog voltage rises, and the digital output goes LOW (rain detected). The onboard potentiometer sets the threshold at which the digital output flips.
Wiring It to an ESP32
| MH-RD Pin | ESP32 Pin |
|---|---|
| AO | GPIO34 |
| DO | GPIO26 |
| GND | GND |
| VCC | 3.3V |
GPIO34 is input-only on the ESP32, which is exactly what an analog read needs here.
Sample Arduino code
#define RAIN_ANALOG 34
#define RAIN_DIGITAL 26
void setup() {
Serial.begin(115200);
pinMode(RAIN_DIGITAL, INPUT);
}
void loop() {
int analogValue = analogRead(RAIN_ANALOG);
int digitalValue = digitalRead(RAIN_DIGITAL);
Serial.print("Analog: ");
Serial.print(analogValue);
Serial.print(" | Digital: ");
Serial.println(digitalValue ? "Dry" : "Rain Detected");
delay(500);
}Practical Applications
- Smart weather station: log rainfall events to a dashboard via ESP32 or ESP8266.
- Auto window closer: trigger a relay or motor to shut a window when rain is detected.
- Irrigation system: pause watering when it’s already raining, to save water.
- Home automation: combine with a temperature/humidity sensor for full weather-aware automation.
Best Practices and Tips
- Corrosion: prolonged outdoor use oxidizes the sensor plate. Use a conformal coating, or replace the plate periodically.
- Positioning: angle the plate slightly so water doesn’t pool on it.
- Debouncing: add software debouncing to filter out false triggers from splashes or brief contact.
- Protection: enclose the electronics, not the plate, in a waterproof (IP65-rated) box.
Conclusion
The MH-RD is an accessible sensor for beginners and experienced makers alike: simple wiring, both analog and digital outputs, and onboard comparator logic. Paired with an ESP32, it’s enough to protect a window, garden, or greenhouse from unpredictable rain.
Related
Guide
ESP8266-01 Pinout
The complete pin reference for the ESP8266-01 breakout: just 8 pins, only 2 usable GPIOs, and no onboard USB, so wiring it up needs a bit more care than a dev board.
Read more
Guide
ATtiny 0/1/2-Series Pinout
The complete pin reference for Microchip’s modern ATtiny 0/1/2-series: true USART, SPI and I2C peripherals, and single-wire UPDI programming instead of classic ISP.
Read more
Guide
AI-C3 Pinout
The complete pin reference for the AI-C3: a compact ESP32-C3-MINI-1 dev board with a USB-C port, onboard RGB LED, and 22 usable GPIOs.
Read more
More guides
Keep building.
From ESP32 HomeKit accessories to Arduino and ATtiny reference guides, there’s more where this came from.
All guides