An Autonomous Low-Power LoRa-Based Flood-Monitoring System

: The development of Internet of Things (IoT) systems is a rapidly evolving scenario, thanks also to newly available low-power wide area network (LPWAN) technologies that are utilized for environmental monitoring purposes and to prevent potentially dangerous situations with smaller and less expensive physical structures. This paper presents the design, implementation and test results of a ﬂood-monitoring system based on LoRa technology, tested in a real-world scenario. The entire system is designed in a modular perspective, in order to have the capability to interface di ﬀ erent types of sensors without the need for making signiﬁcant hardware changes to the proposed node architecture. The information is stored through a device equipped with sensors and a microcontroller, connected to a LoRa wireless module for sending data, which are then processed and stored through a web structure where the alarm function is implemented in case of ﬂooding.


Introduction
Wireless sensor networks (WSNs) include many fields of application, made increasingly possible by Internet of Things (IoT) solutions. The ability to easily connect devices for the purpose of data collection and to create networks with different specifications makes these flexible structures suitable for a wide variety of applications [1][2][3][4][5][6][7][8][9][10][11][12][13][14]. Very often, one of the characteristics of a node belonging to a WSN is extremely low energy consumption, since this device must operate via battery power [15][16][17][18]. In this regard, low-power wide area networks (LPWANs) are considered particularly suitable thanks to their relatively low operating power and the large distance covered [19,20].
Among the new leading technologies in this area, we consider LoRa [21][22][23], based on the chirp spreading spectrum (CSS) technique, currently most frequently used with the LoRaWAN Medium Access Control (MAC) level [24][25][26]. This technology stands out for its easy use, its high energy efficiency, and its excellent performance in environments where the signal to noise ratio (SNR) is low. WSN structures are particularly useful in environmental phenomena monitoring, especially in scenarios where the occurrence of an event can lead to significant safety problems [27][28][29].
Flooding is a common event in rural and urban environments where the presence of water is due both to geographical features, such as rivers or lakes and to the proximity of sensitive urban elements. Flooding can present a high level of risk. For example, the flooding of roads can damage infrastructure. Besides endangering public safety, this can have economic and social repercussions. [30,31]. Flooding can be caused by adverse rain conditions, wind, temperature changes [32]. A forecast based on a theoretical approach to this event is complex [33] and often not rapidly obtainable, therefore the development of early warning systems [34][35][36][37][38][39][40] is useful and necessary. In this work, a flood-monitoring system was developed, designed for installation and use in urban and non-urban settings, to obtain an early warning of the possible phenomenon. This would enable the implementation of countermeasures that would inform the user of the possible risks or, in the event of service disruption, the implementation of resolution strategies. One of the main objectives of this paper is the reliability of the device, for which a customized electronic board has been created. It includes the data collection and transmission functions, powered by a battery supported by a solar harvesting mechanism. Another important specification is the modularity of the configuration which will be discussed later.
The implemented system is formed by a sensor node based on a low consumption microcontroller, equipped with a LoRa wireless module for data transmission, all powered by a 3.7 V lithium battery recharged through sunlight using a photovoltaic cell and a dedicated charging module. Using this approach, it was possible to obtain a good energy performance, while maintaining the possibility of obtaining a wide coverage range for radio communication.
This paper is structured as follows. Section 2 reports an overview and comparison with related works. At the beginning of Section 3, an overview of LoRa and LoRaWAN is provided. In Section 3.2 the general architecture of the system is described. Then the design and the practical implementation of the hardware structure that creates the WSN sensor node, as well as the organization and description of the web section for data manipulation, are presented. In Section 4 the article reports the results related to the energy performance of the node. Finally, it is shown that the system can be used to manage the remotely received data, on which the early warning can be implemented.

Related Works
In Table 1 a comparison with selected related works, dealing with WSN implementation of flood-monitoring systems, is reported. All the considered works deal with a flood-monitoring system, even if with different approaches. In [34,35], a neural network-based approach is shown. The prediction models offer a useful instrument for the time of flooding estimation but strongly rely on the coefficient of determination of the algorithms. A more detailed description of the hardware configuration of the structures is missing, as the works are more focused to describe the developed neural model. In [36], a GSM-based flood and earthquake detection and rescue system is presented. An earthquake or flooding event triggers an SMS alert to authorities and sonorous and visual alarm for the nearby civilians. The system is composed by an Arduino Mega 2560 [41] based sensor node and a separated alarm unit that includes a siren and alarm light-emitting diodes (LEDs), along with an ESP8266 [42] that allows internet connection for remote data reading. Being the system composed of multiple different units, which also implement less energy-efficient radio technologies compared to LoRa, such as GSM [43] the overall energy efficiency is reduced. The system includes different discrete electronic boards that need to be programmed separately, making the firmware updating a more complex process, along with increasing the manufacturing cost. The final electronic board is not well suited to outdoor working conditions, as it does not feature any enclosure. The paper does not provide a detailed description of the results and of the web structure used for managing and displaying the data obtained. In [37], a survey on the transmission behavior and reliability between the sensor nodes and the hubs of the WSN is presented. In this paper, tests have been performed to study the transmission quality of the node-gateway connection at different height dislocations of the devices, and different antenna polarization setups. A more in-depth description of the nodes and hub hardware structure is missing. The paper does not deal with the implementation and description of a data analysis structure following the physical layer. In [38], the application of a LoRa and narrowband Internet of Things (NB-IoT) flood-monitoring system to the development of a damage insurance map is reported. The deployment of a WSN to contribute public data collection to the Storm and Flood Damage Insurance Map in Korea is proposed. An overview of the hardware setup is not provided, along with a description of the testing methods and results. In [39], a LoRa sensor node side analysis is carried out, with the discussion of a water height measuring approach showing how it is possible to measure water height through an ultrasonic sensor and implement a Twitter-based social network alarm, although this approach makes the alarm mechanism not generalizable to different alert interfaces. The database, interface and alarm developments are not reported. None of the above flood-monitoring system reported works present a focus on the node power consumption analysis in a WSN, albeit it being a topic of fundamental importance in the research area. In [40] the results achieved in energy management are worse compared to those of the proposed work because the sensor node uses a more expensive, high capacity 17 Ah, Saft LS33600 (Saft, Levallois-Perret, France) [44] battery, and the estimated discharge time is 3 years, which means in proportion to the presented work a higher energy consumption. Furthermore, no energy-harvesting technique has been implemented, so the battery must be replaced when exhausted. In comparison with the previously mentioned works, this paper reports the development of a flood-monitoring system providing details both on the hardware, firmware and server level. Moreover, in the proposed solution, it is shown the capability of miniaturization and shape adaptability of the sensors, because of the intrinsic nature of the implementation.

