0% found this document useful (0 votes)
14 views13 pages

Early-flood-detection-and-avoidance-using-IoT-and-machine-learning2

This research paper discusses the development of an early flood detection and avoidance system utilizing IoT and machine learning, specifically through the implementation of a sensor module and the ARIMA algorithm for time series forecasting. The system collects real-time data on water levels, humidity, and rainfall, which is then analyzed to predict potential flood events, enhancing disaster preparedness in vulnerable regions. The open-source nature of the data promotes collaborative research and empowers communities with critical weather-related information.

Uploaded by

Abhijeet Kashyap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views13 pages

Early-flood-detection-and-avoidance-using-IoT-and-machine-learning2

This research paper discusses the development of an early flood detection and avoidance system utilizing IoT and machine learning, specifically through the implementation of a sensor module and the ARIMA algorithm for time series forecasting. The system collects real-time data on water levels, humidity, and rainfall, which is then analyzed to predict potential flood events, enhancing disaster preparedness in vulnerable regions. The open-source nature of the data promotes collaborative research and empowers communities with critical weather-related information.

Uploaded by

Abhijeet Kashyap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/383588295

Early flood detection and avoidance using IoT and machine learning

Conference Paper · August 2024


DOI: 10.1063/5.0230082

CITATIONS READS

0 215

7 authors, including:

Raed Abdulla Vinesh Thiruchelvam


Asia Pacific University of Technology & Innovation Asia Pacific University of Technology & Innovation
100 PUBLICATIONS 902 CITATIONS 113 PUBLICATIONS 395 CITATIONS

SEE PROFILE SEE PROFILE

Muhammad Ehsan Rana


Asia Pacific University of Technology & Innovation
164 PUBLICATIONS 898 CITATIONS

SEE PROFILE

All content following this page was uploaded by Raed Abdulla on 22 September 2024.

The user has requested enhancement of the downloaded file.


RESEARCH ARTICLE | AUGUST 30 2024

Early flood detection and avoidance using IoT and machine


learning 
A. A. Luthfee; R. Abdulla; V. Thiruchelvam; M. E. Rana; A. Mukil; A. Bathich; C. Y. Lau 
AIP Conf. Proc. 3161, 020017 (2024)
https://doi.org/10.1063/5.0230082


View Export
Online Citation

30 August 2024 23:29:56


Early Flood Detection and Avoidance Using IoT and
Machine Learning
A A Luthfee1, a), R Abdulla1, b), V Thiruchelvam1, c), M E Rana1, d), A Mukil1, e),
A Bathich2, f), and C Y Lau1, g)
1
Faculty of Computing, Engineering & Technology, Asia Pacific University of Technology and Innovation, Jalan
Teknologi 5, Taman Teknologi Malaysia, 57000, Wilayah Persekutuan Kuala Lumpur, Malaysia.
2
Faculty of Computer and Information Technology, Al-Madinah International University, Jalan 2/125e, Kuala
Lumpur 57100, Malaysia
a)
[email protected]
b)
[email protected]
c)
[email protected]
d)
[email protected]
e)
[email protected]
f)
[email protected]

30 August 2024 23:29:56


g)
Corresponding author: [email protected]

Abstract. With the increasing frequency and severity of natural disasters, particularly floods, there is a pressing need for
advanced monitoring and prediction systems to mitigate their impact on vulnerable communities. Leveraging IoT
technologies and machine learning algorithms present promising avenues for enhancing early warning systems and
improving disaster preparedness. This research entails the design and implementation of a sensor module coupled with a
LoRa-based recovery hub operating at 915MHz. The primary objective is to transmit real-time data on water level,
humidity, rainfall intensity, and temperature to an IoT dashboard and a PostgreSQL database. This facilitates open access
to the data for both research endeavours and public consumption, particularly for weather data analysis. The water level
data collected by the system serves as input for a machine learning algorithm known as ARIMA (AutoRegressive
Integrated Moving Average) implemented on the Up-square platform. The algorithm leverages time series forecasting
techniques to predict flood occurrences in the river basin where the sensor module is deployed. By analyzing historical
trends and current conditions, the system forecasts the water level for the subsequent thirty minutes, providing insights
into potential flash flood events and establishing thresholds for near-future risk assessment. Through the integration of
sensor technology, wireless communication protocols, and advanced analytics, this project contributes to the
development of proactive flood prediction systems, enhancing public safety and disaster preparedness in vulnerable
regions. Additionally, the open-source nature of the data facilitates collaborative research efforts and empowers
communities with valuable weather-related information for informed decision-making.

