Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino Rain Sensor Module: Flood Detection States | ShillehTek

July 26, 2026

Arduino Rain Sensor Module: Flood Detection States | ShillehTek
Project

Build an Arduino rain sensor module project that reads A0 and classifies Not Raining, Rain Warning, or Flood for quick water detection with ShillehTek.

30 min Beginner3 parts

Project Overview

Arduino rain sensor module: In this guide you use an Arduino (Nano or any compatible board) with a raindrop sensor module to detect surface water and classify conditions as Not Raining, Rain Warning, or Flood on the Serial Monitor.

A rain sensor (often called a raindrops module) detects actual water on a surface, which a humidity sensor cannot do. The sensing board is a grid of printed traces that acts like a variable resistor: around 2 MΩ when bone-dry, dropping to roughly 100 kΩ when wet. The wetter the board, the more current flows.

  • Time: 30 minutes
  • Skill level: Beginner
  • What you will build: A rain detector that classifies dry, drizzle, and downpour on the Serial Monitor.
Arduino connected to a rain sensor detection board and comparator module for water detection
The rain sensor module: detection board plus comparator board.

Parts List

From ShillehTek

External

  • A little water for testing

Note: The module has two outputs: A0 (analog level) and D0 (digital threshold with onboard LED). This guide uses the analog output (A0) for graded detection.

Step-by-Step Guide

Step 1 - Get to Know the Module

Goal: Identify the pins and what each one does before wiring.

What to do: The comparator board exposes four pins: A0 (analog out), D0 (digital out), GND, and VCC. It also has two loop pins (+/-) that connect to the separate sensing board. The detection board itself is about 5.5 x 4.0 cm and works by letting water bridge its printed leads.

What to do: For analog use, power the module from 5V. If you only use the digital output (D0), 3.3V is typically fine.

Rain sensor comparator module showing A0, D0, GND, VCC pins and loop pins to the sensing plate
Four pins go to the Arduino, and two loop pins go to the detection board.

Expected result: You can identify A0, D0, GND, VCC, and the two hookups for the sensor board.

Step 2 - Bench-Test It First

Goal: Confirm the sensor and comparator board are working before uploading code.

What to do: Power the module (VCC to 5V, GND to GND) and drip a few water droplets on the detection board. The D0 LED should light.

What to do: If it does not light, recheck the hookup, try slightly salty water (very pure water conducts poorly), and inspect solder joints on the small SMD parts (a known weak point on some batches). If none of that helps, the unit may be defective.

Rain sensor detection board with water droplets while the comparator board D0 LED is lit
Droplets on the board should trigger the D0 LED.

Expected result: The D0 LED responds when you add water to the sensing board.

Step 3 - Wire It to the Arduino

Goal: Connect the analog output so the Arduino can read rain intensity.

What to do: Make these five connections:

Module VCC -> Arduino 5V
Module GND -> Arduino GND
Module A0  -> Arduino A0
Module (+) -> sensing board (+)
Module (-) -> sensing board (-)
Arduino wired to a rain sensor module with analog output connected to A0 and loop pins connected to the sensing plate
Connect analog out to A0, and connect the loop pins to the detection board.

Expected result: The sensing board is connected through the comparator board to the Arduino, with A0 feeding Arduino A0.

Step 4 - Upload the Three-State Sketch

Goal: Read the analog value (0 to 1023) and label it as Not Raining, Rain Warning, or Flood.

What to do: Upload the sketch below (after Reichenstein7's example). It reads analog A0 and maps the sensor range into three zones: soaked board prints Flood, droplets print Rain Warning, and dry prints Not Raining.

// Rain sensor three-state example (after Reichenstein7)
const int sensorMin = 0;     // sensor minimum
const int sensorMax = 1024;  // sensor maximum

void setup() {
  Serial.begin(9600);
}

void loop() {
  // read the sensor on analog A0:
  int sensorReading = analogRead(A0);
  // map the range to three zones:
  int range = map(sensorReading, sensorMin, sensorMax, 0, 3);

  switch (range) {
    case 0:    // board is soaked
      Serial.println("Flood");
      break;
    case 1:    // droplets on the board
      Serial.println("Rain Warning");
      break;
    case 2:    // board is dry
      Serial.println("Not Raining");
      break;
  }
  delay(1);
}

In a real deployment you would typically stop printing the "Not Raining" state and act only on the two alert states, like closing a window actuator, retracting an awning, or pushing a notification.

Arduino Serial Monitor output showing Not Raining, Rain Warning, and Flood as the rain sensor board gets wetter
Live classification on the Serial Monitor as the board gets wetter.

Expected result: The Serial Monitor flips between "Not Raining", "Rain Warning", and "Flood" as you wet and dry the sensing board.

Conclusion

You built an Arduino rain sensor project using a raindrop sensor module, verified the hardware, wired the analog output to A0, and used a sketch to classify rain as Not Raining, Rain Warning, or Flood in real time.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.

Photo credit: images referenced from Instructables (original guide by Reichenstein7).