A View on LoRa and LoRaWAN
LoRaWAN [24][25][26] is a free network protocol, regulated by the LoRa Alliance [23], designed for use on devices where hard management of energy availability is required. The devices that implement this network functionality are based on chips that use the LoRa modulation technique [21,22]. LoRa technology sacrifices the speed of transmission to make long transmission distances obtainable, which makes it suitable for the realization of WSN systems where there is the need to send small amounts of data at regular intervals of time. Compared to other wireless IoT communication solutions based on the 802.15.4 standard [46], the aforementioned modulation allows taking advantage of much less sophisticated transceiver devices because the system does not require a highly accurate and expensive reference clock signal source. This translates into reduced module cost and superior energy performance. A comparison between LoRa and NB-IoT [47] is reported in [48]. The latter specifies that for LoRa based devices energy demand is lower compared to NB-IoT based devices, which present synchronization requirements. Compared to LoRa, the narrowband Internet of Things offers the advantage of higher data rates and lower latency, features that are not strictly necessary in the monitoring of slowly evolving environmental phenomena such as flooding.
In [49] an energy-efficiency comparison between LPWAN-based IoT devices is presented, reporting SigFox [50] having similar energy performances to LoRa, although the network coverage for SigFox can be more expensive and less accessible than LoRaWAN, which only requires a gateway deployment. A network coverage comparison between these LPWAN wireless technologies is reported in [20].
LoRa-based devices allow different radio communication parameters to be configured. Thus, allowing several data rates and sensitivity levels to be chosen based on the specific application requirements. Carrier frequency is the center frequency of the transmission band, located in ISM (industrial, scientific, and medical) bands that differ in various world regions, for Europe 868 MHz, for the US 915 MHz, and for Asia 433 MHz. Spreading factor (SF) is the ratio between symbol rate and chip rate, which can be selected from 6 to 12. A higher spreading factor increases SNR allowing communication over longer distances and in the presence of higher noise levels, yet time on-air is increased concerning lower SF, hence increasing energy consumption. Bandwidth (BW) is the range of frequencies used in the transmission band; higher BW means higher transmission speed but lower sensitivity due to the increased noise effects, lower BW instead allows more sensitivity at a lower data rate. Coding rate (CR) is the forward error correction rate used. A higher CR allows increased error protection at an increased time on air. Transmission power is the transceiver maximum output power during transmission interval, higher output power allows longer transmission range but increased energy consumption.
The LoRaWAN network architecture consists of devices that communicate with a central gateway through a single-hop connection. The gateway is organized in a star structure and acts as a bridge between the nodes and the cloud as shown in Figure 1.
for SigFox can be more expensive and less accessible than LoRaWAN, which only requires a gateway deployment. A network coverage comparison between these LPWAN wireless technologies is reported in [20].
LoRa-based devices allow different radio communication parameters to be configured. Thus, allowing several data rates and sensitivity levels to be chosen based on the specific application requirements. Carrier frequency is the center frequency of the transmission band, located in ISM (industrial, scientific, and medical) bands that differ in various world regions, for Europe 868 MHz, for the US 915 MHz, and for Asia 433 MHz. Spreading factor (SF) is the ratio between symbol rate and chip rate, which can be selected from 6 to 12. A higher spreading factor increases SNR allowing communication over longer distances and in the presence of higher noise levels, yet time on-air is increased concerning lower SF, hence increasing energy consumption. Bandwidth (BW) is the range of frequencies used in the transmission band; higher BW means higher transmission speed but lower sensitivity due to the increased noise effects, lower BW instead allows more sensitivity at a lower data rate. Coding rate (CR) is the forward error correction rate used. A higher CR allows increased error protection at an increased time on air. Transmission power is the transceiver maximum output power during transmission interval, higher output power allows longer transmission range but increased energy consumption.
The LoRaWAN network architecture consists of devices that communicate with a central gateway through a single-hop connection. The gateway is organized in a star structure and acts as a bridge between the nodes and the cloud as shown in Figure 1.

The Proposed System Architecture
In Figure 2 the general application scheme of the proposed flood-monitoring system is presented. It has several key characteristics; among these, the most important is the low power consumption of the sensor node. The latter is not powered by the electrical network but supported by a renewable energy source like solar harvesting [51][52][53]. In addition, it can also be powered by a multisource harvesting technique [54][55][56][57]. The low power consumption has been also achieved by a dedicated operating algorithm that implements a deep sleep operation.

The Proposed System Architecture
In Figure 2 the general application scheme of the proposed flood-monitoring system is presented. It has several key characteristics; among these, the most important is the low power consumption of the sensor node. The latter is not powered by the electrical network but supported by a renewable energy source like solar harvesting [51][52][53]. In addition, it can also be powered by a multisource harvesting technique [54][55][56][57]. The low power consumption has been also achieved by a dedicated operating algorithm that implements a deep sleep operation.   Concerning the flooding phenomenon, the entire dynamic of the possible presence of water has been partitioned in three zones ( Figure 3): the first non-alert zone, an intermediate non-critical alarm zone, and a last maximum flooding partition. These areas are delimited by threshold levels where the sensors are positioned, so as to achieve a direct correspondence between water level and triggered alarm. The entire structure of the system is based on the synergy between the hardware section, for the physical detection of data and transmission, and the Web section, for storage and temporal analysis as well as for the activation of an alert message in the case of flooding. The packets received at the LoRa gateway, in this case the Lorix One [58] device, are managed through The Things Network [59] service, where the sequence of incoming bytes is converted into a JavaScript Object Notation (JSON) object suitable for data exchange between websites through a payload decoding function. The object contains a key-value field where an integer numerical value is reported: 0 if the water is below level 1, for the intermediate level the value is 1, for maximum flooding value 2. Through HyperText Transfer Protocol (HTTP) integration, this key-value field is sent to the Losant IoT website [60] where data analysis and email alert functions are implemented.
The advantage of the use of such web services is the possibility of exchanging data between applications quickly and easily since interfacing is guaranteed at a very high level of abstraction; this is a fundamental aspect for achieving the goal of system modularity. For the correct operation and reliability of the system, the payload sending phase is designed to finish when a transmission acknowledgement is successfully obtained.
The flow chart of the implemented apparatus operation is depicted in Figure 4. The entire structure of the system is based on the synergy between the hardware section, for the physical detection of data and transmission, and the Web section, for storage and temporal analysis as well as for the activation of an alert message in the case of flooding. The packets received at the LoRa gateway, in this case the Lorix One [58] device, are managed through The Things Network [59] service, where the sequence of incoming bytes is converted into a JavaScript Object Notation (JSON) object suitable for data exchange between websites through a payload decoding function. The object contains a key-value field where an integer numerical value is reported: 0 if the water is below level 1, for the intermediate level the value is 1, for maximum flooding value 2. Through HyperText Transfer Protocol (HTTP) integration, this key-value field is sent to the Losant IoT website [60] where data analysis and email alert functions are implemented.
The advantage of the use of such web services is the possibility of exchanging data between applications quickly and easily since interfacing is guaranteed at a very high level of abstraction; this is a fundamental aspect for achieving the goal of system modularity. For the correct operation and reliability of the system, the payload sending phase is designed to finish when a transmission acknowledgement is successfully obtained.
The flow chart of the implemented apparatus operation is depicted in Figure 4.