INTRODUCTION

Real climate change is taking place at an unprecedented rate [1]. According to scientific evidence, extreme
weather events are becoming more likely as a result of climate change, particularly changes in rainfall [2]. Floods
are frequently caused by precipitation and river overflow, especially during a very rainy season [3]. Fluvial flood
frequency increases in urban areas during periods of heavy precipitation are mostly caused by the rapid and
unplanned urbanisation of these areas [4-6]. In Malaysia, monsoonal flooding and flash floods occur every year
during the northeast monsoon, particularly in the eastern states such as Kelantan, Terengganu, and Perak. Many
more urbanized cities like Kuala Lumpur also face this problem due to clogged and inefficient drainage systems.
Researchers have found that an estimation of the area at risk of flooding is approximately 29,800km 2 which is about
9% of the total area in Malaysia affecting almost 4.85 million people, which is approximately 22% of the total

Proceedings of 5th International Conference on Sustainable Innovation in Engineering and Technology 2023
AIP Conf. Proc. 3161, 020017-1–020017-11; https://doi.org/10.1063/5.0230082
Published under an exclusive license by AIP Publishing. 978-0-7354-5032-5/$30.00

020017-1
population in this country [7]. Internet of Things (IoT) is the foundation of data transmission between individual
devices and web application applications. The main idea is for simple everyday objects and physical components
which we generally describe in this context as ‘‘things” to gain the ability to be linked to sensors, software and other
technologies, thereby connecting and sharing data through the Internet with other devices [8–10]. IoT is a very
creative resource which plays a vital role in manufacturing, industrial, and residential systems [11]. The LoRa
system is intended to be utilised in equipment with long-life batteries where power consumption is minimal. LoRa
has been widely used in many IoT applications [12, 13]. Over the last decade, flood detection has become a hot topic
of research, and much research has been carried out on flood detection systems [14–19].
This research aims to design and develop early flood detection and avoidance using IoT and Machine learning.
The system can detect temperature, water level, and humidity based on Arduino. An IoT system was developed
using LoRa that can collect and store data on current floods and previous floods. This research aims to find a cost-
effective and efficient IoT-based flood detection and avoidance method that can be installed in remote areas require
minimal maintenance and provide twenty-four-hour flood monitoring without any further assistance provided there
is a stable network connection and power supply to the IoT device.

PROPOSED METHODOLOGY
Figure 1 shows how the data flows within the system and all the hardware that is used in the project. The Blue
arrows show the wired connection while the red arrows show the wireless connections. The system starts when both
the Arduino and the TTGO board have been powered up. The sensors will be powered up by the Arduino. The
sensor data will be periodically sent to the Arduino UNO which has been connected to an Arduino LoRa shield. This
will send the data in packets to the TTGO Lora ESP32 board. The TTGO board is coded to send the data via MQTT
to the server that has been hosted on the Upsquare. The Upsquare is also the device where the machine learning
algorithm is running. Using the PAHO MQTT python library, Upsquare waits for new sensor readings to be
published to the topics. The data is then aggregated for one hour and the average of this data is logged for each

30 August 2024 23:29:56


sensor into the Postgres Heroku database. If the average water level is above normal, then the aggregated data is fed
into the ARIMA model. With the use of the previous 30 minutes, future values for water level are predicted. Before
feeding data into the ARIMA model, pre-processing is done where collected values are rounded off to a maximum
of 2 decimal places and then collected into a list. This is then split 70 % for training and 30% for testing. Once the
ARIMA model generates the future predictions, the average value for the first 30 minutes is calculated and
compared to the predefined variables shown in Table 1. Once the prediction is done the decision is sent to the
dashboard. The node-red dashboard directly subscribes to the MQTT topic to receive the temperature, humidity,
water level and rainfall data as soon as it gets published. This data will be available on the dashboard.

