Early warning of impending flash flood based on AIoT

According to data from the Earth's Volcano and Geological Disaster Reduction Center, a country like Indonesia has experienced many natural disasters, one of which is flooding. Floods are an annual natural disaster, especially on mountain slopes. Mountainous areas experience more dangerous than floods than the urban areas because they can cause other natural disasters, such as landslides and damage the hiking trails. The steep and winding roads minimize and limit the number of officers working in the mountains. Therefore, flood detection and monitoring equipment is needed. The proposed system based on AIoT technology provides real-time flood analysis so that the authorities can monitor residents around mountainous areas and provide early warning. This research focuses on the flood observation system as an early warning system to effectively monitor the flood-prone mountain slopes in real time while taking into account the cost, time efficiency, and safety measurement. The proposed system design includes the integration of sensors into the microcontroller, and the communication between the posts using LoRa and SIM900 sends data to the cloud server via the Internet. All sensor readings for each post are displayed on the app, and alerts are sent via SMS and the app.

waterlogged areas feel the brunt of widespread climate change because of global warming and flooding in these areas, especially flash floods. Flash floods are caused by the main and triggering factors that determine their location, frequency, and scale. High-intensity rainfall is the main source of flash floods in hilly areas, especially landslides in areas with loose rocks [3].
Reducing the risk of flood disasters is carried out by constructing and structuring building facilities and infrastructure and requires spatial planning based on disaster mitigation as an effort to improve life safety and comfort and preserve the environment. Therefore, in this study, we aimed to analyze and monitor flooding on the slopes of the mountains by measuring the height and velocity of the water and periodically monitoring the rain using Artificial Intelligence Internet of Things (AIoT) technology. Disasters will not stop just because of the use of IoT technology, but this technology can help predict early warning systems and disasters such as floods [4]. The functioning of this tool is shown in Fig. 1. It works by coordinating multiple nodes using long range (LoRa) communication technology. LoRa is one of the low-power wide-area network (LPWAN) communication systems with long-distance transmission capabilities. Although LoRa technology still has shortcomings in secure localization systems, ZigBee comparisons reveal that the reliability for LoRa technology can be increased up to 45% so that it can meet the required system unit specifications [5,6]. The communication between posts using LoRa and SIM900 sends data to a cloud server via the internet. Furthermore, all sensor readings of each post are displayed on the App, and alerts are sent via short message service (SMS) and via the App. Moreover, each node has sensors to measure rainfall, water flow rate, and water velocity in determining the potential for flooding in an area connected to LoRa, as shown in Fig. 1. The method of this paper is to use a fuzzy approach to implement various modes of intelligent control. The proposed system uses a fuzzy algorithm to calculate which output control signal the input signal of each environmental sensing device should correspond to. The system will execute various early warning hardware or communication devices according to the output control signal. Therefore, the system will achieve the protection goal of active sensing and intelligent early warning.

Method of using fuzzy
The proposed early warning system for flash floods is an architecture that uses a network of sensors to integrate with the Internet. In this section, we describe the use of fuzzy methods to calculate and analyze various environmental variables. In this method, the input and output variables of fuzzy control must be specified, and the variable elements are set according to the optimal range of growth. The fuzzy set is shown in Table1. There are four inputs and one output was used in this system. The first input is rainfall intensity, water speed, water level, and steeper slopes or relief. The output on this system is a warning system which is classified into three categories, namely normal, cautious, and dangerous. Table 2 shows the range of input membership functions, wherein, we can see the size range of each existing prefix. The rules were generated from logical reasoning and expert knowledge; some of these fuzzy rules are listed in Table 3. The advantages of using fuzzy control are: on the one hand, it does not require an accurate mathematical model, and on the other hand, it can integrate the knowledge of human experts into the design process of the controller. When performing fuzzy control, the behavior of the controlled system is described by a set of fuzzy rules, and these fuzzy rules use semantic fuzzy information instead of mathematical equations. Therefore, the knowledge of human experts can be converted into fuzzy control rules, which reduces the complexity of designing the control system. However, in many applications of fuzzy systems, the technical knowledge describing the expected system behavior is contained in many data collections. In this way, system designers can only artificially seek the if-then fuzzy rules from these data collections, and this work often requires the collection of a large number of data collections and a lot of effort. Each membership function has an important role in determining the potential for flooding in mountainous areas of Indonesia. Because the intensity of rainfall has the greatest influence on flooding (then in this prefix the variable is divided into five) if the rainfall intensity is abnormal, it triggers another membership function.

