ON INFORMATICS

— Bandung is one of the areas with high rainfall that can increase the volume of river water, which, if not handled properly, has the potential for significant floods that can cause material damage and loss of life. With this problem, the authors' rationale for designing a control system for flood prevention. This system develops prototypes using Internet of Things technology and fuzzy logic. For Internet of Things technology, the author uses Arduino, which controls sensors and actuators, while Raspberry Pi is used to process data. In addition, the author uses ultrasonic sensors to measure the water level and a water pump to control the water level. So, if the water level exceeds the specified limit, the pump will move the water to another place, in this prototype, using an aquarium. For fuzzy logic, the criteria used are dry, filled, and full. In addition, this system is equipped with a website-based dashboard used to monitor real-time data from the sensor. The results of this study indicate the system is running well, with an average error of 32.2%. This indicates that the system has been well designed because the errors obtained are feasible to be minor, although there are several influencing factors, such as prototype construction and sensor readings. Thus, this prototype can be applied as a reference for making a real system for flood control.


I. INTRODUCTION
Indonesia is a country that has fairly high rainfall.With this, people who are located near rivers are often affected by flooding [1].Floods are causing increasing havoc in a rapidly urbanizing world that lasts longer, becoming more unpredictable and damaging [2].Flash floods, mainly initiated by intense rainfall, are the most catastrophic natural hazards which cause disruption in the environment and societies [3].Intense and long-lasting rain is the most common cause of river (fluvial) floods [4].In the last five years, flooding in Indonesia has occurred about 4,388 events, based on data from the National Disaster Management Agency (BNPB) [5].One area that often occurs in flood disasters is the Citarum River area.Citarum River is a river that has a length of about 225 kilometers in the province of West Java.When the rainy season arrives with high intensity, the river embankments on the Citarum River can burst, causing the potential for major flooding.The variability of river conveyance capacity has been a driver of changes in flood properties [6].On March 26, 2021, floods occurred due to heavy rains which caused the Citarum River to overflow.As a result of the overflow, five sub-districts located in Bandung Regency were Dayeuhkolot, Baleendah, Bojongsoang, Cicalengka, and Rancaekek, because this disaster cause damage to 4,165 houses, eight places of worship, and two schools and affected 19,950 people.This has resulted in damage to the infrastructure of residential areas located around the Citarum River and threatens the safety of these residents [7].So, from this fact, the overflow of water that occurs in the Citarum River is difficult to predict every year and the absence of technology used as flood prevention that can minimize the impact of flood damage is the focus of the problem at this time.Enormous potential exists for new technologies to support flood disaster risk reduction [6].Hence, the effective flood mitigation management is needed [8], [9].
One of the technological innovations that can be utilized is the use of Internet of Things technology.It aims to make use of smart technologies by connecting things anytime to accomplish anything at any place [10].With the rapid development and implementation of smart and IoT-based technologies, there are various possibilities for technological advancements for different aspects of life [11].Heterogeneous communities have broadly adopted its potential benefits [12] in changing how people interact with their immediate environments [13].Hence, Internet of Things (IoT) technology has been widely implemented in prevention efforts to deal with various disasters, one of which is flooding [14].The Internet of Things (IoT) is a concept/scenario where an object can transfer data over a network without requiring human-to-human or human-to-computer interaction [15].
The IoT uses the Internet as a medium to enable machineto-machine communication, both locally and remotely.This technology also allows users to monitor the sensor remotely.These benefits and opportunities offered by this technology have attracted much attention from industry and academia [16].In this study, IoT technology was developed into a prototype that can prevent flood disasters by providing a system for automatically opening and closing the floodgates using fuzzy logic, but, in this study, using a water pump that can be on or off based on fuzzy logic.Fuzzy logic has emerged as a powerful technique in analyzing hydrologic components and decision-making in water resources [17].It is to control an automatic stream engine [18].The fuzzy logic system consists of principal components: fuzzification, rule, and inference, which create control actions and defuzzification [19].If the water level exceeds the limit, the water pump will turn on, and the water will flow into a reservoir.In addition, this system will be equipped with a web service that can be used for monitoring data such as water level data, floodgate time data, and IoT data currently in use as well as predicting water levels.The design of this system is also used as a consideration for researchers to apply an automatic river door opening and closing system and the Internet of Things in real life to prevent flooding.

A. Materials
The materials used are divided into six parts as follows:  Ultrasonic Sensor HC-SR04. Actuator Relay.
 Microcontroller ESP-WROOM-32. Raspberry Pi.  LoRa ra-02 sx1278. Water pump.Ultrasonic Sensor HC-SR04 is an ultrasonic wave-based distance-measuring sensor.The advantage of this sensor is the detection range of about 2 cm to the range of 400-500 cm with a resolution of 1 cm [20].This sensor is a ready-to-use ultrasonic sensor that functions as a sender, receiver, and controller of ultrasonic waves [21].This research also utilized an actuator relay, microcontroller ESP-WROOM-32, and raspberry Pi, a mini-computer device the size of a credit card.The Raspberry Pi has a Broadcom BCM2835 system chip (SoC), which includes an ARM1176JZF-S 700 MHz processor (the firmware includes a number of "Turbo" modes so users can attempt overclocking, up to 1 GHz, without affecting warranty), a VideoCore IV GPU, and originally shipped with 256 megabytes of RAM, then upgraded to 512MB [22].This study is used for data processing and decision-making.Another material used in this research is LoRa ra-02 sx1278, and the last is water Pumps.The researchers used two pumps that are controlled by an actuator which is useful for draining water into the container.Starting from the height of the water surface that is placed in an aquarium, this water level will be measured with an ultrasonic sensor.This sensor will record the water level in centimeters (cm).After the ultrasonic sensor detects it, the ESP32 will calibrate the sensor with a computer.After that, the Raspberry Pi will process the existing data.This data is sent from the ESP32 via Long Range (LoRa).LoRa is a wireless technology that offers long-range with low consumption.LoRa can reach a distance of up to 2 km [23].
