Arduino Flood Water Level Alert System

Arduino Flood Water Level Alert System: Robotics Project for Kids | MakeMindz
Arduino Nano Project · Beginner Friendly

A Sensor That Watches Water Levels — and Warns Before It Floods

This little device bounces sound waves off the water below it to measure how high it has risen. As the level climbs, it lights up green, then yellow, then red — and if things get critical, it sounds a buzzer and sends a text message, just like a real flood warning system.

Ages 9–14 with adult help for wiring
~2.5 hrs build time
₹1,400–1,600 total parts cost
HC-SR04 G Y R Water Level Rising SMS alert sent to parent

What This Alert System Can Do

An Arduino Nano runs the whole system. An ultrasonic sensor — the same kind of sensor bats and submarines use — measures the distance down to the water's surface, so the Arduino always knows exactly how high the water has risen.

  • Measures water level continuously using sound-wave distance sensing.
  • Shows a traffic-light status with green (safe), yellow (rising) and red (danger) LEDs.
  • Sounds a buzzer the moment water reaches the critical threshold.
  • Sends an SMS alert through a GSM module, so help can be called even without Wi-Fi.

Parts You'll Need

Everything here is easy to find online or at a local electronics store.

🧠

Arduino Nano

Reads the sensor, controls the LEDs and triggers the SMS alert.

₹450
📏

HC-SR04 Ultrasonic Sensor

Measures distance to the water surface using sound waves.

₹100
🚦

Green, Yellow & Red LEDs

A simple traffic-light display for water level status.

₹30
🔔

Buzzer

Sounds a loud alarm when the water level turns critical.

₹30
📶

SIM800L GSM Module

Sends a real SMS text alert to a phone, no internet needed.

₹500
📳

Activated SIM Card

Any basic SIM with an active plan works for sending SMS.

—
⚡

Dedicated 4V Power Supply

A separate regulated supply just for the power-hungry SIM800L.

₹200
🧵

Resistors & Jumper Wires

220Ω resistors for each LED, plus wiring for the whole circuit.

₹100

Build It Step by Step

Build and test on a breadboard first, somewhere dry, before mounting the sensor near any water.

Gather parts and plan the mount

The HC-SR04 needs to face straight down at the water from above — plan a mounting point like a bracket over a tank or drain, well clear of the water itself.

Wire the ultrasonic sensor

Connect the HC-SR04's Trig and Echo pins to two digital pins on the Arduino Nano, and power it from 5V.

Wire the LED indicators

Connect the green, yellow and red LEDs, each through its own 220Ω resistor, to three digital pins.

Tip: the longer leg of each LED is positive — it connects toward the Arduino pin, not toward ground.

Add the buzzer

Wire the buzzer to a spare digital pin so it can sound an alarm the moment the water reaches the red zone.

Wire the GSM module

Connect the SIM800L to its own 3.7-4.2V power supply — never the Arduino's 5V pin — since it can briefly draw up to 2A while sending a message.

Important: share a common ground between the Arduino and the SIM800L's power supply, but never share the 5V line. Powering SIM800L from the Arduino can cause it to brown out and restart.

Upload the code

Install the Arduino IDE's SoftwareSerial support (built in), insert an activated SIM card into the SIM800L, and upload the sketch from the code section below.

Mount and test safely

Mount the sensor above the water source and test each alert level by slowly raising a cup of water underneath it — never test near a real flood risk.

Circuit Diagram

Here's how every part connects back to the Arduino Nano, with the GSM module on its own separate power line.

Arduino Nano HC-SR04 Ultrasonic Sensor LED Trio Green / Yellow / Red Buzzer Critical-level alarm SIM800L GSM Module 4V Supply Powers SIM800L only shared GND only Active SIM Inserted in SIM800L
ModuleModule PinArduino Nano Pin
HC-SR04 Ultrasonic SensorTrigD9
EchoD8
Green LEDAnode (via resistor)D4
Yellow LEDAnode (via resistor)D5
Red LEDAnode (via resistor)D6
BuzzerSignal pinD7
SIM800L GSM ModuleRX (via voltage divider)D3
TXD2
VCC / GNDDedicated 4V supply / shared GND

Arduino Code

This sketch uses the built-in SoftwareSerial library to talk to the SIM800L with simple AT commands.

flood_water_alert.ino
// ===== FLOOD WATER LEVEL ALERT SYSTEM =====
// Measures water level with an ultrasonic sensor,
// shows a traffic-light status, and texts an alert
// when the water level turns critical.

#include <SoftwareSerial.h>

// ---- Pins ----
#define TRIG_PIN   9
#define ECHO_PIN   8
#define LED_GREEN  4
#define LED_YELLOW 5
#define LED_RED    6
#define BUZZER     7

SoftwareSerial sim800(2, 3); // RX, TX to the GSM module