Sensor Node
The sensor node is based on a customized electronic board equipped with a Microchip Atmel SAMD21 microcontroller, RFM95W LoRa module, sensor interface and 3.3 V voltage regulator. The

Sensor Node
The sensor node is based on a customized electronic board equipped with a Microchip Atmel SAMD21 microcontroller, RFM95W LoRa module, sensor interface and 3.3 V voltage regulator. The printed circuit board is made on FR-4 support, with dimensions of 5 × 5 cm. The microcontroller, a central data processing unit, manages the external modules and the temporal control of actions as shown in Figure 5 at block scheme level. Communication between the microcontroller and LoRa module is implemented using a serial peripheral interface (SPI) along with dedicated digital Input/Output (I/O) lines. An 868 MHz monopole antenna is connected to the wireless module for radio communication. The external DS3231 real-time clock (RTC) (Maxim Integrated, San Jose, CA, USA) module, connected to the custom board, is interfaced by I2C protocol. External sensors are connected to the board in a bridge-based sensor interface circuit. The entire board is powered by a 3.7 V Li-Ion battery recharged using an external TP4056 charge regulator module. A universal serial bus (USB) interface is used for microcontroller firmware upload. The physical sensors are forks of conductive material (model YL-69). In a standard situation between the metal terminals, the measured electrical resistance is very high. When the sensor comes into contact with the water, an immediate significant drop in the electrical resistance between the metal terminals is measured, allowing the reading of this structure using a resistive voltage divider.
The key advantage of this solution is the simplicity and the reduced lumped elements count, which significantly lowers the overall costs for the system implementation. Besides the fact that voltage mode or current mode bridge-based solutions, like those proposed in [61][62][63][64][65], could be more effective for noise reduction, increased sensitivity and accuracy, they need a higher number of discrete components to be implemented. Moreover, the high resistance variation of the fork sensor in presence/absence of water leads to an ON/OFF behavior which can be clearly detected by a simple voltage divider architecture.
In addition, the simple voltage divider readout interface is quite effective for the goal of system modularity. In fact, the fork module could be replaced by any resistive sensor, while the produced output voltage swing can be adjusted by changing only the reference resistor of the voltage divider. This feature, in combination with the simple high level of abstraction for the data communication and exchange, leads to a general-purpose LoRaWAN sensor node architecture, which promotes modularity.
The output of the analog stage is then processed by the analog-digital converter (ADC) of the micro-controller and the subsequent mapping of the values obtained to identify flooding situations. The wall fixing of the sensors is achieved through the use of a custom enclosure developed using the fused deposition material (FDM) 3D printing technique in Figure 6. The physical sensors are forks of conductive material (model YL-69). In a standard situation between the metal terminals, the measured electrical resistance is very high. When the sensor comes into contact with the water, an immediate significant drop in the electrical resistance between the metal terminals is measured, allowing the reading of this structure using a resistive voltage divider.
The key advantage of this solution is the simplicity and the reduced lumped elements count, which significantly lowers the overall costs for the system implementation. Besides the fact that voltage mode or current mode bridge-based solutions, like those proposed in [61][62][63][64][65], could be more effective for noise reduction, increased sensitivity and accuracy, they need a higher number of discrete components to be implemented. Moreover, the high resistance variation of the fork sensor in presence/absence of water leads to an ON/OFF behavior which can be clearly detected by a simple voltage divider architecture.
In addition, the simple voltage divider readout interface is quite effective for the goal of system modularity. In fact, the fork module could be replaced by any resistive sensor, while the produced output voltage swing can be adjusted by changing only the reference resistor of the voltage divider. This feature, in combination with the simple high level of abstraction for the data communication and exchange, leads to a general-purpose LoRaWAN sensor node architecture, which promotes modularity.
The output of the analog stage is then processed by the analog-digital converter (ADC) of the micro-controller and the subsequent mapping of the values obtained to identify flooding situations.
The wall fixing of the sensors is achieved through the use of a custom enclosure developed using the fused deposition material (FDM) 3D printing technique in Figure 6. The prevention of external disturbance actions on the sensors is easily achievable through the implementation of a fixed cover which provides a pair of small holes that allow the correct flow of water inside the enclosure.
The micro-controller, model Atmel SAMD21G18A (Microchip Technology, Chandler, AZ, USA) [66] from Microchip, features 32-bit arithmetic on ARM Cortex-M0 architecture, 256 KB flash memory, 12-bit analog to digital converter (ADC), SERCOM interfaces, USB 2.0 interface for connection with the computer. 52 I/O pins are available, all in a TQFP48 package. The firmware is loaded through the Arduino integrated development environment (IDE) [67] after the flash of the bootloader via Atmel in-circuit emulator (ICE) [68], for which specific pins have been dedicated to the electronic board.
In order to monitor the presence of water at given time intervals, it is necessary to carry out checks periodically, and therefore a precise time reference that does not degrade in the long run is needed. This function has been implemented through the use of a RTC model DS3231 (Maxim Integrated, San Jose, CA, USA) [69], with available externally programmable interrupts. The choice of the interval is related to the speed with which a flood can occur, which is of an order of magnitude ranging from minutes to hours [30,32], according to the structural characteristics of the mounting location. This parameter can be reconfigured over LoRaWAN by the implementation of a downlink frame at the end of every reading cycle where the value is obtained on the server-side, making remote management possible.
The on-board LoRa module is the RFM95 [70] model from HopeRF Electronics. With the small dimensions of 1.6 cm × 1.6 cm this component can be easily installed on the board. The component datasheet specified supply current absorption for BW 125 kHz, 13 dBm power output, SF12 is 0.2 µ A in sleep mode, 11.5 mA in receiver mode and 28 mA during transmission. For the combination of spreading factor (SF8) and bandwidth (125 kHz) used, the typical sensitivity from the datasheet is −126 dBm. Spreading Factor 8 has been chosen because it is an intermediate setting for lower time on-air, which reduces energy consumption. It allows sufficient sensitivity for signal reception in the test location of choice.
1. The antenna is connected to the wireless module by a U.FL surface mount connector placed at the end of a coplanar waveguide. Concerning the power supply module, in order to recharge the battery, a Seed Studio solar cell [71] with dimensions of 55 mm × 70 mm has been used. The solar panel is connected to a TP4056 charging regulator module [72] that features input voltage range from -0.3 V to 8 V with a maximum charge current of 1 A and short circuit protection, along with operating temperature range from −40 °C to +85 °C and USB recharge port. 2. The battery utilized is a Li-Ion 18650 with a 2200 mAh capacity. A 3.3 V power supply is provided through a low-dropout (LDO) voltage regulator model TLV702 [73]. In Figure 7 a photo of the prototype board is presented. The prevention of external disturbance actions on the sensors is easily achievable through the implementation of a fixed cover which provides a pair of small holes that allow the correct flow of water inside the enclosure.
The micro-controller, model Atmel SAMD21G18A (Microchip Technology, Chandler, AZ, USA) [66] from Microchip, features 32-bit arithmetic on ARM Cortex-M0 architecture, 256 KB flash memory, 12-bit analog to digital converter (ADC), SERCOM interfaces, USB 2.0 interface for connection with the computer. 52 I/O pins are available, all in a TQFP48 package. The firmware is loaded through the Arduino integrated development environment (IDE) [67] after the flash of the bootloader via Atmel in-circuit emulator (ICE) [68], for which specific pins have been dedicated to the electronic board.
In order to monitor the presence of water at given time intervals, it is necessary to carry out checks periodically, and therefore a precise time reference that does not degrade in the long run is needed. This function has been implemented through the use of a RTC model DS3231 (Maxim Integrated, San Jose, CA, USA) [69], with available externally programmable interrupts. The choice of the interval is related to the speed with which a flood can occur, which is of an order of magnitude ranging from minutes to hours [30,32], according to the structural characteristics of the mounting location. This parameter can be reconfigured over LoRaWAN by the implementation of a downlink frame at the end of every reading cycle where the value is obtained on the server-side, making remote management possible.
The on-board LoRa module is the RFM95 [70] model from HopeRF Electronics. With the small dimensions of 1.6 cm × 1.6 cm this component can be easily installed on the board. The component datasheet specified supply current absorption for BW 125 kHz, 13 dBm power output, SF12 is 0.2 µA in sleep mode, 11.5 mA in receiver mode and 28 mA during transmission. For the combination of spreading factor (SF8) and bandwidth (125 kHz) used, the typical sensitivity from the datasheet is −126 dBm. Spreading Factor 8 has been chosen because it is an intermediate setting for lower time on-air, which reduces energy consumption. It allows sufficient sensitivity for signal reception in the test location of choice.