Related research
Babu et al. [7] proposed an alert system to monitor efficiently critical flood-prone and earthquake areas on a real-time basis. They used a water level sensor, rain sensor, and MPU6050 sensor as the main focus of their study and examined how the water level  sensor detects floods and the vibration sensor detects earthquakes simultaneously. In their system, the messages are sent via global system for mobile communications (GSM), and when flood-prone areas occur, they provide solar energy through the solar panel to charge the entire system. As a result, this system can send packet data to the ThingSpeak cloud server via the internet, and the global positioning system (GPS) installation can track people who are affected by floods and earthquakes. Shankar et al. [8] proposed a system to detect the impending flood and monitor any other climate parameters, by the weather forecast and rain sensor. They use an ultrasonic sensor, water level sensor, and water flow sensor in their study and tried to determine water level in dams, rivers and kept track of the rate of flow of water, whose values are displayed on the liquid crystal display, The data is then sent to the blynk App. Light-emitting diode (LED) and buzzer are for a dangerous situation, and an alert message is sent through the blynk App and SMS through the GSM modem. As a result, their parameter can be updated once every three hours to monitor the parameters that may cause flooding. In their study, Devaraj Sheshu et al. [9] aimed to alert the authorities about an imminent flood by monitoring the water level in the sewage system in urban areas. They used sensors to obtain the realtime data on water level of water bodies and the flow rates. The data were transferred to the controller over Wi-Fi using NodeMCU. The controller Raspberry Pi 3 will update the sensor data graph on the website and provide weather data from the internet. The result is an alert will be provided if the values are not within the safe levels. The sign includes a buzzer sound and also an SMS to the concerned authority using the Twilio platform. In the study by Saragih et al. [10], the authors proposed an AIoT system that can monitor reservoirs. They used an ultrasonic sensor as the primary focus of their study to assess the difference between the use of an ultrasonic sensor and control using a stepper motor. The sensor used can measure water level and water volume. The system was designed in real-time based on the AIoT with a web interface so that the public could directly monitor it. The outcome was the installation of the ultrasonic sensor and the stepper motor to determine water level activity from low to high levels with high output displayed on the serial monitor and web server. Likewise, Ali et al. [11] proposed an early flood detection, warning, and notification system. They used a flow sensor, sonar sensor, and rain detector as the main focus of their study and examined real-time data collection on the riverbanks with onsite sensors. This telemetry data was sent to an online platform for processing. The result is showed that this system is very efficient and very useful in the practical by testing the water instantly, as shown in Fig. 2. Figure 3 shows the system architecture of this study. The architecture of the system includes three different layers: the physical layer, the network layer, and the application layer. In the physical layer, some sensors are connected to the network layer that has LoRa and subscriber identity module (SIM) cards. All sensor readings from each post are displayed on the App, and an alert will be sent via SMS and App.

Heltec LoRa 32
LoRa has become a key enabler for multiple LPWAN technologies [12]. It is a modulation technique derived from chirp spread spectrum (CSS) technology. While there are many types of LoRa, the one used in this study was Heltec LoRa 32. It has three wireless features: Bluetooth 4.2, Wi-Fi 802.11, and the LoRa, and all of this can be used simultaneously. This type of network with a reach of 3.6 km is through a simple antenna. Figure 4 shows the hardware structure of the front Heltec LoRa 32. Fig. 2 Feature comparison. This telemetry data was sent to an online platform for processing. The result is showed that this system is very efficient and very useful in the practical by testing the water instantly Fig. 3 System architecture. The architecture of the system includes three different layers: the physical layer, the network layer, and the application layer. In the physical layer, some sensors are connected to the network layer that has LoRa and SIM cards Figure 5 is the GSM SIM900 structure. SIM900 GSM/general packet radio service (GPRS) shield is a GSM modem that can be integrated into a significant number of AIoT projects, and this SIM900 GSM/GPRS module can be used to transfer data to the server [13]. This one can connect to the internet over a GPRS network, send and receive a message, and place and receive phone calls.   Figure 6 is a type of rain gauge which has a tipping bucket. Per tip is 0.053 inches or 1.346 mm of rain. Furthermore, this rain gauge has a magnetic sensor, which works when the magnet attached to the tipping-bucket moves a magnetic switch as a tipping bucket, thereby affecting each tip's momentary switch closure. The rain data is saved in a data logger, which records the time of each tip. The devising of more inexpensive mid-range and long-range radio systems for Wireless Sensors Networks (WSNs) makes this type of sensor more practical and robust in studying rainfall over a wide geographic area [14].

Water flow meter sensor
The water flow sensor consists of a copper body, a water rotor, and a hall-effect sensor. When water flows through the rotor, the rotor rolls its speed changes with different flow rates and the hall-effect sensor outputs the corresponding pulse signal. In this study used a water flow meter sensor Sub Robotics YF-S201 which can work up to 30 L of water per minute, work at temperatures of − 25 to 80 °C, and at 35-80% RH humidity. This water flow sensor will record the amount of water and all this data can then be sent to the server via LoRa and SIM900 [15]. See Fig. 7, for hardware structure. Figure 8 is a high-precision tilt sensor's structure. The tilt sensor uses an accelerometer to measure tilt angles between 0° and 180° with a precision of 0.1°. However, for detecting the slope on the slope, it is only used between 0° and 45° because the slope angle that exceeds the threshold can affect the flow of water during flooding. This sensor is also equipped with an internal LoRa-based antenna which has a very wide range. This sensor has a battery capacity of up to 5-10 years depending on usage; it can also withstand temperatures between − 40 and + 70 °C during operation and + 100 °C when in storage.  Figure 9 is a flowchart that shows the working system. The sensor system detects the data by using the fuzzy method that the system will determine the output variable in the system. The data is then be sent to the cloud management platform for data processing and then to the application for real-live data and flood early warning via SMS and Application.

Presentation of result
As previously discussed, rainfall intensity has an important role in determining the potential for flooding on mountain slopes in Indonesia. In the rules menu, we can set the desired result of the warning system, but in the experimental example in this study, we used the default rules from Matlab. The results are presented in Fig. 10a and b. As shown in Fig. 10b, rainfall intensity has an important role in determining the potential for flooding in mountainous areas in Indonesia. On the graph, the blue color indicates a small rainfall so that it does not have much impact on the potential for flooding, followed by a light blue color which indicates moderate rainfall, then is Fig. 7 Water flow meter sensor. This water flow sensor will record the amount of water and all this data can then be sent to the server via LoRa and SIM900 Fig. 8 Tilt sensor. The tilt sensor uses an accelerometer to measure tilt angles between 0° and 180° with a precision of 0.1°. However, for detecting the slope on the slope, it is only used between 0° and 45° because the slope angle that exceeds the threshold can affect the flow of water during flooding the color Tosca which indicates heavy rainfall, and finally yellow color indicates storm rainfall and large storm. From this, we realize that the warning from the system starts working on the light blue graph (moderate rainfall) and above. During trial and error, some abnormal data were obtained when incorrectly determining the rules in this fuzzy method. As shown in Fig. 11a, this abnormal data occurs when incorrectly setting the rules where the steeper slopes and water level rules seem to fluctuate which makes the system difficult to read and determine the right output. On the other hand, according to Fig. 11b, it looks normal from the rainfall intensity side but an uphill water slope results in abnormal data, because the rainfall intensity has the most influence in determining the potential for flooding, although here we can see the region of slow rainfall intensity but with sudden uphill water slope. When Fig. 9 System flowchart. The sensor system detects the data by using the fuzzy method that the system will determine the output variable in the system. The data is then be sent to the cloud management platform for data processing and then to the application for real-live data and flood early warning via SMS and Application the rainfall intensity is slow all input membership functions should not be affected. That is why Fig. 11b is included in the abnormal graphic.

