Flooding is among the most frequent natural disasters in Indonesia, particularly in urban areas such as Medan City. Delays in obtaining flood-related information often result in significant material losses and casualties. This study develops a real-time flood detection and early warning system using the JSN-SR04T ultrasonic sensor integrated with Internet of Things (IoT) technology. The system employs an ESP32 microcontroller to process water level data and transmit information via the Message Queuing Telemetry Transport (MQTT) communication protocol. It categorizes water levels into three statuses: safe (0–110 cm), alert (111–145 cm), and danger (≥146 cm), with automatic alarm activation above 135 cm. Field testing was conducted at Deli River, Medan, an urban flood-prone area. The results showed that the system achieved an average measurement error of 0.96% and a system accuracy of 99.04%, indicating high precision and reliability. Data transmission operated in real time with a response time below 5 seconds and no observed communication failures. Moreover, the use of a 40 mm acrylic tube significantly enhanced sensor stability by reducing fluctuations caused by water surface waves. Overall, the system provides a cost-effective, accurate, and reliable IoT-based flood early warning solution suitable for urban areas vulnerable to flooding.
Copyrights © 2026