Coastal flooding is a major environmental challenge that can affect residential areas, fishing communities, roads and coastal infrastructure. Rising sea levels, heavy rainfall and changing weather conditions can increase the risk of flooding.
In this project, I developed an IoT-based coastal flood monitoring system using a NodeMCU ESP8266. A waterproof ultrasonic sensor measures the distance between the sensor and the water surface. A rain detection module identifies rainfall conditions.
The ESP8266 processes the collected information and sends it through Wi-Fi to the KiwisIoT platform, where users can monitor water-level changes through a cloud dashboard.
This project demonstrates how IoT technology can support coastal water-level monitoring and provide early indications of potential flooding.
Circuit ConnectionsThe NodeMCU ESP8266 acts as the main controller. The waterproof ultrasonic sensor measures the water-surface distance, while the rain detection module identifies rainfall conditions.
**JSN-SR04T Ultrasonic Sensor Connections**
- VCC → NodeMCU VIN (5V USB supply)
- GND → NodeMCU GND
- TRIG → NodeMCU D5
- ECHO → NodeMCU D6 through a voltage divider
**Echo Voltage Divider**
The JSN-SR04T may produce a 5V Echo signal, which must be reduced before connecting it to the ESP8266.
- Connect a 1kΩ resistor between the sensor ECHO and NodeMCU D6.
- Connect a 2kΩ resistor between NodeMCU D6 and GND.
This reduces the 5V signal to approximately 3.3V.
**Rain Detection Module Connections**
- VCC → 3.3V (if supported by the module)
- GND → NodeMCU GND
- DO → NodeMCU D7
- Use a waterproof ultrasonic sensor suitable for outdoor installation.
- Mount the ultrasonic sensor above the water surface, facing downwards.
- Keep the sensor at a fixed height for accurate water-level measurements.
- Connect all circuit grounds together.
- Protect the ESP8266 and electronic connections from rain and moisture.
- Calibrate the normal water-level distance and flood threshold according to the installation location.
The following program measures the distance between the ultrasonic sensor and the water surface. It calculates the water level relative to a predefined reference height and identifies potential flood conditions.
The collected readings are transmitted to KiwisIoT using separate channels.
Install the KiwisIoT library before uploading the program.
**Note:** The reference height of 200 cm and flood clearance of 50 cm are example configuration values. Adjust them according to the actual installation. This program calculates water level relative to the chosen reference point, not absolute sea level. The rain sensor logic may need to be reversed depending on the module. The system also requires testing and calibration to avoid false flood alerts.
KiwisIoT Platform IntegrationI use the KiwisIoT platform to visualize and monitor coastal water-level information remotely.
First, create an account on KiwisIoT and create a new dashboard panel.
Configure the ESP8266 device using the generated Topic ID and connect it to an internet-enabled Wi-Fi network.
**Dashboard Configuration**
- Channel 0 – Water Distance (cm)
- Channel 1 – Calculated Water Level (cm)
- Channel 2 – Rain Detection Status
- Channel 3 – Flood Alert Status
Add suitable Gauge, Label and Chart widgets to display the incoming reading
1. Visit https://www.kiwisiot.in/
2. Create an account and dashboard panel.
3. Configure the device and Topic ID.
4. Add four monitoring widgets.
5. Upload the Arduino program.
6. Monitor water-level changes through the dashboard.
The KiwisIoT platform provides a convenient way to connect IoT devices and visualize environmental information through a cloud dashboard.
Working Principle1. The JSN-SR04T ultrasonic sensor sends ultrasonic waves towards the water surface.
2. The sensor receives the reflected waves.
3. The NodeMCU ESP8266 calculates the distance between the sensor and the water surface.
4. The controller calculates the water level using the predefined reference height.
5. The rain detection module identifies rainfall conditions.
6. The ESP8266 compares the measured water distance with the configured flood threshold.
7. The collected information is transmitted through Wi-Fi to KiwisIoT.
8. Users can monitor water-level changes and flood status remotely through the dashboard.
Applications- Coastal flood monitoring.
- River and canal water-level monitoring.
- Coastal residential areas.
- Fishing communities.
- Harbour and port monitoring.
- Flood-prone road monitoring.
- Smart drainage systems.
- Environmental monitoring stations.
**Ultrasonic Sensor Not Detecting Water**
Check the TRIG and ECHO connections and ensure the sensor is correctly positioned.
**Incorrect Water-Level Readings**
Verify the sensor mounting height and calibrate the reference distance.
**ESP8266 Restarting**
Check the 5V power supply and ensure the ultrasonic sensor receives stable power.
**Rain Sensor Always Detecting Rain**
Clean the sensor plate and adjust the onboard potentiometer.
**Flood Alert Triggering Incorrectly**
Verify the reference height and configured flood threshold.
**Wi-Fi Not Connecting**
Check the Wi-Fi name and password.
**KiwisIoT Dashboard Not Updating**
Verify the Topic ID, channel configuration and internet connection.
Final OutputThe completed IoT-Based Coastal Flood Detection System measures water-surface distance and calculates changes in water level using a waterproof ultrasonic sensor.
The NodeMCU ESP8266 processes the collected information and transmits it to the KiwisIoT cloud platform.
Users can remotely monitor water levels, rainfall conditions and configured flood alerts through an online dashboard.
This project demonstrates how IoT technology can support coastal environmental monitoring and provide early indications of rising water levels.
KiwisIoT PlatformI recommend the KiwisIoT platform for this project because it provides a simple way to connect ESP8266 devices and visualize real-time environmental information through a cloud dashboard.
With KiwisIoT, users can monitor water distance, calculated water level, rainfall status and flood alerts without developing a separate monitoring interface.
The platform can also be extended with additional sensors, alerts and automation features.
Project Examples:https://github.com/Kiwistron/KiwisIoT-Projects/tree/main





_JnuTDtq8iW.jpeg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)







_3u05Tpwasz.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)

Comments