Real-Time Flood Monitoring System Using Raspberry PI

Flood has been a major concern for a very long time and the inability to monitor it in real-time has been a major disadvantage in maintaining a healthy hydrologic process. The main problem in monitoring flood is the amount of time taken for data to reach users and how long the data is relevant for as in monitoring flood, timing is the crucial key. This research proposes a Real-Time Flood Monitoring System that can aid in monitoring flood more efficiently. The system utilizes a set of sensors connected to a single-board computer that determines values in which is vital in monitoring flood. To ensure a fast transmission of data, the values are transferred over Wide Area Network (WAN) to host these values on a remote server. The remote server hosts these data on a website and application which is made accessible for the public with an ease of access. As a result, it can be viewed by users who wish to know the necessary values in determining danger level and further actions can be taken in ensuring their safety. Data which is transferred on real-time allow less time to be taken in order for the news to spread around as time is very crucial in saving people from natural disasters. These data also have a great importance for safety enforcement to be used in determining safety precautions that can be taken in order to ensure the safety of people around a particular area.


Introduction
Flood is the most devastating natural disaster experienced in Malaysia. In Malaysia, there is total of 189 river basins with main channels flowing directly to the South China Sea and 85 of them are prone to become recurrent flooding. The estimated area vulnerable to flood disaster approximately 29,800 km 2 or 9% of the total area in Malaysia, and is affecting almost 4.82 million people which is around 22% of the total population in Malaysia [1]. In this era of rapid rising in technology, the need to have a real-time flood system is essential in ensuring that flood can be monitored and possibly prevented. A real-time system is defined as a type of hardware or software that operates with time constraint while an embedded system is defined as combinations of hardware and software that perform a specific function within a larger system. Embedded system consists of an integrated circuit (IC) at the heart of the product that is primarily designed to carry out computation for real-time operations. Embedded system has ability to control sensor devices with minimum power consumption [2].
It is very important to achieve a real-time system in avoiding flood as time is the critical value in preventing it. Every second counts in monitoring flood. There are few researches that have been done in real-time flood monitoring system that use various approach such as sensor utilizing [3], image processing [4] and satellite remote sensing [5]. In Malaysia, flooding is a disaster that has been around for quite some time. When natural disaster occurs, it may be too late to save lives or even prepare to go through that unfortunate event and frequently, victims will absorb major share of losses since there is no existing real-time system that utilize water level and water flow attributes that can monitoring flood. Most of the systems that exist now has only utilizes water level sensor only. Objective of this paper is to design and develop a real-time flood monitoring system using raspberry pi and transmit data over Wide Area Network (WAN). Figure 1 displays the block diagram of the real-time monitoring system using Raspberry Pi. It consists of three types of sensor -the raindrop sensor, water level sensor and water flow sensor that is connected to the Raspberry Pi. The WiFi module which connects to Raspberry Pi acts as transmitter for the data from sensors to the web server where the data will be stored in the database. This system is accessible by using pc, laptops and also smart phones.

Methodology
The method that is proposed in this project is to utilize Raspberry Pi as the main controller of the flood monitoring system. The value of sensors is sent over Wide Area Network (WAN) to a remote computer which will then host the data on a website on WAN. The system is constructed using appropriate components taking an account for every aspect such as size and cost. The system also is designed for the use of a system tank instead of a river, further modifications need to be carried out in order to get the system fully functional for the use of rivers.
Ultrasonic sensor is used in this project to measure water level. The state of ECHO will be in low state (0 V) until the sensor is triggered. Once it reflects back to ECHO, it will be set in a high state (5 V). Both TRIG and ECHO pin is connected to GPIO 25 and GPIO 45 respectively with 330-Ω resistor connected between 0 V and GPIO 25 and 470-Ω resistor connected between ECHO pin and 330-Ω resistor. Error! Reference source not found. shows the schematic diagram for the connection of ultrasonic sensor to Raspberry Pi.
Based on the schematic diagram of raindrop sensor in Error! Reference source not found., the VCC is connected to a 3.3 V pin and GND pin of the control board is connected to GND of Raspberry Pi. To receive the input from the sensor, DO is connected to GPIO 4. Based on the schematic diagram of water flow sensor in Error! Reference source not found., the VCC of the water flow sensor is connected to a 5 V DC power and the GND is connected to ground to provide path for current to flow. To receive input from sensor at the Raspberry Pi end, GPIO 27 is connected to the signal.   Figure 3 shows the flowchart of Flood Monitoring System. Raspberry Pi acts as a main board which merely fetches data form sensors and transmits it via POST HTTP request to a web server located at a remote network. In order to reach a remote server, it need to posts the data via WAN. At the server side, PHP scripts awaits incoming connection while at the client side, the program execution generates a POST HTTP request to the PHP scripts residing in the web server. Once it has validated the credentials at both client and server side, it will then transmit the values from sensors to web server.
Upon receiving values from sensors, the same PHP scripts that accept it then call SQL syntax to INSERT the statement into MySQL database. After it has successfully updated on MySQL database, a PHP script is used to again fetch MySQL's database content in order to do a further alteration to the visualization of the data. At the same time, Java application will fetch value in MySQL database in order to display a live reading on the application. Data which reside in MySQL database will be fetched in order to display in table and graph on website.

Result and Discussion
Real-Time Flood Monitoring System prototype can be viewed in Figure 4 as mentioned in the methodology. As shown in Figure 4 that the prototype system has ultrasonic sensor measuring water level and water flow sensor measuring water flow that stream through the water flow sensor utilizing air pump. The air pump simulates river water flow during flooding event.  Figure 5 display the main user interface of Real-Time Flood Monitoring System that is used to access the sensors data and view in table and graphs. The system consists of 3 modules which are table, graph and average modules. Table module is to tabulate results with timestamp of current date and time. Graph module is to visualize the data in graphs that has been tabulated before meanwhile average module is to calculate the latest five data. The Real-Time Flood Monitoring System also provides real-time display user interface as shown in Figure 6 where user could view the water flow, water level and rain condition. The user could also view previous sensors reading for each attribute by clicking historical data button.

Conclusion
As a conclusion, this paper presented the design and development Real-Time Flood Monitoring System using Raspberry Pi by utilizing water level and water flow attributes that can monitoring flood. The flood monitoring system can be access via internet through the web page that connected to the database server which resides the sensor data accumulated. The data can be viewed in real-time and also historically via web page or java application. In future, prediction module can be added in order to anticipate critical flood events.