1.
The antenna is connected to the wireless module by a U.FL surface mount connector placed at the end of a coplanar waveguide. Concerning the power supply module, in order to recharge the battery, a Seed Studio solar cell [71] with dimensions of 55 mm × 70 mm has been used. The solar panel is connected to a TP4056 charging regulator module [72] that features input voltage range from −0.3 V to 8 V with a maximum charge current of 1 A and short circuit protection, along with operating temperature range from −40 • C to +85 • C and USB recharge port.

2.
The battery utilized is a Li-Ion 18650 with a 2200 mAh capacity. A 3.3 V power supply is provided through a low-dropout (LDO) voltage regulator model TLV702 [73]. In Figure 7 a photo of the prototype board is presented. Figure 7. Implemented custom board.
The custom board, external charger and RTC modules are mounted in a 3D printed waterproof enclosure. The solar cell is mounted on the top cover of the enclosure and connected to the charging module by internal wires.

Energy Consumption Measurement Setup
As previously described, energy efficiency is a fundamental factor for a device belonging to an LPWAN. Measurements were performed on a Tektronix digital oscilloscope DPO 3032 (Tektronix, Beaverton, OR, USA) [74] and Tektronix's current probe and amplifier AM 503B (Tektronix, Beaverton, OR, USA) [75]. The parameters for wireless transmission are listed in Table 2.

