Introduction
Floods are among the most devastating natural disasters, causing loss of life, property damage, and environmental destruction. A Smart Flood Monitoring System uses sensors and IoT technology to monitor water levels in rivers, dams, or low-lying areas in real time.
The system alerts authorities and residents early, enabling timely preventive actions and reducing flood-related damages.
Objective of the Project
- To monitor water levels in real time
- To send early warnings before flooding occurs
- To enable remote monitoring via IoT
- To support disaster management and minimize damage
Working Principle
- Water level sensors detect the depth of water
- Microcontroller reads the sensor data
- If water exceeds a preset threshold, buzzer and alarm are activated
- Data is sent to cloud via Wi-Fi for remote monitoring
- Optional: SMS or mobile app alerts to residents and authorities
Components Required
- ESP32 / NodeMCU (ESP8266)
- Water Level Sensor / Ultrasonic Sensor / Float Sensor
- Buzzer / Alarm
- Relay Module (optional for gates or pumps)
- Power Supply
- IoT Platform (ThingSpeak / Blynk / Firebase)
Block Diagram
Water Level Sensor
↓
ESP32 / NodeMCU
↓
Buzzer / Relay
↓
Wi-Fi
↓
Cloud Platform
Circuit Connections (ESP32 Example)
Ultrasonic Sensor (HC-SR04)
VCC → 5V
GND → GND
Trig → GPIO27
Echo → GPIO26
Buzzer
+ → GPIO25
- → GND
Relay (Optional Pump/Gate)
IN → GPIO33
VCC → 5V
GND → GND
IoT Arduino Code (Smart Flood Monitoring System)
#include <WiFi.h>
#include "ThingSpeak.h"
#include <NewPing.h>
#define TRIG_PIN 27
#define ECHO_PIN 26
#define MAX_DISTANCE 200 // cm
#define buzzer 25
WiFiClient client;
unsigned long channelID = 123456;
const char* writeAPIKey = "YOUR_API_KEY";
const char* ssid = "Your_WiFi";
const char* password = "Your_Password";
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
void setup() {
Serial.begin(9600);
pinMode(buzzer, OUTPUT);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
ThingSpeak.begin(client);
}
void loop() {
delay(1000);
unsigned int distance = sonar.ping_cm();
Serial.print("Water Level Distance: ");
Serial.println(distance);
// Threshold for flood detection
if (distance < 20) { // Less than 20 cm from sensor = high water
digitalWrite(buzzer, HIGH); // Alert
} else {
digitalWrite(buzzer, LOW);
}
// Send data to cloud
ThingSpeak.setField(1, distance);
ThingSpeak.writeFields(channelID, writeAPIKey);
delay(15000); // Update every 15 seconds
}
Code Explanation
- Ultrasonic sensor measures water distance from top of sensor
- ESP32 compares distance with threshold to detect flooding
- Buzzer alerts locally if water level is high
- IoT cloud provides remote monitoring and logging
Advantages
- Early flood warning system
- Real-time monitoring
- Can prevent property damage and save lives
- IoT-based remote accessibility
Applications
- River and dam monitoring
- Urban low-lying areas
- Industrial flood prevention
- Smart city water management
Future Enhancements
- SMS or app notification alerts
- Automatic water pump activation
- AI-based flood prediction
- Integration with municipal emergency systems
Conclusion
The Smart Flood Monitoring System is a critical project for disaster management and smart city solutions. By using IoT and sensors, it provides real-time monitoring, early warning, and quick response, minimizing flood-related damages.