FIGURE 1. Data flow in the implemented system

TABLE 1. Dataset to sensor allocation


Data Classification Normal Alert Warning Flood
Dataset
Water level at the rover basin (m) 0.25 1.20 1.38 1.80
Sensor reading Empty Low Medium High
Prototype
Threshold on sensor > 100 101 - 500 501 - 610 < 611

020017-2
Figure 2 shows the sensor module connected to an Arduino UNO and the circuit diagram for the sensor system.
This system is fully self-reliant and portable and requires no internet connection. With a 10000 mAh battery the
system can work for approximately 6 hours. The three sensors blinking are the Rain sensor which detects if there is
rainfall and the rainfall intensity. The second sensor is the DHT11 sensor which detects temperature and humidity.
The third and last sensor is the water level sensor which tells the water level in the river basin. Additionally, the
915Mhz Cytron LoRa-RFM Shield attached to the Arduino UNO sends the received data in a packet to the TTGO
board.

FIGURE 2: LORA sensor and circuit diagram

In Fig 3, a TTGO LILYGO LORA32 915Mhz ESP32 OLED Display Board is receiving the packets of data
being sent from the Arduino LoRa shield. The Upsquare is running an MQTT server and the TTGO is publishing to
the server which is how the data is obtained by both the Upsquare and Node-red. The Upsquare is also using the data
to run a machine learning algorithm called ARIMA to give an early flood prediction which will be further discussed
in the next section.

30 August 2024 23:29:56


FIGURE 3. Receiver hub set up and ttgo board and upsquare running

This data is acquired from the official website of “The Department of Irrigation and Drainage, Ministry of
Environment and Water” which updates the water level in all the major river basins in Malaysia in real-time and
logs the data graphically. All of the data is open source. The river basin in Sungai Melaka was chosen for this
project. The Data was logged at a frequency of 5 minutes for the 24 hours. The threshold is 0.24 m for normal water
level, 1.20 m for alert, 1.38 m for Warning and 1.80 means the basin has flooded. Figures 4 and 5 show the trendline
for the logged 45 hours where the water level did increase to a warning level at the river basin. This data was then
tabulated so that it could be used in the machine learning dataset.

020017-3
30 August 2024 23:29:56
FIGURE 4. Rainfall at the river basin during the 24 hours (20)

020017-4
Water Normal Alert warning danger
2.7 Level

2.5

2.0

1.5

1.0

0.5

FIGURE 5. Hydrograph for the dataset used in ARIMA (20)

30 August 2024 23:29:56


Machine learning is used in a wide range of applications, from crop suitability prediction to image recognition in
self-driving cars to flood detection etc [21]. ARIMA is one of the most effective machine learning algorithms for
time series forecasting by corresponding to a linear combination rather than a polynomial combination based on the
past values of the variable. Each of the “AR, I, and MA” are included in the model as a parameter as p, q and d. The
detailed explanation for the notations is explained in Table 2. ARIMA was used rather than CDNN, ANN or RNN
because the data set does not need to be range sensitive to do machine learning therefore the water level sensor used
in the prototype can be used as it is rather than buying a high-end water level sensor as used in the dataset provided.
In fact, it is not even clear what kind of sensor has been used by the Department of irrigation and Drainage. ARIMA
is especially useful to forecast the future of a quantity. Another important advantage is compatibility. ARIMA can
be written on R and Python which are good data analytics programming languages which will run on UBUNTU
which Upsquare is running on which allows the Machine learning algorithm to run on Linux.

TABLE 2. ARIMA (p, d, q)


Parameter Notation Explanation
P number of autoregressive terms or the number of “lag observations.”
d is the “degree of differencing”. Which is common terms being the “number of times the lagged indicators have
D
been subtracted to make the data stationary”.
Q number of forecast errors in the ARIMA model

