Skip to content
My Account

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.

  • Analog and digital output
  • LM393 comparator
  • 3.3 to 5 V
  • Adjustable threshold
No ratings yet, be the first.

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.

The details in this guide come from the common documentation of the MH-RD module. I did not read a datasheet for this update, and boards from different sellers vary.

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.
MH-RD raindrop detection module, sensor plate and signal conditioning board

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.
MH-RD pinout and wiring diagram
PinLabelDescription
1AOAnalog output signal (variable)
2DODigital output signal (0 or 1)
3GNDGround
4VCCPower supply (3.3V to 5V)

Dimensions

The MH-RD set has two boards: a sensor plate of about 5 × 4 cm with copper traces, and a small blue comparator board with the LM393 and a potentiometer. The two are joined by a two-wire cable. Sizes vary between sellers, so measure yours before you design a mount. Mount the plate at a slight angle so water runs off.

Source: the details come from the existing text of this guide and common practice, not from a datasheet read for this update.

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 PinESP32 Pin
AOGPIO34
DOGPIO26
GNDGND
VCC3.3V

GPIO34 is input-only on the ESP32, which is exactly what an analog read needs here.

MH-RD wiring diagram

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.

Real gotchas

  • The plate corrodes. The traces are bare copper with a voltage across them, so water makes them rust and the plate wears out. Power the sensor only when you measure, and replace the plate now and then.
  • Check the direction of the analog output. This guide describes the voltage rising when the plate gets wet, but some boards do the opposite. Measure yours dry and wet before you write the code.
  • The digital output is a comparator. The trimmer sets the threshold. Turn it until the LED switches in the conditions you want.
  • It is not an accurate rain gauge. It senses water on the plate, not the amount of rain.
  • Use an ADC1 pin on the ESP32. ADC2 does not work while Wi-Fi is on.
  • Keep the electronics dry. Only the plate goes outside. The blue board must be in a box.
  • Dew and frost trigger it. Morning dew counts as rain. Add a heater or a time filter if that matters.
  • The supply is 3.3 to 5 V. The analog value scales with the supply.

Safety notes

Before you wire anything up

  • Keep the supply at 3.3 to 5 V and the electronics dry.
  • A rain sensor is not a safety device. Do not use it as the only control for something that can cause damage, like a roof hatch.
  • Never connect the board to mains voltage. Keep it on a low-voltage supply.
  • Disconnect the power before you change the wiring.

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.

Advertisement
All guides

More guides

Keep building.

From ESP32 HomeKit accessories to Arduino and ATtiny reference guides, there’s more where this came from.

All guides