// ---- Tank settings (change these to match your setup) ----
const int TANK_HEIGHT_CM   = 100; // distance from sensor to tank bottom
const int YELLOW_LEVEL_CM  = 60;  // water level that triggers "rising"
const int RED_LEVEL_CM     = 85;  // water level that triggers "danger"
String alertNumber = "+91XXXXXXXXXX"; // phone number to text

bool alertSent = false;

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

  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
  pinMode(LED_GREEN, OUTPUT);
  pinMode(LED_YELLOW, OUTPUT);
  pinMode(LED_RED, OUTPUT);
  pinMode(BUZZER, OUTPUT);

  Serial.println("System starting...");
  delay(2000); // give the SIM800L time to register on the network
}

void loop() {
  int waterLevelCM = readWaterLevel();
  Serial.print("Water level: ");
  Serial.print(waterLevelCM);
  Serial.println(" cm");

  updateIndicators(waterLevelCM);
  delay(2000);
}

int readWaterLevel() {
  digitalWrite(TRIG_PIN, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);

  long duration = pulseIn(ECHO_PIN, HIGH);
  int distanceToWater = duration * 0.034 / 2; // convert echo time to cm

  return TANK_HEIGHT_CM - distanceToWater; // how high the water has risen
}

void updateIndicators(int level) {
  digitalWrite(LED_GREEN, LOW);
  digitalWrite(LED_YELLOW, LOW);
  digitalWrite(LED_RED, LOW);
  digitalWrite(BUZZER, LOW);

  if (level >= RED_LEVEL_CM) {
    digitalWrite(LED_RED, HIGH);
    digitalWrite(BUZZER, HIGH);
    if (!alertSent) {
      sendSMS("FLOOD ALERT: Water level is critical!");
      alertSent = true;
    }
  } else if (level >= YELLOW_LEVEL_CM) {
    digitalWrite(LED_YELLOW, HIGH);
    alertSent = false; // reset so a new alert can fire if it rises again
  } else {
    digitalWrite(LED_GREEN, HIGH);
    alertSent = false;
  }
}

void sendSMS(String message) {
  sim800.println("AT+CMGF=1");       // set SMS text mode
  delay(300);
  sim800.print("AT+CMGS=\"");
  sim800.print(alertNumber);
  sim800.println("\"");
  delay(300);
  sim800.print(message);
  delay(300);
  sim800.write(26); // Ctrl+Z sends the message
  delay(1000);
  Serial.println("SMS alert sent");
}

Troubleshooting

Most issues trace back to the sensor's mounting angle or the GSM module's power supply — here's what to check.

🌊 Readings jump around wildly

Mount the HC-SR04 pointing straight down, not at an angle — tilted sensors bounce sound waves away instead of straight back.

📵 SIM800L won't send SMS

Check the SIM card has an active plan with SMS credit, and that it isn't PIN-locked — remove the PIN using a phone first.

🔌 SIM800L keeps restarting

This almost always means its power supply can't deliver enough current. Add a large capacitor (1000µF) across its power pins to handle transmission spikes.

🚦 LEDs never change color

Double-check YELLOW_LEVEL_CM and RED_LEVEL_CM are set correctly for your tank's actual height.

🔇 Buzzer stays silent

Make sure it's an active buzzer (built-in oscillator) — passive buzzers need a tone signal, not a simple HIGH/LOW.

📨 Multiple texts for one flood

This is expected behavior reset — the code only resends once the level drops back below yellow and rises again, to avoid spamming the same alert.

Fun Upgrades to Try

📊 Log water levels over time to spot rising trends early
☎️ Add a phone call alert alongside the SMS for urgent cases
🔆 Add a bright strobe light for night-time flood warnings
📡 Swap SIM800L for Wi-Fi and push alerts to a phone app
☀️ Run it off a small solar panel for outdoor, off-grid use

Frequently Asked Questions

Is it safe for a 9-year-old to build this near water?

The build and testing should happen away from real water, using a small cup to simulate rising levels. Only an adult should mount and test the finished device near an actual water source like a tank or drain.

Why can't the SIM800L share power with the Arduino?

The SIM800L can briefly pull up to 2A while transmitting, which is far more than the Arduino's 5V pin can safely supply — sharing power usually causes both the Arduino and the GSM module to reset.

Does this need an internet connection?

No — the SIM800L sends SMS messages the same way a basic mobile phone does, over the regular cellular network, so it works even where there's no Wi-Fi.

Can I use this for a fish tank or rain barrel instead?

Yes — it works for any container. Just update TANK_HEIGHT_CM, YELLOW_LEVEL_CM and RED_LEVEL_CM in the code to match the container's actual measurements.

What if I don't have a SIM card to spare?

You can skip the SIM800L entirely and keep just the LED and buzzer alerts — the water level monitoring and visual warnings will still work on their own.

MakeMindz

Hands-on robotics projects for curious kids.

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
★★★★★ Young inventors love it!
🖨️
3D Print
All parts
⚡
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 ₹300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
★★★★★ Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 ₹200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course