Research Article | ![]()
IoT-Based Short-Term Water Level Monitoring and Prediction Using Random Forest with MQTT QoS Evaluation
Author(s): Satryo Budi Utomo*
Published In : International Journal of Electrical and Electronics Research (IJEER) Volume 14, Issue 2
Publisher : FOREX Publication
Published : 30 June 2026
e-ISSN : 2347-470X
Page(s) : 618-629
Abstract
Flood-related water level variations are among the most frequent hydrometeorological challenges with high frequency and impact in Indonesia, so an early warning system capable of providing fast, accurate, and real-time information is needed. An Internet of Things (IoT)-based experimental framework is proposed for short-term water level monitoring and prediction. Ultrasonic sensors are used to continuously measure water surface elevation, while NodeMCU functions as the main controller to process data and send information to the MQTT broker using a publish-subscribe architecture. The Random Forest model is trained using sequential water level data (time-series) and evaluated using MSE, RMSE, MAE, and R² parameters. The results show that the Random Forest model is able to produce high prediction accuracy with an R² value of 0.995488, indicating the model's strong ability to follow the temporal pattern of water level changes. In addition, the performance of the MQTT protocol is analyzed through QoS parameters including throughput, delay, jitter, packet loss, and Round-Trip Time (RTT). The test results show a packet loss value of 0.6% on the publisher-broker path and 1% on the broker-subscriber path, which is categorized as very good for IoT communication. Delay and jitter values are also in a stable range, thus supporting a decision support system for early warning applications. The integration of machine learning methods and the MQTT protocol in this study offers an experimentally evaluated and lightweight implementation framework for an IoT-based short-term water level monitoring and early warning support system. These findings indicate that the combination of Random Forest and MQTT has the potential to be an effective approach to support local monitoring and early warning decision-making through accurate short-term predictions and reliable data transmission. The contribution of this study is experimental, integrative, and evaluative in nature, focusing on system-level performance assessment rather than the development of new algorithms or theoretical models.
Keywords: Laboratory-Scale Early Warning Prototype, Internet of Things (IoT), Random Forest, MQTT Protocol, Ultrasonic Sensor (HC-SR04).
Satryo Budi Utomo, Electrical Engineering, University of Jember, Jember, Indonesia; Email: satryo@unej.ac.id
-
[1] M. N. K. Boutros, A. Meroth, N. Sharaf, and Y. A. Zaghloul, “Development of a MQTT-based server software Agriculture Precision,” 2024.
-
[2] C.-H. Liu, T.-H. Yang, and O. T. Wijaya, “Development of an Artificial Neural Network Algorithm Embedded in an On-Site Sensor for Water Level Forecasting,” vol. 22, pp. 1–22, 2022.
-
[3] H. J. J. Ochoa, R. Peña, Y. L. Mezquita, E. Gonzalez, and S. Camacho-leon, “Comparative Analysis of Power Consumption between MQTT and HTTP Protocols in an IoT Platform Designed and Cold Chain Transport Operations,” 2023.
-
[4] H. Nurwarsito and M. A. S. Alkaf, “Development of LoRa Multipoint Network Integrated with MQTT-SN Protocol for Microclimate Data Logging in UB Forest,” vol. 17, no. 1, pp. 1–16, 2025.
-
[5] U. B. Iyekekpolo, F. E. Idachaba, and S. I. Popoola, “Early Flood Detection and Monitoring System Based on Wireless Sensor Network,” vol. 2011, no. October 2010, pp. 1381–1394, 2018.
-
[6] S. A. S. Bukhari, I. Shafi, J. Ahmad, H. T. Butt, T. Khurshaid, and I. Ashraf, “Enhancing flood monitoring and prevention using machine learning and IoT integration,” no. 0123456789, 2024.
-
[7] E. Shahri, P. Pedreiras, and L. Almeida, “Extending MQTT with Real-Time Communication Services Based on SDN,” pp. 1–19, 2022.
-
[8] M. Mousa, X. Zhang, and C. Claudel, “Flash Flood Detection in Urban Cities Using Ultrasonic and Infrared Sensors Flash Flood Detection in Urban Cities Using Ultrasonic and Infrared Sensors,” 2025, doi: 10.1109/JSEN.2016.2592359.
-
[9] T. Khan et al., “Flash Floods Prediction using Real Time data : An Implementation of ANN-PSO with less False Alarm,” pp. 1–6, 2019.
-
[10] J. G. Natividad and J. M. Mendez, “Flood Monitoring and Early Warning System Using Ultrasonic Sensor Flood Monitoring and Early Warning System Using Ultrasonic Sensor,” 2017, doi: 10.1088/1757-899X/325/1/012020.
-
[11] M. Siddique, T. Ahmed, and M. S. Husain, “EAI Endorsed Transactions Flood Monitoring and Early Warning Systems – An IoT Based Perspective,” vol. 9, no. 2, pp. 1–10, 2023.
-
[12] M. Wajid and A. Raza, “Flood Prediction System Using IOT & Artificial Neural Network,” 2024, doi: 10.21015/vtse.v12i1.1603.
-
[13] A. Hanif and R. Amri, “Implementasi Internet Of Things Pada Protokol MQTT Dan HTTP Dalam Sistem Pendeteksi Banjir,” pp. 489–501, 2023.
-
[14] J. H. Emon, S. M. Hussain, A. Islam, and S. S. Ahmed, “Integration of IoT , Machine Learning , and Sensors for Intelligent Environmental Monitoring and Agricultural Development,” vol. 2025, 2025.
-
[15] S. Kushwaha and R. Pandey, “Intelligent IoT-Based Water Quality Monitoring and Predictive Analysis Using Machine Learning,” pp. 8–16, 2025.
-
[16] V. De Paul, N. Kwizera, Z. Li, V. E. Lumorvie, F. Nambajemariya, and X. Niu, “IoT Based Greenhouse Real-Time Data Acquisition and Visualization through Message Queuing Telemetry Transfer ( MQTT ) Protocol,” pp. 77–93, 2021, doi: 10.4236/ait.2021.112006.
-
[17] C. Moreno et al., “RiverCore: IoT Device for River Water Level Monitoring over Cellular Communications,” vol. 19, no. 127, pp. 1–21, 2019, doi: 10.3390/s19010127.
-
[18] B. Nemade et al., “IoT-based automated system for water-related disease prediction,” pp. 1–30, 2024.
-
[19] M. E. Rana, “IoT-Based Flood Monitoring System Using Machine Learning Approach,” 2023.
-
[20] C. T. Selvi, R. S. S. Subramanian, M. M. Krishnan, and P. G. Priya, “IoT-Enabled Flood Monitoring System for Enhanced Dam Surveillance and Risk Mitigation,” vol. 6, no. 3, pp. 144–153, 2024.
-
[21] C. Mydlarz et al., “FloodNet: Low‐Cost Ultrasonic Sensors for Real‐Time Measurement of Hyperlocal, Street‐Level Floods in New York City,” Adv. Earth Sp. Sci., pp. 1–22, 2024.
-
[22] V. Uddameri and E. A. Hernandez, “Machine Learning for Flood Resiliency — Current Status and Unexplored Directions,” 2025.
-
[23] T. Khan, M. Alam, and M. S. Mazliham, “Artificial Intelligence Based Multi-modal Sensing for Flash Flood Investigation,” pp. 40–47, 2018.
-
[24] I. R. Widiasari, L. E. Nugroho, and Widyawan, “Deep Learning Multilayer Perceptron ( MLP ) for Flood Prediction Model Using Wireless Sensor Network based Hydrology Time Series Data Mining,” 2023.
-
[25] E. D. Wardihani, E. U. Sari, A. S. Nugroho, Y. Badruzzaman, and A. Nursyahid, “Monitoring and Controlling of IoT-Based Greenhouse Parameters W ith the MQTT Protocol,” vol. 13, no. 1, pp. 38–43, 2024.
-
[26] J. A. Coelho and A. Glória, “Precise Water Leak Detection Using Machine Learning and Real-Time Sensor Data,” pp. 474–493, 2020, doi: 10.3390/iot1020026.
-
[27] K. Mohamed et al., “Real-time flood forecasting in Amo Chhu using machine learning model and internet of things and internet of things,” vol. 1916, 2024, doi: 10.1080/23311916.2024.2370900.
-
[28] J. L. R. Neypes, M. Sultana, and A. J. R. Miyajima, “Real-time Flood Surveillance and Early Warning System using IoT- AI Fusion for Flood Prediction : Smart Framework to Monitoring Solutions,” vol. 6, no. 4, pp. 30–40, 2024.
-
[29] M. Mavroforakis, H. Georgiou, V. Malisiovas, C. Psychias, and K. Sarioglou, “‘ Water Underground ’ : Real-time , continuous monitoring of the underground water ’ s quantity and quality .,” no. September, 2021.
-
[30] J. Song, Z. Shao, Z. Zhan, and L. Chen, “State-of-the-Art Techniques for Real-Time Monitoring of Urban Flooding : A Review,” 2024.
-
[31] M. A. Rahu et al., “Toward Design of Internet of Things and Machine Learning-Enabled Frameworks for Analysis and Prediction of Water Quality,” vol. 11, no. September, pp. 101055–101086, 2023.
-
[32] G. Modalavalasa, “Towards Sustainable Development Based on Machine Learning Models for Accurate and Efficient Flood Prediction,” vol. 8, no. 2, pp. 940–944, 2021.
-
[33] S. Salama, H. Hajjaj, M. Thariq, and H. Sultan, “Utilizing the Internet of Things (IoT) to Develop a Remotely Monitored Autonomous Floodgate for Water Management and Control,” water, vol. 12, no. 502, pp. 1–18, 2020.
-
[34] T. R. Mahesh et al., “Water quality level estimation using IoT sensors and probabilistic machine learning model,” vol. 55, no. 7, pp. 775–789, 2024, doi: 10.2166/nh.2024.048.
-
[35] G. Al-Rawas, M. R. Nikoo, M. Al-Wardy, and T. Etri, “A Critical Review of Emerging Technologies for Flash Flood Prediction: Examining Artificial Intelligence, Machine Learning, Internet of Things, Cloud Computing, and Robotics Techniques,” pp. 1–28, 2024.
-
[36] K. Das, S. Ghosh, and H. S. Dutta, “A Machine Learning and IoT based approach for Flood Monitoring and Prevention,” vol. 12, no. 5, pp. 11–19, 2022, doi: 10.9790/9622-1205021119.
-
[37] L. Mdegela, Y. De Bock, E. Municio, E. Luhanga, J. Leo, and E. Mannens, “A Multi-Modal Wireless Sensor System for River Monitoring : A Case for Kikuletwa River Floods in Tanzania,” pp. 1–23, 2023.
-
[38] M. Mousa, E. Oudat, and C. Claude, “A Novel Dual Traffic / Flash Flood Monitoring System Using Passive Infrared / Ultrasonic Sensors A Novel Dual Traffic / Flash Flood Monitoring System Using Passive Infrared / Ultrasonic Sensors,” 2015.
-
[39] M. Abdurohman, A. J. I. G. Putrada, and M. M. A. T. Deris, “A Robust Internet of Things-Based Aquarium Control System Using Decision Tree Regression Algorithm,” pp. 56937–56951, 2022.
-
[40] Hanan, A. A. N. Gunawan, and M. Sumadiyasa, “Water Level Detection System Based on Ultrasonic Sensors HC-SR04 and ESP8266-12 Modules with Telegram and Buzzer Communication Media,” vol. 18, no. 3, pp. 305–309, 2019.
-
[41] A. Djalilov, E. Sobirov, O. Nazarov, S. Urolov, and I. Gayipov, “Study on automatic water level detection process using ultrasonic sensor,” 2022, pp. 1–9. doi: 10.1088/1755-1315/1142/1/012020.
-
[42] E. Sze, D. Hindarto, I. K. A. Wirayasa, and Haryono, “Performance Comparison of Ultrasonic Sensor Accuracy in Measuring Distance,” vol. 6, no. 4, pp. 2556–2562, 2022.
-
[43] F. Shi, L. Yan, X. Zhao, and R. X. Gao, “Machine Learning-Based Time-Series Data Analysis in Edge-Cloud-Assisted Oil Industrial IoT System,” vol. 2022, 2022.
-
[44] H. Tyralis and G. Papacharalampous, “Variable Selection in Time Series Forecasting Using Random Forests,” 2017, doi: 10.3390/a10040114.
-
[45] R. Kumar, “Time Series Data Prediction using IoT and Machine Learning Technique,” vol. 00, no. 2019, 2020.

I. J. of Electrical & Electronics Research