Energy Consumption Results
In Figure 8 a MATLAB plot from an oscilloscope sample set over 20 s is shown. A time slot of 10 s represents the board setup phase, immediately following the power on. In this period of time, the microcontroller is running the code to set every external module and interrupt capability. Then, there is the first standby phase which lasts until the next received interrupt from the RTC where a sensor value sample is taken and transmitted (this scenario is reported in Figure 9). For both Figure 8 and Figure 9, the vertical axis ticks show the current absorption values during both setup and standby phase. In the vertical scale, 10 mV corresponds to 5 mA, so it is, therefore, immediately able to obtain the current value in the idle time through a proportion; it is on average 13 mA during the setup time period. In the standby phase, the absorption of current drops to an average of 0.3 mA, or 300 µ A. The custom board, external charger and RTC modules are mounted in a 3D printed waterproof enclosure. The solar cell is mounted on the top cover of the enclosure and connected to the charging module by internal wires.

Energy Consumption Measurement Setup
As previously described, energy efficiency is a fundamental factor for a device belonging to an LPWAN. Measurements were performed on a Tektronix digital oscilloscope DPO 3032 (Tektronix, Beaverton, OR, USA) [74] and Tektronix's current probe and amplifier AM 503B (Tektronix, Beaverton, OR, USA) [75]. The parameters for wireless transmission are listed in Table 2.