The dataset is secured inside the Heroku servers and can be accessed anytime anywhere is the world just like the
Node-red database provided the Upsquare Server is running which it will be. Figure 6 shows the secure 2-factor
authentication login portal of the Heroku website and the MySQL Heroku database. The simplest way of explaining
the relationship between Node-red, Heroku and MySQL is to describe Heroku as the OneDrive and MySQL as the
Excel sheet stored in said OneDrive which is what the data gets logged into by a PyCharm script. And Node-red is
the display for the data that has been logged.

020017-5
30 August 2024 23:29:56
FIGURE 6. Heroku login portal and Postgres SQL database

FINDINGS & TESTINGS

Figure 7 shows the attempt to simulate rainfall intensity and to alter the temperature and humidity in a cold
humid room. This data is then recorded on the serial monitor and on the dashboard.

020017-6
30 August 2024 23:29:56
FIGURE 7. Rainfall simulated via rainfall sensor and LoRa shield and Arduino Uno serial monitor

Figure 8 shows the serial monitor when the sensor data is relayed to the TTGO ESP32 LoRa board. This data is
then published to the MQTT server running on the Upsquare.

020017-7
30 August 2024 23:29:56
FIGURE 8. TTGO board and the upsquare and ttgo board serial monitor

Figure 9 shows the Dashboard getting updated as soon as the data is available on the MQTT server. Node-red
will update the sensor value below each of the corresponding graphs. The predicted threshold is currently not
updated as enough data is not available for ARIMA. Also, the tip of the water level sensor is placed on the water so
that a low water level average and the code will predict a “Normal” water level.

FIGURE 9. Node-Red Dashboard with live sensor values

On the Upsquare runs a PyCharm code based on Linux. When this code is run it will connect to the MQTT
server running on the Upsquare. Fig.10 shows that the ARIMA code is successfully connected and subscribed to the
MQTT topics. The data is now available for ARIMA to work with. The serial monitor shows the data getting
printed. For a short demonstration, an average of 6 data is taken as soon as it is retrieved and it is used to forecast the
water level and predicted threshold for the next 30 seconds. Each data typically arrived at 6 seconds so 30 seconds

020017-8
of data is being used to predict the next 30 seconds of data. When deployed on the field to predict flash floods, the
data arrives every 5 minutes and the next 30 minutes is forecasted.

FIGURE 10. Simulating normal water level for ARIMA

Figure 11 shows, if the data is consistently below 100 from the A0 pin, the threshold given, is normal. The
dataset will then use ARIMA to predict the “Alert” and “Warning” where the live sensor data is fed to ARIMA, and
the prediction is made. As shown in the dashboard River level significantly increased above the Normal Level and
ARIMA has forecasted the “Alert” threshold.

30 August 2024 23:29:56


FIGURE 11. Predicted threshold “alert” flood prediction displayed on node-red

Figure 12. shows the graphical display of all the data collected for all of the selected p, q, d values for the
ARIMA accuracy test. This experiment aims to acquire investigate and find the p, q, d values with the lowest RMSE
thus choosing the best values for the flood prediction system. Each of the AR, I, and MA components are included
in the model as a parameter p, q, d when ARIMA was introduced. p, q, d can be assigned specific integer values and
that determines what kind of model it is. In this experiment, the most common kinds of ARIMA models are tested.
these numbers may look random, but they are mathematically equivalent to forecasting models and may even be set
to 0 which implies that they are not used at all as shown in Table 3. ARIMA model was tested with three different
parameters, the data is represented graphically.

020017-9
TABLE 3: Parameters set to zero
Parameter Notation Explanation
d=0 No stationary data
d = 0, q = 0 No moving averages or stationary data, just an autoregression on past values
p = 0, d = 0 Moving average model with no autoregression or stationary data

(a)

30 August 2024 23:29:56


(b)

(c)
FIGURE 12. Data collected for all of the selected p, q, d values (a) (1,0,1) (b) (2,0,1) (c) (2,2,1)

