

The Rain Sensor MH Series is a versatile electronic component designed to detect moisture levels caused by rainfall. It is commonly used in applications where automatic activation or deactivation of devices is required based on the presence of rain. This sensor is widely utilized in irrigation systems, automatic windshield wipers, weather monitoring systems, and smart home automation projects. Its simple design and ease of integration make it a popular choice for both hobbyists and professionals.








| Pin Name | Description |
|---|---|
| VCC | Power supply input (3.3V to 5V DC) |
| GND | Ground connection |
| AO | Analog output pin, provides a voltage proportional to the moisture level |
| DO | Digital output pin, outputs HIGH or LOW based on the adjustable threshold |
| Pin Name | Description |
|---|---|
| S | Signal pin, connects to the control module for moisture detection |
| + | Power supply input, connects to VCC on the control module |
| - | Ground connection, connects to GND on the control module |
S, +, and - pins of the sensor board to the corresponding pins on the control module.Below is an example of how to use the Rain Sensor MH Series with an Arduino UNO to monitor rainfall and display the results in the Serial Monitor.
// Define pin connections
const int digitalPin = 2; // Digital output from the sensor
const int analogPin = A0; // Analog output from the sensor
void setup() {
pinMode(digitalPin, INPUT); // Set digital pin as input
Serial.begin(9600); // Initialize serial communication
}
void loop() {
// Read digital output (HIGH or LOW)
int digitalValue = digitalRead(digitalPin);
// Read analog output (0-1023)
int analogValue = analogRead(analogPin);
// Display the results in the Serial Monitor
Serial.print("Digital Output: ");
Serial.println(digitalValue); // 1 = No rain, 0 = Rain detected
Serial.print("Analog Output: ");
Serial.println(analogValue); // Higher value = Less moisture
delay(1000); // Wait for 1 second before the next reading
}
No Output Detected:
Inconsistent Readings:
Corrosion on the Sensor Board:
Q: Can the Rain Sensor MH Series be used outdoors?
A: Yes, but it is recommended to use a protective enclosure or coating to prevent corrosion and damage from prolonged exposure to water.
Q: How do I know if the sensor is detecting rain?
A: The digital output pin (DO) will go LOW when rain is detected. Additionally, the analog output pin (AO) will provide a lower voltage as the moisture level increases.
Q: Can I use this sensor with a 3.3V microcontroller?
A: Yes, the Rain Sensor MH Series is compatible with both 3.3V and 5V systems.
Q: What is the maximum distance between the sensor board and the control module?
A: It is recommended to keep the distance as short as possible (less than 1 meter) to avoid signal degradation.
By following this documentation, you can effectively integrate the Rain Sensor MH Series into your projects and ensure reliable performance.