Community project

Rain Detection Location Alerts

Photo of Rain Detection Location Alerts
Generated with AI

Dan Rico

Published December 5, 2026

This project sends SMS alerts to a phone number whenever rain is detected at a monitored location. The system uses a rain sensor module to detect moisture, an Arduino Uno to process the signal, and a SIM800L GSM module to send text messages over cellular networks. The guide includes a complete wiring diagram, parts list with component values, and ready-to-upload firmware.

Builders will learn how to interface a rain sensor with an Arduino, communicate with a GSM modem via serial protocol, and implement debouncing logic to avoid false alerts. The battery-powered design with an 18650 Li-ion cell makes this suitable for remote outdoor installations where AC power is unavailable.

Wiring diagram

Wiring diagram for Rain Detection Location Alerts
Loading diagram…

Gather all the parts

QtyComponent
1

Rain Sensor Module

A rain sensor module consisting of a sensing pad with exposed copper traces and an LM393 comparator circuit. When water bridges the copper traces on the sensing pad, resistance decreases and conductivity increases. The module provides both an analog output (AO) proportional to water level and a digital output (DO) that goes LOW when water exceeds a threshold set by an onboard potentiometer. Includes power and status LEDs. Designed for detecting rain, slush, or hail in weather-responsive automation projects.

1

SIM800L GSM/GPRS Module

Compact GSM/GPRS module based on SIMCom SIM800L chip. Features a built-in SIM card slot and antenna connector. Communicates via UART using AT commands. Operates at 3.4V–4.4V supply (must NOT be powered from 3.3V LDO; use a boost converter such as MT3608). Peak current draw up to 2A during GSM TX bursts — requires external dedicated power supply with bulk decoupling capacitor (100–470uF). UART logic is nominally 2.8V; when driven by ESP32 (3.3V), a resistor voltage divider on the ESP32 TX → SIM800L RX line is required to shift 3.3V down to ~2.8V. Built-in SIM card slot and antenna port are physical features of the module PCB.

1

18650 Li-ion Cell

Protected 3.7 V cell, rated at least 2 A

18650 lithium-ion cell, nominal 3.7 V, ~2500 mAh. Common for higher-capacity portable / battery-bank style projects; needs a holder and protection / charger circuit.

1

18650 Holder

Single-slot 18650 holder rated at least 2 A

Generic holder for one or two removable 18650 Li-ion cells. It is a mechanical/electrical power holder, not a charger or protection circuit; pair with a charger/BMS and regulator appropriate to the cell count.

1

Resistor

4.7 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

5.6 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

74AHCT125 Quad Buffer / Level Shifter

Quad non-inverting buffer with 3-state outputs and active-low output enables, in a breadboard-friendly 14-pin DIP. Powered from 5 V, its TTL-level inputs accept 3.3 V logic, so it is a common one-way 3.3 V to 5 V level shifter for NeoPixel/WS2812 data and other fast digital signals; each output drives up to 8 mA.

1

Ceramic Capacitor

100 nF

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

1

Electrolytic Capacitor

470 µF, 10 V, low ESR

Radial aluminium electrolytic capacitor bought by value and voltage rating, such as 10 µF, 100 µF or 1000 µF 10 V. It is polarised: the + lead goes to the higher voltage and the - lead, marked by the stripe on the sleeve, to the lower voltage or ground. It is mostly used for bulk filtering across a power rail, with a voltage rating comfortably above the rail.

Assemble it in 3 steps

1. Wire the rain sensor with power off

Connect the sensing plate to its comparator board. Connect VCC to Uno 5V, GND to GND, and DO to D2. Adjust the module so DO goes low when you wet the plate.

2. Wire the modem signals

Use the two resistors as shown to lower the Uno transmit voltage. The 74AHCT125 raises the modem transmit voltage for the Uno. Put the 100 nF capacitor next to the buffer power pins.

3. Connect the two power sources