020017-10
CONCLUSION

This research is done to find the best way to develop and enhance the IoT-based flood prediction and monitoring
systems that are currently available. the portable sensor system based on Arduino and the Arduino LoRa Shield was
deployed and the aforementioned sensor data was obtained in real-time using a complementary and specifically
specialized sensor for each parameter which was connected to the Arduino. The LoRa shield and the TTGO board
were used to relay the sensor data to the Upsquare which is running a Mosquito server. The sensor data is sent from
here to be stored on the Heroku PostgreSQL database therefore current and previous flood data along with the
sensor data gets stored on a cloud-based SQL database. ARIMA accuracy tests were done to see which model is the
best for a flood prediction model.

REFERENCES

1. S. Manandhar et al., International Journal of Disaster Risk Reduction 11, 47–59 (2015).
2. J. Kiehl, Science 331, 158–9 (2011).
3. Wilson, A. C.H. Cheong and S. Sivanesan, J. Eng. Sci. Technol.17, 203–213 (2022).
4. S. Bae, H. Chang, International Journal of Disaster Risk Reduction 37, 101186 (2019).
5. V. Sekar, A. Putra, S. Palaniyappan, S. Y. E. Noum, S. Sivanesan, and Y. L. Jiun, Wood Mater. Sci. Eng. 12, 1-
10 (2023).
6. V. Sekar, S. Palaniyappan, S. Y. E. Noum, A. Putra, S. Sivanesan, and D. D. C. V. Sheng, Wood Res. 68, 68-82
(2023).
7. M. I. Hadi et al., IOP Conf Ser Earth Environ Sci 479, 012016 (2020).
8. R. Lakshmanan et al., International Journal of Electrical and Computer Engineering 10 (2020).
9. L. M. Thakur, R. Abdulla, S. K. Selvaperumal, C. Nataraj, in 2022 3rd International Conference on Smart
Electronics and Communication (ICOSEC) (IEEE, 2022), pp. 414–21.

30 August 2024 23:29:56


10. P. Asghari, A. M. Rahmani, H. H. S. Javadi, Computer Networks 148, 241–61 (2019).
11. O. Zaid Salah, S. K. Selvaperumal, R. Abdulla, International Journal of Electrical and Computer Engineering
(IJECE) 12, 4430 (2022).
12. H. A. Khan, R. Abdulla, S. K. Selvaperumal, and A. Bathich, Int. J. Electr. Comput. Eng. 11, 3300–3309
(2021).
13. L. G. F. Kolobe, C. K. Lebekwe, B. Sigweni, International Journal of Electrical and Computer Engineering
(IJECE) 10, 3176 (2020).
14. S. Osman, A. H. Shah, S. Ali, S. K. Selvaperumal, and V. Thangasamy, Int. J. Simul.: Syst., Sci. Technol. 16,
No. 4 (2015).
15. W. H. Wan Hassan et al., International Journal of Electrical and Computer Engineering (IJECE) 9, 1694 (2019).
16. N. M. Yoeseph et al., IOP Conf Ser Earth Environ Sci 986, 012060 (2022).
17. M. S. Mohd Sabre, S. S. Abdullah, A. Faruq, Kinetik: Game Technology, Information System, Computer
Network, Computing, Electronics, and Control, 287–96 (2019).
18. Sooriamoorthy, D., Shanmugam, S. A., & Juman, M. A., Biomedical Signal Processing and Control, 68, 102649
(2021).
19. Cheng, L. W., Hii, M. L. H. A. Q., Murali, R., & Sooriamoorthy, D., International Journal of Advanced
Robotics and Unmanned Systems, 1(2), (2022).
20. J. S. U. Rahman and S. K. Selvaperumal, Indones. J. Electr. Eng. Comput. Sci. 29, No. 1, 270–276 (2023).
21. J. S. U. Rahman, S. K. Selvaperumal, and R. Logeswaran, J. Adv. Res. Dynam. Control Syst. 12, 03-Special
Issue, (2020).

020017-11
View publication stats

You might also like