Interface Rain Detector Sensor With Arduino Nano

To interface a rain drop detection sensor with an Arduino Nano and glow an LED when rain is detected, follow these steps:

🧰 Components Needed:

  • Arduino Nano
  • Rain Drop Sensor Module (usually comes with a rain board + control board)
  • LED
  • 220Ω resistor
  • Jumper wires
  • Breadboard (optional)

🔌 Wiring Details:

The Rain Drop Sensor Module typically has:

  • VCC – Connect to 5V on Nano
  • GND – Connect to GND on Nano
  • DO (Digital Output) – Connect to D2 on Nano (detects presence of rain)
  • (Optional: AO (Analog Output) – for analog values of water level)

LED Circuit:

  • Connect anode (long leg) of LED to D3 via a 220Ω resistor
  • Connect cathode (short leg) of LED to GND

💻 Arduino Code:

const int rainSensorPin = 2; // Digital output from rain sensor
const int ledPin = 3;        // LED connected to D3

void setup() {
  pinMode(rainSensorPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  int rainDetected = digitalRead(rainSensorPin);

  if (rainDetected == LOW) {
    // Rain detected (depends on sensor logic)
    digitalWrite(ledPin, HIGH); // Turn LED on
  } else {
    digitalWrite(ledPin, LOW);  // Turn LED off
  }

  delay(100); // Optional debounce
}

⚠️ Note: Some modules output LOW when rain is detected, others output HIGH. You might need to invert the logic depending on your module. You can test with Serial.println(rainDetected); to confirm.