With USB unplugged and the holder empty, wire holder positive to modem VCC and holder negative to modem GND with short wires. Connect modem GND to Uno GND. Fit the capacitor close to the modem, stripe toward GND. Attach the antenna and insert an active 2G SMS SIM with PIN lock off. Use USB for the Uno and one protected cell for the modem. Disconnect both sources when done.

  • Never join the positive supplies or use a two-cell series holder. Do not charge the cell in this circuit; remove it and use a proper charger.

Review all connections

1. Connections between "rain" and "Arduino"

FunctionrainArduino
powerVCC5V
groundGNDGND
digitalDOGPIO 2

2. Connections between "cell" and "Arduino"

FunctioncellArduino
power+V → 18650 Holder BAT+EXT
groundGND → 18650 Holder BAT-EXT

3. Connections between "holder" and "Arduino"

FunctionholderArduino
powerBAT+ → SIM800L GSM/GPRS Module VCCEXT
groundBAT- → SIM800L GSM/GPRS Module GNDEXT

4. Connections between "modem" and "Arduino"

FunctionmodemArduino
groundGNDGND
uartTX → 74AHCT125 Quad Buffer / Level Shifter 1AEXT

5. Connections between "bulk" and "Arduino"

FunctionbulkArduino
power+ → SIM800L GSM/GPRS Module VCCEXT
ground- → SIM800L GSM/GPRS Module GNDEXT

6. Connections between "top" and "Arduino"

FunctiontopArduino
digitalP1GPIO 9
digitalP2 → SIM800L GSM/GPRS Module RXEXT

7. Connections between "bottom" and "Arduino"

FunctionbottomArduino
digitalP1 → SIM800L GSM/GPRS Module RXEXT
groundP2GND

8. Connections between "rxbuffer" and "Arduino"

FunctionrxbufferArduino
digital1YGPIO 8
ground1OEGND
powerVCC5V
groundGNDGND
power2OE5V
power3OE5V
power4OE5V
ground2AGND
ground3AGND
ground4AGND

9. Connections between "bypass" and "Arduino"

FunctionbypassArduino
digital1 → 74AHCT125 Quad Buffer / Level Shifter VCCEXT
digital2 → 74AHCT125 Quad Buffer / Level Shifter GNDEXT

Deploy the firmware

#include <Arduino.h>
#include <SoftwareSerial.h>
SoftwareSerial modem(8,9);
const char phone[] = "+639915938839";
bool waitFor(const char* token, unsigned long timeout) {
  size_t n=0;
  unsigned long start=millis();
  while(millis()-start<timeout) if(modem.available()) {
    char c=modem.read(); Serial.write(c);
    n=c==token[n]?n+1:(c==token[0]?1:0);
    if(!token[n]) return true;
  }
  return false;
}
bool sendAlert() {
  if(phone[1]=='Y') { Serial.println(F("Set phone in src/main.cpp first.")); return false; }
  while(modem.available()) modem.read();
  modem.println(F("AT")); if(!waitFor("OK",2000)) return false;
  modem.println(F("AT+CMGF=1")); if(!waitFor("OK",2000)) return false;
  modem.print(F("AT+CMGS=\"")); modem.print(phone); modem.println('"');
  if(!waitFor(">",5000)) return false;
  modem.print(F("Rain alert: water detected.")); modem.write(26);
  return waitFor("+CMGS:",60000);
}
void setup(){ pinMode(2,INPUT); Serial.begin(9600); modem.begin(9600); }
void loop(){
  static bool previous=false, attempted=false, latched=false;
  static unsigned long changed=0,last=0;
  bool wet=digitalRead(2)==LOW;
  auto now=millis();
  if(wet!=previous){previous=wet; changed=now;}
  if(!wet && now-changed>=5000) {latched=false; attempted=false;}
  if(wet && !latched && now-changed>=2000 && now>=15000 && (!attempted || now-last>=60000)){
    attempted=true;
    latched=sendAlert(); last=millis();
    Serial.println(latched?F("SMS accepted by modem"):F("SMS not confirmed"));
  }
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik