Esp8266 Projects

Flood Monitoring System Using GSM And ESP8266

Flood Monitoring System Using ESP8266


In this article, we will explore the design and implementation of a Flood Monitoring System using various components such as a 16×2 LCD display with I2C, ultrasonic sensor, float sensor, and SIM800L module. This system aims to provide real-time flood level monitoring and alert notifications to receive Text Messages.

Components Needed








GSM module (SIM800l)



Ultrasonic Sensor



Float Sensor



16x2 LCD Display With I2C



Zero PCB



5v Power Supply



ESP8266 is a Wi-Fi module developed by Espressif Microcontroller Systems. In the board is a microcontroller unit And a built-in Wi-Fi Chip, It is the low-cost solution for Wi-Fi connectivity to various projects. gif maker

16×2 LCD Display

  • This is a basic 16-character by 2 lines Alphanumeric display. Black text on Green background. Utilises the extremely common HD44780 parallel interface chipset. Interface code is freely available.


GSM module (SIM800l)

GSM SIM800L is a popular module that enables communication over GSM (Global System for Mobile Communications) networks. It Sends a text message and calls to the particular Mobile Number. and is necessary to put a valid sim card in the gsm module.

Esp32 cam Motion Detection using Ultrasonic Sensor1

  • The module requires a power supply of 3.7 volts. It can be powered using an external Battery.

Ultrasonic Sensor

  • Ultrasonic sensors find out the distance of the water level of the dam. And the Sensor mount on the top of the dam.
  • Ultrasonic Sensor required a 5v power supply.


Float Sensor

Float sensors to detect Water levels. They consist of a float, on the water and when the water level increases the float mechanism goes to the Top and is given the alert information.


Specifications of Float Sensors

  • Cable Length: 30.(cm)
  • Maximum Load: 51 W
  • Max Switching Voltage: 90V DC
  • Minimum Voltage: 240V DC
  • Maximum Switching Current: 0.6 A
  • Max Load Current: 1.0 A

Circuit Diagram

Screenshot 2023 06 17 at 1.50.31 AM

Source Code 


Include Libraries

    • LiquidCrystal_I2C.h: Library for interfacing with the 16×2 LCD display using I2C.
    • NewPing.h: Library for working with the ultrasonic sensor.

Initialize Variables and Objects

    • Define the pins for the ultrasonic sensor (TRIGGER_PIN and ECHO_PIN) and the maximum distance to measure (MAX_DISTANCE).
    • Define the pin for the float sensor (FLOAT_SENSOR_PIN).
    • Create an instance of the SoftwareSerial library named “gsmSerial” using the RX and TX pins for the GSM module.
    • Define the flood threshold (FLOOD_THRESHOLD) in centimetres.
    • Define the phone numbers (phone numbers) to which alert SMS will be sent.

Setup Function

    • Initialize the LCD display with the I2C address (0x27) and the number of columns and rows (16, 2).
    • Initialize the GSM module with the defined baud rate.
    • Send AT commands to check communication with the GSM module and set the SMS text mode.

Loop Function

    • Read the distance from the ultrasonic sensor using the sonar.ping_cm() function.
    • Read the state of the float sensor using digitalRead(FLOAT_SENSOR_PIN).
    • Clear the LCD display and update it with the current water level.
    • Check if the flood level exceeds the defined threshold and the float sensor is triggered.
    • If the conditions are match, call the sendAlertSMS() function to send alert SMS to the predefined phone numbers.

sendAlertSMS Function

    • Create a message string with the flood alert information.
    • Iterate through each phone number in the phone numbers array.
    • Send AT commands to the GSM module to set the recipient phone number (AT+CMGS), delay, send the message, send the message termination character (char(26)), and delay again.

sendCommand Function

    • Send a command string to the GSM module using gsmSerial.println().
    • Check if there is any available data from the GSM module using gsmSerial.available() and read it using to clear the serial buffer.



This system enables early detection of floods, allowing authorities to take immediate action and mitigate potential risks. By leveraging the capabilities of these components, we can build an effective flood monitoring system to enhance disaster management and safeguard lives and property.

ESP8266 Related More Projects 


Hi, Prateek Here I’m interested in Electronics That's why I Make Soo Many Projects, I’m currently Pursuing M Tech.. if you Relay Like To My Blog Plz Comment Below...Thanks To All Electronics Lover...❤️

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker