IoT based early warning system for torrential floods

Being predominantly a mountainous country, in Bosnia and Herzegovina natural disasters periodically occur, especially floods, which can cause extensive material damage and human casualties. The existing flood defense system is focused on monitoring the situation on major rivers. In contrast, torrential floods are short-lived but turbulent phenomena, causing landslides, extensive material damage and loss of human lives. By collecting data from characteristic points on the terrain and analyzing them, it is possible to detect a situation which could cause torrential floods further in the river basin. Automated aggregation of such data by the competent services could provide timely organization of flood defenses. By integrating hardware components, sensors, microcontrollers with a web server and custom built software, an early warning system was created capable of providing timely alerts to the risks of pouring of the rivers, as well as the emergence of torrential streams or landslides. The system is based on a network of automatic meteorological stations (AMS), which submit data at regular intervals to a central server, where this data is further processed and displayed to persons with appropriate authorization level to access the system.


INTRODUCTION
In Bosnia and Herzegovina (B&H), natural disasters such as floods, landslides, earthquakes, forest fires, droughts and storms occur periodically. These occurrences may vary in intensity and in the time intervals in which they occur. In the last 20 years, the floods of 2001, 2004, 2010 and 2014 have caused enormous damage to agriculture, roads, construction and infrastructure.
Although Serbia suffered the most severely in the floods of 2014, with several major cities completely flooded and landslides in mountainous regions, the Republika Srpska entity in B&H was also flooded in a similar extent. Eastern Croatia and southern Romania also experienced flooding and human victims, Figure  1 [1]. Based on data from these events, B&H produced in 2016 a flood risk map, Figure 2 [1].
In the same time period, the 3rd industrial revolution led to the widespread use of mobile devices and the establishment of a developed communications infrastructure. The 4th industrial revolution brings a gradual transition to systems built upon the infrastructure of the previous, digital revolution. The Internet of Things (IoT) enables the collection and exchange of data between a plethora of sensors, electronic devices and applications, with the aim of analysis of the collected data and providing meaningful conclusions which in turn would help in process automation and timely decision making [2]. Integration of hardware components, sensors and microcontrollers with specialized software allows solving a wide range of everyday problems at the level of the average user: management of heating, air-conditioning, alarm devices, setting of various parameters in the greenhouse, or remote monitoring of health parameters of individuals (elders, sick, children and infants). This is just a simple example of the application of the combination of microelectronics and information technology in everyday life.
The same combination can be applied in order to protect the population and facilities from natural disasters, by monitoring of critical locations in the country's territory, data aggregation and analysis, and finally by timely alerting of the competent services.
In the past few years, researchers and the market have repeatedly addressed this topic. Affordable and open-source microcontrolers such as Arduino make it easy to control various analog and digital devices. It has been present in the industry for over a decade years as a tool that enables the transformation of outdated production equipment into Computer Numerical Control (CNC) machines [3]. The popularity of the Arduino was especially contributed by its simple Integrated Development Environment (IDE), which allows rapid creation of short snippets named Sketches in C++ programming language and their transfer to the microcontroller via a plain USB cable [4]. In recent years, there has been a noticeable shift in the market towards the commercial use of such microcontrollers in everyday life, among other things in systems intended for individual consumers as autonomous alarm systems [5], or as a part of a more complex home alarm system, in both cases with the role of flood detection in basements [6,7,8]. In the research papers published so far, Arduino microcontrollers were used for monitoring the water level at the roads with optional live video stream [9], or monitoring the level of higher running waters near the riverbanks [10]. Arduino's main advantage as a platform for such projects is its affordable price, modularity and variety of sensors that allow reading of different physical quantities, and the possibility of communication with other technical devices wirelessly (WiFi) or over the GSM network.
In the same context the solution of an early warning system solution, described in this paper, was designed and implemented. The system is optimized to the B&H's mountainous terrain, with the focus on torrential floods. Important characteristics of the project that should be emphasized are its modular architecture and the mobility of automatic meteorological stations (AMS), which become operational in the short term after deployment. The size and nature of the system, as well as the area of the observed territory, are dictated by the number of AMSs, the type of implemented sensors and parameters monitored.

FLOODS IN BOSNIA AND HERZEGOVINA
Flooding is а temporary state when a river or stream flows from its bed and covers the surrounding land [11]. The causes of this condition may be: • Climatological, in the form of heavy rains, seasonal snowmelt, or a combination of these factors. • Instigated by human factor, such as inadequate deforestation, agricultural activity, unplanned construction of buildings, terrain damage and the like. River floods are not a rare occurrence in BiH, given the mountainous configuration of the terrain and the fact that a large number of cities are positioned on the riverbanks. In April 2003, the International Bank for Reconstruction and Development (IBRD) published a report concluding that in B&H cca 4% of the total territory and 60% of the lowlands is under constant risk of flooding [12].
Torrential floods are short-lived but extreme events regarding water volume can cause great material damage and loss of life. Landslides frequently accompany such floods, as another factor affecting general safety.
Climate change brings large amounts of rainfall at a particular geographical location, a factor that also requires attention. In the last three decades, increase in frequency of occurrence of local or regional floods has been observed. A good example are the large rainfalls that hit the region in 2014, an interesting phenomenon in synoptic terms, caused primarily due to the characteristic position of the cyclone [13].
The negative impact of the floods from that year was amplified by the inadequate and ill prepared reaction of the countries of the region, caused by the lack of a clear defense strategy and procedures in the event of high water levels on the rivers and sudden torrential floods of mountain watercourses.

EARLY WARNING SYSTEM
The four key stages of an early warning system are [14] risk knowledge, monitoring and alarming, dissemination and communication and response capability.
The risks arise from the combination of danger and potential damage that may occur in a particular place or region. In order to properly assess risk and reduce it to an acceptable measure, it is necessary to possess knowledge on what causes and what are the consequences of such phenomena, as well as the factors that induce the emergence of critical situation. The main tasks of an Early Warning System (EWS) for torrential floods are monitoring of water levels and optionally other parameters at critical locations, data aggregation in the central database, data processing, and if necessary, alerting.
EWS described in this paper can be used as an integral part of the infrastructure to monitor the critical parameters in the field. Based on the acquired data, risk assessment can be provided by analysts, meteorologists within dedicated specialist services, NGOs and other similar organizations, as well as local authorities in the areas where the system is located.

SYSTEM IMPLEMENTATION
The core components of this EWS are the following, fig. 3: • One or more AMSs for data acquisition and transfer • Web and DB servers publically available via internet domain, • Web site / Web application as presentation, analytics and alert layers

Automatic Meteorological Station (AMS)
AMS is the base unit of the EWS, deployed on the terrain. A single unit contains sensors and other electronics required to periodically take readings of current physical quantities and transfer them to the web server. The water level of the torrential streams is monitored for its rapid change, and frequently obtained data are of particular importance. Locations of AMSs deployment are determined according to hydrological experts assessments, as well as in cooperation with the local population. Each AMS has its unique ID and geographical data, i.e. GPS coordinates.
Arduino microcontroller is used for data collection. Ultrasonic sensors read the water levels, combined sensor reads temperature, relative humidity and atmospheric pressure. Soil vibration sensor is optional and can be implemented too, primarily for detecting of possible landslides, and second, in order to obtain additional data for creation a broader meteorological image.
Electrical power for the AMS' autonomous operation is provided by a pair of Li-Ion battery cells, charged by twin 12V/1.5W solar cells.
Single AMS contains the following hardware, fig. 4 and 5: • Arduino microcontroller • Ultrasonic sensor • Atmospheric temperature, pressure and humidity sensor • Vibration sensor • Power supply and storing unit • GSM module  Figure 6 shows the AMS box with external connectors on the front for the ultrasonic sensor, combined temperature sensor and the antenna for the GSM module. On the left side are positioned the connector for Arduino/PC connection, as well as the main power switch. Due to its modest dimensions, ASM can be easily carried and quickly deployed on inaccessible terrain.

Data transfer
Raw sensor data is processed and converted to JSON format by custom made Arduino script. Built-in GSM module sends data to a central web server for further processing and storage in the database. The default frequency of data aggregation is 15 minutes, but can be varied if needed. After the data is sent, the microcontroller is set into hibernation in order to reduce the power consumption. After 13 minutes, it wakes up again and the process starts over.

Web application
Web application in charge for data aggregation, processing and alerting is written in PHP programming language and hosted on Apache web server. The data is stored in MySQL database. The application is hosted on a dedicated web domain, and can be accessed with different types of devices, such as desktops, laptops or smartphones.
The primary task of this web application is to take over the data sent by AMS via SMS in JSON format, decode and store it in the database. The stored data subsequently can be statistically analyzed, and the results can be either displayed on the web page, or exported in XML/JSON format for further analysis or visualization.
The most recent data aquired from AMSs are publicly available, as well as general project and contact information.
Protected pages which can be accessed only by users with appropriate credentials, contain historical data compiled into charts with adequate trends, as well as specialized statistical data required for detailed analysis.

Data transmission
The system is capable of sending SMS alerts to a predefined list of personell, in accordance with their responsibilities or positions within the action plans.
AMS also has its internal alert system, and in the case of sudden significant variation of sensor readings, SMS alerts are sent to the predefined mobile phone numbers, Figure 7.
If the system covers a wider area or region, information can be broadcasted via mass media (radio and TV stations, social networks, etc.) using web technologies and protocols.

CONCLUSION
This early warning system is designed to function autonomously, thanks to its automatic weather stations. Although currently at prototype level, it incorporates standard sensors and microcontrollers that can be purchased on the market at affordable prices, ensuring quick and easy fabrication, installation and commissioning. The applied operating model and built-in electronics allow AMS to have low power consumption, thus providing resilience to weather conditions, regardless of the season. AMS gets activated at specific time intervals, and as soon as the information is dispatched to the central server, it returns to hibernation.
At the current stage of development, the software on the AMS detects extreme variations in the sensor readings over the observed period of time and, if needed, sends alert SMS messages to predefined phone numbers. If several AMSs are implemented in order to cover a larger territory, data analysis and sending of alerts via SMS is conducted by the web server using the SMS gateway.
The system is modular and the number of deployed AMSs depends on the size of the covered territory and terrain configuration. AMSs can be installed along a watercourse in numbers that provides optimal monitoring of parameters and enough data to achieve a sufficient situation awareness, providing ability to the authorities to make the timely decisions which could save lives and reduce material damage.
In the event of major storms or extreme weather conditions, the GSM signal may become disrupted, or entire networks may become unavailable, which further may lead to delayed or incomplete transmission of information from AMSs to the web server. Further research is required to provide alternative modes of communication between AMSs and the web server so as to improve system stability. Currently, the system is available for rent (SaaS -Software as a Service, IaaS -Infrastructure as a service), providing the end user with more favorable financial conditions for the system exploitation.

ACKNOWLEDGEMENT
This project was realized by Enes Šakrak, under the menthorship of assistant professor Miloš Dobrojević, as part of a master's study program in Contemporary Information Technology at Sinergija University in Bijeljina, B&H.