Analysis of the mathematical model of this research
After field surveys and multi-stakeholder discussions, early warning methods were analyzed, based on two parameters, namely the intensity of rainfall and flood timing.

Intensity of rainfall
The Gumbel theory of distribution is used to distribution for intensity duration frequency (IDF) analysis because it is suitable for modeling maxima. It is simple and used only when extreme events occur (maximum values or peak rainfalls). The formula is as follows: (1) P T = P ave + KS  . 11 Abnormal graphic result a warning system (Z-axis) with the input parameter of steeper slopes (Y-axis) and water level (X-axis); b warning system (Z-axis) with the input parameter of rainfall intensity (Y-axis) and water speed (X-axis). It looks normal from the rainfall intensity side but an uphill water slope results in abnormal data, because the rainfall intensity has the most influence in determining the potential for flooding, although here we can see the region of slow rainfall intensity but with sudden uphill water slope In the formula, P T : Frequency precipitation (in mm) for each duration with a specified return period T (in a year), P ave : Average of the maximum precipitation corresponding to a specific duration, K: Gumbel frequency factor, S: Standard deviation of P data.
Where each factor is given by: The frequency factor (K) multiplied by the standard deviation gives the departure of desired return period rainfall from the average. Then the rainfall intensity (I T ) is obtained using the formula: In the formula, P T : Frequency precipitation (in mm) for each duration with a specified return period T (in a year), T d : Duration in hours.

Timing of flood
To calculate the timing of flood/ concentration period, the formula is as follows: In the formula, t p : the timing of flood arrival (minute), re: effective rainfall intensity (mm/hour), A: Catchment area (km 2 ), C: Coefficient.
Another equation that may be used is the Izzard equation, where some topographic factors are considered as contributing factors (distance of stream surface, slope of the field, both forming a restriction coefficient for the runoff flow and the concentration period). The formula is as follows: In the formula, tc : Concentration time, L: Length of flow, I: Intensity of rainfall, cr: Coefficient of flow resistance, s = slope of the field.

Steeper slopes
A steeper slope is a line that describes the direction and the steepness of a line. Slope can be expressed in angles, gradients, or grades. a. Slope expressed as an angle To calculate steeper slope expressed in angle, the formula is as follows: In the formula, S angle : angle (rad, degrees (°)), x : Horizontal run, y : Vertical run. b. Slope expressed as the gradient To calculate Steeper slope expressed in gradient, the formula is as follows: In the formula, S grade : grade (%), x : Horizontal run, y : Vertical run.

