Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Wireless Rain Alert System with Arduino and NRF24L01 Modules

View and Edit Project In Cirkit DesignerImage of Wireless Rain Alert System with Arduino and NRF24L01 Modules

Circuit Documentation

Summary

This circuit is designed to detect rain using a rain sensor and communicate the status wirelessly to an indoor unit using NRF24L01 transceiver modules. The outdoor unit consists of an Arduino Nano microcontroller connected to a rain sensor and an NRF24L01 module to send the rain detection signal. The indoor unit also uses an Arduino Nano microcontroller and an NRF24L01 module to receive the signal and activate a buzzer if rain is detected.

Component List

Rain Sensor

Arduino Nano (Outdoor Unit)

NRF24L01 (Outdoor Unit)

Buzzer

9V Battery (Outdoor Unit)

Arduino Nano (Indoor Unit)

NRF24L01 (Indoor Unit)

9V Battery (Indoor Unit)

Wiring Details

Rain Sensor

Arduino Nano (Outdoor Unit)

NRF24L01 (Outdoor Unit)

Buzzer

Arduino Nano (Indoor Unit)

NRF24L01 (Indoor Unit)

Documented Code

Arduino Nano (Outdoor Unit)

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 10); // CE, CSN pins
const byte address[6] = "00001"; // Communication address

const int rainSensorPin = 2; // Pin for rain sensor (DO)
bool isRaining;

void setup() {
  pinMode(rainSensorPin, INPUT);
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_LOW);
}

void loop() {
  isRaining = digitalRead(rainSensorPin) == LOW; // LOW means rain detected
  radio.write(&isRaining, sizeof(isRaining));  // Send rain status to indoor unit
  delay(1000); // Delay before next check
}

Arduino Nano (Indoor Unit)

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 10); // CE, CSN pins
const byte address[6] = "00001"; // Must match the address in the outdoor unit

const int buzzerPin = 3; // Pin for buzzer
bool isRaining;

void setup() {
  pinMode(buzzerPin, OUTPUT);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_LOW);
  radio.startListening();
}

void loop() {
  if (radio.available()) {
    radio.read(&isRaining, sizeof(isRaining));  // Read rain status
    if (isRaining) {
      digitalWrite(buzzerPin, HIGH);  // Turn on buzzer if rain is detected
    } else {
      digitalWrite(buzzerPin, LOW);   // Turn off buzzer if no rain
    }
  }
}