Floods pose a significant threat to communities, infrastructure, and the environment. Timely and accurate flood monitoring is crucial for early warning and effective disaster management. In this context, Internet of Things (IoT) technologies offer a promising solution. This project introduces an IoT-based flood monitoring system using ESP32 and Ultrasonic Sensor to provide real-time data for flood detection and management.


The primary objectives of this project are:

  • Develop a cost-effective and efficient flood monitoring system.
  • Utilize IoT technologies to enable remote monitoring and data collection.
  • Implement real-time data transmission to a central server or cloud platform.
  • Integrate ultrasonic sensors for accurate water level measurements.

Components Required

Creating an IoT-based flood monitoring system using an ESP32 and ultrasonic sensor involves combining hardware and software components. Below is a basic outline of the steps you can follow to build such a system:

Hardware Components:

  1. ESP32 Board:
    • Choose a suitable ESP32 development board. Common options include NodeMCU ESP-32 or ESP-WROOM-32.
  2. Ultrasonic Sensor:
    • Use an ultrasonic sensor like the HC-SR04. This sensor measures distance by emitting ultrasonic waves and calculating the time it takes for the waves to bounce back.
  3. Power Supply:
    • Provide power to the ESP32 board. This can be done using a USB cable or a battery depending on your deployment scenario.
  4. Connecting Wires:
    • Use jumper wires to connect the ESP32 pins to the ultrasonic sensor according to the datasheets.

PCB Manufacturer

PCBWAY is a highly skilled company specializing in PCB manufacturing. They offer their services at incredibly low prices, such as providing 10 PCBs for only $5. Additionally, new members receive a $5 bonus. The website allows customers to upload their Gerber Files and place orders.


PCBWAY is known for producing PCBs of exceptional quality and maintaining high standards, which is why many people trust them for their PCB and PCBA

Below are some of my PCB’S manufactured by PCBWAY and I am fully satisfied by their Quality of service they provide

Working Principle

  1. Mounting the Ultrasonic Sensor: The ultrasonic sensor is mounted at a specific location where you want to monitor the water level. It should be positioned in such a way that it doesn’t get submerged during normal conditions but can measure the distance to the water surface when flooding occurs.
  2. Distance Measurement: The ultrasonic sensor emits an ultrasonic pulse, and the time taken for the pulse to return is used to calculate the distance between the sensor and the water surface. This distance is directly related to the water level.
  3. ESP32 Data Processing: The ESP32 reads the distance data from the ultrasonic sensor and processes it. It might filter out noise, apply calibration factors, or perform other necessary computations.
  4. Data Transmission: Once the water level data is processed, the ESP32 uses its Wi-Fi capability to connect to the internet. It sends the water level information to a central server or a cloud platform.
  5. Cloud Server: The central server or cloud platform collects and stores the incoming data. This server can be accessed remotely for real-time monitoring or historical analysis.
  6. Alerts and Notifications: The system can be configured to send alerts or notifications if the water level exceeds a predefined threshold. This could be done through emails, SMS, or other communication channels.
  7. Visualization and Analysis: The data collected over time can be visualized on a dashboard for monitoring purposes. Historical data can be analyzed to identify patterns or trends in water level changes.

By combining the ESP32, ultrasonic sensor, and internet connectivity, this IoT-based flood monitoring system provides a cost-effective and efficient way to monitor water levels in real-time and take appropriate actions in the event of a flood


Here’s a basic wiring setup:

  • Connect VCC and GND of the ultrasonic sensor to the 3.3V and GND pins of the ESP32.
  • Connect the Trig pin of the ultrasonic sensor to a GPIO pin on the ESP32 .
  • Connect the Echo pin of the ultrasonic sensor to another GPIO pin on the ESP32 .

Software Development:

  1. Arduino IDE Setup:
    • Install the Arduino IDE on your computer.
  2. ESP32 Board Support:
    • Add support for the ESP32 board in the Arduino IDE.
      • Open Arduino IDE.
      • Go to File -> Preferences.
      • Enter into the “Additional Boards Manager URLs” field.
      • Open the Boards Manager (Tools -> Board -> Boards Manager), search for “esp32” and install the package.
  3. Install Required Libraries:
    • Install the required libraries for the ESP32 and ultrasonic sensor.
      • For the ultrasonic sensor, you can use the “NewPing” library.
  4. Programming the ESP32:
    • Write the Arduino sketch to read data from the ultrasonic sensor and send it to a cloud platform. You might use Wi-Fi for communication.
    • You can use platforms like ThingSpeak, Blynk, or MQTT for cloud connectivity.

Schematic Diagram

PCB Diagram

3D View

Manufacturing Files




Order Directly from PCB WAY

I have already uploaded all these required manufacturing files in PCBWAY website. You can easily go to the below link and place you order, and get your Own  Home Automation PCB manufactured from one of the best pcb manufacturer PCBWAY


Recommended For You

About the Author: admin

Leave a Reply

Your email address will not be published.