Energy Consumption Results
In Figure 8 a MATLAB plot from an oscilloscope sample set over 20 s is shown. A time slot of 10 s represents the board setup phase, immediately following the power on. In this period of time, the microcontroller is running the code to set every external module and interrupt capability. Then, there is the first standby phase which lasts until the next received interrupt from the RTC where a sensor value sample is taken and transmitted (this scenario is reported in Figure 9). For both Figures 8 and 9, the vertical axis ticks show the current absorption values during both setup and standby phase. In the vertical scale, 10 mV corresponds to 5 mA, so it is, therefore, immediately able to obtain the current value in the idle time through a proportion; it is on average 13 mA during the setup time period. In the standby phase, the absorption of current drops to an average of 0.3 mA, or 300 µA. This result is very important in light of the objective of obtaining a low power device. In a deeper in-depth analysis of the battery charge-discharge variations, it is appropriate to consider the actual different values of current absorption during the different time periods, especially during nighttime, where the node has to operate using the energy stored during the light hours. The total battery discharge due to the total data reads and sending cycles can be expressed as follows: while the discharge during the total deep sleep period is calculated by: being,  This result is very important in light of the objective of obtaining a low power device. In a deeper in-depth analysis of the battery charge-discharge variations, it is appropriate to consider the actual different values of current absorption during the different time periods, especially during nighttime, where the node has to operate using the energy stored during the light hours.
The total battery discharge due to the total data reads and sending cycles can be expressed as follows: while the discharge during the total deep sleep period is calculated by: being, This result is very important in light of the objective of obtaining a low power device. In a deeper in-depth analysis of the battery charge-discharge variations, it is appropriate to consider the actual different values of current absorption during the different time periods, especially during nighttime, where the node has to operate using the energy stored during the light hours.
The average duration of a wake-up and transmission cycle is 0.64 s, with two idle phases, T 1 = 0.45 s, where the sensor value is read and the data packet prepared for the transmission, and T 2 = 0.135 s where the standby mode is reactivated. The transmission has an average duration of T tx = 0.052 s. During the first period of time and before returning to deep sleep the current absorption I idle is on average 13 mA as previously reported while the transmission span reports an average current absorption of I tx = 45 mA. The chosen test location has an interval of time between sunset and sunrise of about T tot = 15 h in the worst case, meaning that running a data reading cycle every 10 min the total runs in one night time are N cycles = 90. The single read discharge is given by: The total battery discharge due to the total data reads and sending cycles can be expressed as follows: while the discharge during the total deep sleep period is calculated by: being, T sleep = (T tot · 3600) − (T · N cycles ) = 53,943 s (4) The aforementioned calculated quantities allow the total charge variation during the night time to be found easily by adding the two contributions; therefore, we have: Notice almost immediately that a 2200 mAh battery is absolutely sufficient to guarantee the uptime even in the hours of insufficient insolation. Taking into account that the battery is recharged by solar harvesting in the daytime, and given that the wake-up and data transmission phases have almost negligible durations compared to the deep sleep period, which is in the order of minutes against tens of seconds, it is possible to obtain 100% uptime from the moment of the first activation, ensuring energy self-sufficiency. In a worst-case scenario, assuming the total absence of solar charging, with reading cycles as previously reported, the charge variation over 24 h can be calculated by means of a proportion, resulting in about 7.58 mAh, which corresponds to a total discharge of the 2200 mAh battery in more than 280 days.

Functionality Tests
Concerning the system implementation in a real environment, a location in accordance with the city of L'Aquila local administration has been chosen that is particularly subject to the risk of flooding due to the presence of the Vetoio river ( Figure 10). The nearest LoRa gateway is located about 1 km far from the implemented sensor node. The aforementioned calculated quantities allow the total charge variation during the night time to be found easily by adding the two contributions; therefore, we have: Notice almost immediately that a 2200 mAh battery is absolutely sufficient to guarantee the uptime even in the hours of insufficient insolation. Taking into account that the battery is recharged by solar harvesting in the daytime, and given that the wake-up and data transmission phases have almost negligible durations compared to the deep sleep period, which is in the order of minutes against tens of seconds, it is possible to obtain 100% uptime from the moment of the first activation, ensuring energy self-sufficiency. In a worst-case scenario, assuming the total absence of solar charging, with reading cycles as previously reported, the charge variation over 24 h can be calculated by means of a proportion, resulting in about 7.58 mAh, which corresponds to a total discharge of the 2200 mAh battery in more than 280 days.

Functionality Tests
Concerning the system implementation in a real environment, a location in accordance with the city of L'Aquila local administration has been chosen that is particularly subject to the risk of flooding due to the presence of the Vetoio river ( Figure 10). The nearest LoRa gateway is located about 1 km far from the implemented sensor node. In Figure 11  In Figure 11  In Figure 12, a time graph concerning the water level on the actual test location reported in Figure 12 is shown. The horizontal axis represents a time span of 24 h, during which the water level has risen above the guard level, represented by the value 0, for a time duration of approximately 4 h. The data obtained were stored remotely for possible further elaboration and an e-mail alarm was activated with the aim of informing about the possible danger.