In the Raspberry Pi, fuzzy logic will be carried out, which will act as a decision-maker whether the water level exceeds the limit or not.If the water level exceeds the limit, the actuator relay will turn on and vice versa.From the Raspberry Pi, data will be sent in two ways: to the database, which will later be displayed to the website in real-time, and to the ESP 32, which will control the actuator relay whether it turns on or off via LoRa.A visualization of the gate control system prototype is shown in Fig 2. 2) Fuzzy Rule: There are two fuzzy rules for each simulator: the aquarium and the gutter.For aquarium values 0-8 cm, 8-12 cm, and 12-14 cm for shallow, medium, and high, respectively.For gutters, the values are 0-2 cm, 2-5 cm, and 5-8 cm for shallow, medium, and high, respectively.This method takes the average value using weighted membership degrees defined as follows: where y is the crisp value, and µ(y) is a membership degree of crisp value y.The following is a description of the rules for fuzzy logic applied in the prototype in Table I.

TABLE I. RULE FUZZY LOGIC
3) Membership Function: The membership function (MF) is a curve that defines the features of a fuzzy set by assigning to each element a corresponding membership value or degree of membership.It maps each point in the input space to a membership value in a closed unit interval [24].The most important fuzzification stage is determining domain and function boundaries membership in each set of variables [25].The membership function used in this study is trapezoidal.This function has several x values with a membership degree equal to 1 [26].Fig. 3 displays the trapezoidal membership function.The fuzzy output set of each rule will be reshaped with a matching number and defuzzied as needed after combining all these reformulated fuzzy sets [27].The following is the mathematical equation used for each membership function.Membership for function for the reservoir (aquarium):   The membership functions of the aquarium container are high when the value of cm ≥ 12, the medium is normal when the value of 8 ≥ cm ≤ 12, and the shallow is based when the value of cm ≤ 8.While the membership functions of the gutter container are high when the value of cm ≥ 8, medium is normal when the value of 2 ≥ cm ≤ 5, and shallow is based when the value of cm ≤ 2. The flowchart in Fig. 6 describes the flowchart of the fuzzy logic used.

A. System Testing
Fig 8 shows the results of the tests that have been carried out.For the test, samples were taken with a size of 10cm, 30cm, and 50cm to measure the sensitivity of the ultrasonic sensor to water level.To calculate the error using standard deviation.
Where X is the value in data distribution, and the : is the population mean, and N is the total number of distributions.The standard deviation for each length of 10cm, 30cm, and 50cm are 0.34, 0.44, 0.34 for sensor A, and 0, 0, 0.49.Based on the test results of sensor sensitivity and fuzzy logic implanted, this system has been functioning properly.When the water level is beyond the minimum limit, the algorithm immediately carries out its duties as a decisionmaker for the actuator to turn on the water pump to circulate water to another container and vice versa.After that, the data would be sent to the database and displayed on the website, shown in Figs 10,11,12,and 13.Here, the authors used web applications.Web applications are client-server software applications that users can run via a web browser.Web applications are very popular because users only need a web browser to access them without having to install additional software and support cross-platform compatibility.Commonly used web applications are webmail, online buying and selling, online auctions, instant messaging services, and others [28].In addition to only displaying the dashboard, the website can also display data from the sensors used and the status of these sensors.If the sensor does not send data for 1 minute, then the sensor status is declared inactive, and vice versa.
However, the water level can be predicted for the next week so that officers can prepare if the water level increases drastically using Simple Linear Regression.Linear regression is a statistical tool used to determine the effect of one or several variables on one variable.Regression measures how much a variable can affect other variables such that the value of a variable based on other variables can be predicted [29].

;
< + >? (9) Notes: Y = dependent variable (dependent variable) ?= independent variable (independent variable) < = Constant (intercept) > = Parameter of Independent Variable Regression IV.CONCLUSION The IoT control system is one of the most significant interests in flood disaster control.This study focuses on prototyping fuzzy logic control to obtain a higher level of accuracy for controlling the water pump.Fuzzy logic is a systems methodology troubleshooting control, as appropriate to implement on the system, starting from a simple system, a small system, embedded systems, PC networks, multichannel or acquisition-based workstation data, and control systems [30].The simulation results determine the control of the water pump according to the air level parameter in two places: the gutter, which functions as a river, and the aquarium, which functions as a reservoir.Hardware implementation and control via IoT using LoRa and monitoring data in real-time using the website.The experiment has been verified, leading to good results, such as low error accuracy rates on sensors and systems and effective water pump control through the proposed system.Future studies can implement this prototype technology in the Citarum River area, which is useful for controlling and preventing flood disasters, especially in the Bandung area, which can minimize the impact of damage due to flood disasters.
Design: For the design system used, the author describes it in a block diagram described in Fig.1

Fig. 3
Fig. 3 Trapezoidal membership function graphIn this study, we adopt fuzzy logic created by Mamdani.The fuzzy set defines the consequences of the If-then rule.The fuzzy output set of each rule will be reshaped with a matching number and defuzzied as needed after combining all these reformulated fuzzy sets[27].The following is the mathematical equation used for each membership function.Membership for function for the reservoir (aquarium):

Fig 4 and
Fig 4 and Fig 5 describe the membership function of each container.

Fig. 13
Fig. 13 Water level prediction page