Discussion and analysis of experimental results
The result of this study is a prototype of the flood detection tool, its application, and the use of SMS. This flood detection application is based on the android function, which can display rainfall data and water velocity on a regular basis and display early warning notifications about flooding, which can be seen in the bell sign on the home page. Figure 12a shows the options for POST, Rainfall Data, and Water Flow Data. Figure 12b shows the water velocity and rainfall intensity in each post as a whole, while Fig. 12c shows the water velocity data that has been recorded every 10 min, making it easier for users to monitor the condition of the water in the river. Figure 12d shows the rainfall amount and duration data on the rainfall data page at every 10 min. All data collected from this monitoring will facilitate the system in detecting impending floods.
This study also provides an early warning notification of flooding via SMS as shown in Fig. 13, to people around mountainous slopes who cannot use the application. Notification via SMS will not be stopped until the user sends a reply message in the form of the word STOP. The notification consists of three levels in early warning: yellow, orange, and red. The yellow sign indicates impending rainfall, the orange sign indicates heavy rain and the potential for landslides, and the red sign indicates a possibility of flash flood.
This prototype consists of two parts, as shown in Fig. 14a. The first one is for the cage as shown in Fig. 14b; the material used for the cage box for the bottom used concrete and for the cage used to iron that has been painted with anti-rust coating. Figure 15a shows the image of essential tools. An iron box is used that has been painted with an anti-rust coating with red color, and the box can open. There is an indicator light red button in the front compartment to turn the appliance on and off, yellow for error, and green for correct. So, the condition of this tool can be assessed without the need for opening up the box to see the contents of the devices. There are two sensors here. The first one is the rain gauge sensor as shown in Fig. 15a. This rain gauge sensor already has a hole in the box and cage so that the calculated water can be expelled directly into the ground. This type of rain gauge has a tipping bucket, so when the raindrop goes inside the sensor, the magnetic sensor moves a magnetic switch and affecting each tip momentary switch closure.
The rain data will be saved in a data logger, which records the time of each tip. The second part is the water flow sensor as shown in Fig. 15b. This sensor consists of a copper body, a water rotor, and a hall-effect sensor. When the water flows through the Thus, scientific and reasonable measures must be undertaken to protect the life safety of the people and reduce property, making flood monitoring and early warning of rivers particularly important and urgent. However, this study has a few limitations such as a complex regional geological environment, wide monitoring range, inconvenient transportation, poor communication conditions, and limited capital investment. At  14 The hardware devices of the entire outdoor monitoring system a the protective iron frame and the main body of the sensing device; b the system's protective peripheral frame. This prototype consists of two parts. The first one is for the cage; the material used for the cage box for the bottom used concrete and for the cage used to iron that has been painted with anti-rust coating this stage, the commonly used flood monitoring and early warning methods cannot solve the above problems simultaneously. In response to the above situation, this research designed a special plan for flood monitoring and early warning in mountainous areas, and achieved the following results: (1) A complete research on key technologies for flood monitoring and early warning in mountainous rivers.
(2) The flood monitor was successfully developed and used to realize remote real-time monitoring of floodwater levels.
(3) A monitoring and early warning system were built to integrate flood level monitoring, regional rainfall monitoring, remote wireless transmission, GSM conversion, and other technologies.
(4) The study involves electronics, geology, disasters, and other disciplines, reflecting the practice and exploration of interdisciplinary research in the field of disaster monitoring and early warning.
(5) The research on key technologies of monitoring and early warning have been closely integrated with practical applications, and the remote flood monitoring and early warning of the river basin have been launched.  . 15 Sensor and microcontroller device a basic microcontroller circuit and sensor connection, b the water flow sensor. The first one is the rain gauge sensor. The rain data will be saved in a data logger, which records the time of each tip. The second part is the water flow sensor  Figure 16a and b show that as the signal dwell time increases, fewer position updates are required. The influence of the number of sensors on the cost of packet delivery is represented in Fig. 16a and b. Figure 16a shows the ratio of the number of sensor nodes to the accuracy of the system's position calculations. The greater the number of sensors in the system, the higher the accuracy of its positioning. The proposed system yielded accuracy at least 31% higher than the prevalent system. Figure 16b shows whether the capacity for packet transmission decreased when more sensors were used. When the number of sensor nodes increased, the capacity of packet transmission was higher than that reported in earlier studies [7][8][9][10][11][16][17][18].

Conclusions
This study focused on monitoring and providing early warnings about flooding on mountain slopes. Floods are dangerous natural disasters because floods can also cause casualties and drown the victims' property. In this study, we present a tool that can monitor and predict the occurrence of floods through SMS and Applications, which is expected to help people evacuate them as early as possible. Due to internet network issues in the mountains, this research focused more on using LoRa in sending messages between devices. We used the fuzzy method to calculate and analyze various environmental variables. The results of analysis in Indonesia indicate that the intensity of rainfall has an important role in determining the potential for flooding on mountain slopes because it can affect other factors such as water velocity and water level. The trial and error results led to some abnormal data when incorrectly determining the rules in this fuzzy method. This abnormal data occurs when the rules are incorrectly set, wherein the steeper slopes and water level rules seem to fluctuate, making the system difficult to read and determine the right output. In the future, we hope that more parameters can be added and developed to provide more accurate analysis results in detecting floods, especially on mountain slopes.
The accuracy of this research on the rainfall warning method is very high. Through the analysis of the rainfall warning model of the mathematical model of this research, the research on related parameters of flood monitoring such as soil saturation was added, and the advantages of the GSM sending module were used for real-time transmission of all users. The communication network in this study uses the LoRa plus GSM mode to carry out efficient and convenient data transmission even in the signal blind zone of the mobile network and fully realize the wireless communication for monitoring and early warning.