Conclusions and Future Works
In this paper, an autonomous flood-monitoring system based on LoRa technology has been presented. The choice of this wireless technology, as well as a sensor node with the previously illustrated structure, proved to be effective to obtain energy performance suitable for a batterypowered IoT device. The structure of the aforementioned node has a modular implementation, it being unnecessary to make significant changes to the electronic board to obtain the possibility of using it as an interface for different types of sensors capable of detecting phenomena that differ from those taken into consideration in this work. Future developments include improvements at the hardware level, such as the direct integration of the power-management system on the electronic board, but also in software as the implementation of superior safety functions. Due to the system power efficiency achieved, it is possible to use a smaller and cheaper battery pack solution in a commercial scenario. Moreover, the proposed systems, thanks to the high-performance microcontroller utilized, can be expanded easily to a wireless multi-sensor network with the aim of monitoring various environmental and structural parameters. The possibility of data processing at a higher level makes the structure scalable to a large number of devices, even if in such a structure the traffic management policy relating to the gateway could be not negligible when managing a number of nodes of the order of magnitude of hundreds. In Figure 12, a time graph concerning the water level on the actual test location reported in Figure 12 is shown. The horizontal axis represents a time span of 24 h, during which the water level has risen above the guard level, represented by the value 0, for a time duration of approximately 4 h.
J. Low Power Electron. Appl. 2020, 10, 15 12 of 16 Figure 11. Time series graph of water level over three days of laboratory test.
In Figure 12, a time graph concerning the water level on the actual test location reported in Figure 12 is shown. The horizontal axis represents a time span of 24 h, during which the water level has risen above the guard level, represented by the value 0, for a time duration of approximately 4 h. The data obtained were stored remotely for possible further elaboration and an e-mail alarm was activated with the aim of informing about the possible danger.

Conclusions and Future Works
In this paper, an autonomous flood-monitoring system based on LoRa technology has been presented. The choice of this wireless technology, as well as a sensor node with the previously illustrated structure, proved to be effective to obtain energy performance suitable for a batterypowered IoT device. The structure of the aforementioned node has a modular implementation, it being unnecessary to make significant changes to the electronic board to obtain the possibility of using it as an interface for different types of sensors capable of detecting phenomena that differ from those taken into consideration in this work. Future developments include improvements at the hardware level, such as the direct integration of the power-management system on the electronic board, but also in software as the implementation of superior safety functions. Due to the system power efficiency achieved, it is possible to use a smaller and cheaper battery pack solution in a commercial scenario. Moreover, the proposed systems, thanks to the high-performance microcontroller utilized, can be expanded easily to a wireless multi-sensor network with the aim of monitoring various environmental and structural parameters. The possibility of data processing at a higher level makes the structure scalable to a large number of devices, even if in such a structure the traffic management policy relating to the gateway could be not negligible when managing a number of nodes of the order of magnitude of hundreds. The data obtained were stored remotely for possible further elaboration and an e-mail alarm was activated with the aim of informing about the possible danger.

Conclusions and Future Works
In this paper, an autonomous flood-monitoring system based on LoRa technology has been presented. The choice of this wireless technology, as well as a sensor node with the previously illustrated structure, proved to be effective to obtain energy performance suitable for a battery-powered IoT device. The structure of the aforementioned node has a modular implementation, it being unnecessary to make significant changes to the electronic board to obtain the possibility of using it as an interface for different types of sensors capable of detecting phenomena that differ from those taken into consideration in this work. Future developments include improvements at the hardware level, such as the direct integration of the power-management system on the electronic board, but also in software as the implementation of superior safety functions. Due to the system power efficiency achieved, it is possible to use a smaller and cheaper battery pack solution in a commercial scenario. Moreover, the proposed systems, thanks to the high-performance microcontroller utilized, can be expanded easily to a wireless multi-sensor network with the aim of monitoring various environmental and structural parameters. The possibility of data processing at a higher level makes the structure scalable to a large number of devices, even if in such a structure the traffic management policy relating to the gateway could be not negligible when managing a number of nodes of the order of magnitude of hundreds.