*Article* **Monitoring and Support for Elderly People Using LoRa Communication Technologies: IoT Concepts and Applications**

#### **José Paulo Lousado 1,\* and Sandra Antunes <sup>2</sup>**


Received: 11 October 2020; Accepted: 18 November 2020; Published: 20 November 2020

**Abstract:** The pandemic declared by the World Health Organization due to the SARS-CoV-2 virus (COVID-19) awakened us to a reality that most of us were previously unaware of—isolation, confinement and the massive use of information and communication technologies, as well as increased knowledge of the difficulties and limitations of their use. This article focuses on the rapid implementation of low-cost technologies, which allow us to answer a fundamental question: how can near real-time monitoring and follow-up of the elderly and their health conditions, as well as their homes, especially for those living in isolated and remote areas, be provided within their care and protect them from risky events? The system proposed here as a proof of concept uses low-cost devices for communication and data processing, supported by Long-Range (LoRa) technology and connection to The Things Network, incorporating various sensors, both personal and in the residence, allowing family members, neighbors and authorized entities, including security forces, to have access to the health condition of system users and the habitability of their homes, as well as their urgent needs, thus evidencing that it is possible, using low-cost systems, to implement sensor networks for monitoring the elderly using the LoRa gateway and other support infrastructures.

**Keywords:** internet of things; LoRaWAN; COVID-19; ICT; The Things Network; ESP32 microcontroller

#### **1. Introduction**

Since the beginning of the SARS-CoV-2 pandemic, a virus discovered in 2019 [1], one of the fundamental concerns was the elderly population, namely due to the impact that the disease caused by the new coronavirus could have on the population in this age group (65 years old or more) [2].

Until then, several solutions for the surveillance of the elderly in a residential context had been advanced by the electronic industry, information technology and entities related to the protection of property and the security of people, allied to well-being and home automation [3–8]. However, the reality, in the current context, shows us that the proliferation of proposals in computer and telecommunications systems for monitoring and supporting the elderly population falls far short of what is desired. The ageing population, living in remote regions, has been exposed to the cruelest conditions of abandonment, without access to medicines, without means of communication, exacerbated by the fact that, in many areas of Portugal, there is no mobile network coverage or, if there is, it has a deficient signal. For these citizens, everything became more distant. Thus, based on this reality as a motivation for the present work, the following question arose: how can the health status and living conditions of the elderly population, dispersed in rural areas with low or no mobile network coverage at all, be remotely monitored using low-cost technologies? To answer that question, several situations need to be considered.

The emergence of the Internet of Things (IoT), currently present in several home systems, notably in small devices for regular use, such as a blood pressure meter, but also in larger equipment, including photovoltaic panels, household appliances, consumption and energy efficiency controllers, among others [9], has extended the application spectrum of data communication networks to other sectors. The health and well-being area is also one of the areas that has benefited the most from this type of technology [10], which is why its exploitation and use in the current context of the pandemic for the benefit of the most disadvantaged populations, in particular the elderly population living in rural areas, becomes imperative.

With the technology currently available, it is possible to combine devices with heterogeneous systems, such as smartphones with mobile networks (3G/4G and, in the future, 5G), Bluetooth devices, wireless networks, sensors, among others, allowing these devices to interact with one another and provide fully automated, adaptive operating environments, taking advantage of these infrastructures and being able to contribute to the improvement of people's quality of life. In [11,12], the authors present some models for the use of low-consumption and long-range networks for home and industry automation, respectively, using Long-Range (LoRa) communication technologies. These communication networks are essential to disseminate data and for its analysis, without necessarily resorting to the Internet, as they are able to collect data from various sensors, maintaining their activity for a long period of time, since the consumption of devices and sensors is reduced. The communication of these data uses a LoRa Wide Area Network (LoRaWAN) gateway, which can be up to 15 km away from the LoRa node that sends the data to the respective Internet connection device [13].

The emergence and expansion of smart cities is an excellent example of the use of the Internet of Things and the use of Artificial Intelligence, in which ubiquitous computing systems are collecting and generating huge amounts of data daily that not require only a storage location, using Cloud Storage, but also immediate processing, helping citizens to take advantage of these data [14]. Decision support systems can also complement the analysis of people's health status, such as infrared body temperature screening at airports and other places of public circulation, being able to detect people who may be suspected of suffering from some pathology that poses a danger of contagion, as repeatedly observed in the media in the current context of the pandemic [15].

Several reports published before the COVID-19 pandemic show that the proportion of those classed as part of the ageing population is increasing in Portugal, without support units being able to provide an efficient and timely response to all requests [16]; thus, one of the solutions will be to keep people in their homes as long as they can be properly followed and monitored, keeping them in their comfort zone. In this way, elderly people will feel more comfortable in their residence, maintaining their habits and routines, a situation that contributes to active and healthy aging. Nevertheless, recent studies show that those suffering or who will suffer from some type of mental disorder is growing considerably throughout the world, so it is imperative to assess the existing technologies for the benefit of the people, minimizing the negative impact that these pathologies have on their quality of life [17,18]. In the context of social isolation and confinement caused by COVID-19, this became even more evident, with several studies proving that these measures are risk factors for the health of the population and for the elderly population in particular [2,19].

Based on this reality, using the concepts already defined in other monitoring and follow-up environments based on miniaturized sensors and telecommunications equipment, namely the work referred to in [20], we present, in this article, an answer to our question, with a system model for following, monitoring and protecting old people who are in a stable state of health, allowing them to maintain their autonomy within their homes and eventually abroad.

The main goal of the proposed system is, therefore, the monitoring of the health status of elderly people who are in their homes, sometimes a few kilometers away from support centers and local community centers (Parish/County), in a discreet and non-intrusive way, through information and communication technologies. Thus, both support institutions, as well as family members, friends, or other entities, can monitor the status of these people in real time. Considering that systems aimed at

monitoring and managing people's data are currently undergoing great evolution, and that pervasive and ubiquitous computing is already part of everyday life, with this work, the authors hope to contribute positively to improving people's quality of life, especially in the senior population with low economic resources who are still in a state of health that allows them to maintain their autonomy.

#### **2. Related Work and Technologies**

Several authors have addressed the issue of monitoring people and their health status remotely. In answer to this question, several low-cost technologies were selected that allow us to ensure optimal reference values in various metrics, namely reliability, quality of service (QoS) and total cost of ownership (TCO). To this end, this chapter provides to further analysis and a literature review on the subject, to provide a more comprehensive view of long-range communication technologies and their applications. The most promising areas in the use of remote monitoring technologies are, naturally, mobile communications—3G, 4G and, in the near future, 5G—but also the use of wireless communication technologies such as LoRa, SigFox, Weightless-N/Nwave, Long Term Evolution for Machines (LTE-M) and Narrowband IoT (NB-IoT), among others, these being the most relevant, as mentioned and analyzed in [21], and the TV whitespace (TVWS) analyzed in [22].

In view of the panoply of similar technologies with applications in remote monitoring, it is difficult from the outset to select one that best meets the requirements defined in order to answer our question. Thus, based on several studies published in scientific journals, the authors selected those that, in general, could answer our question. However, there are restrictions that may lead us to choose one technology over another due to a set of technical requirements at the outset, namely low acquisition cost, low energy consumption, ease of implementation, robustness and availability in the marketplace.

#### *2.1. Long-Range (LoRa)*

LoRa is a technology of wireless communication networks (radio frequency), which allows the communication of thousands of devices powered by batteries, over long distances and with a minimum consumption of energy. LoRa technology is part of a grouping of networks called Low Power Wide Area Networks (LPWANs), capable of communicating over long distances, even in adverse conditions, because of their simple way of organizing information [23]. LoRa's low energy consumption is essential for integration into devices that are intended to be installed over a long period of time and powered by a battery, while, for thousands of devices to communicate, the efficiency of the network and the use of a radio frequency spectrum is important to ensure that no information is lost. LoRa technology uses unlicensed Industrial, Scientific and Medical (ISM) bands, i.e., 868 MHz in Europe, 915 MHz in North America and 433 MHz in Asia. Bidirectional communication is provided by Chirp Spread Spectrum (CSS) modulation, which spreads a narrow band signal over a wider channel bandwidth [24].

There are several works and applications of LoRa networks in the context of remote monitoring, namely in [25], where the authors propose an advanced architecture combining edge computing, fog computing, LoRa and other technologies based on IoT. The proposed architecture can help to overcome the limitations of existing IoT-based health monitoring systems (for example, drop detection or IoT-based electrocardiogram (ECG) monitoring systems) and satisfy the requirements of high data rate applications and the regulation of the LoRa work cycle, demonstrating the functionality of the proposed architecture through the presentation of a case study involving fall detection.

The work presented in [26] shows the advantages and disadvantages of current communication systems and technologies, proposing new IoT architectures in the medical field, dedicated to home and hospital care services, based on LoRa technology.

In [27], the authors studied the internal performance of LPWAN LoRa technology, using measurements in the context of real life. Measurements were performed using commercially available equipment on the main campus of the University of Oulu to test the suitability of LoRa LPWAN technology for health and well-being monitoring. In the study, authors analyzed the performance of LoRa communications used to monitor a person's well-being in the workplace during normal working days.

In the study presented in [28], the authors show an irrigation monitoring system with practical application in precision agriculture on a Czech Republic farm, using LoRa networks, while evidencing the potential of IoT, in the case using LoRaWAN, in helping farmers, namely in irrigation control.

#### *2.2. TV Whitespace*

TV whitespace (TVWS) refers to TV channels located between frequency bands not used for TV broadcasting in certain regions. TVWS are parts of the radio frequency spectrum not used by transmission, also called interleaved spectra [22]. In global, TVWS are also referred to as currently unoccupied portions of the spectrum in the terrestrial region in television frequency bands in the Very High Frequency (VHF) and Ultra High Frequency (UHF) TV spectra (either analogue or digital, especially in the UHF band). In a simpler way, the TVWS spectrum represents a large part of the UHF spectrum (300 MHz–3 GHz), that is, hundreds of MHz, which in some countries also include VHF, which is available in a specific geographic region and can be used in a shared way. This spectrum can be used by primary (licensed) users or by secondary users who, using non-licensed equipment, can share the spectrum with digital TV transmitters, among other types of users. The amount of terrestrial whitespace available depends on several factors, such as geographical characteristics, the level of potential interference in the incumbent TV broadcast service, TV coverage objectives and related planning and use of television channels [29].

In the work presented in [22], the authors refer to the importance of TVWS, focusing their study on the application component and key areas in the application field. Starting by proving that TVWS has excellent penetration in buildings and good propagation characteristics, which, in turn, makes a TV band an innovative platform with great potential in a wide range of important applications, whether used indoors or abroad, the authors show that it is of great interest to investigate not only the quantity of TVWS and characterize its main properties, but also to evaluate the real applications of TVWS in reality. The TVWS use cases discussed in the study are particularly focused on wireless broadband access in rural environments, future wireless home networks, WLAN wireless services and smart grid network/smart meter communication.

In [30], several pilot projects are presented, namely in Africa, Europe, Asia and North America, mostly in rural areas [31], showing great potential. However, after several tests, the question of the applicability of TVWS was left unanswered. It is not clear why the TVWS tests were defined years ago, but they did not result in any commercial applications. This is relevant when considering the power of the restricted market for telecommunications operators, implying that both governments and regulators are not interested in the implementation of this technology. For example, in 2013–14, there was a movement to implement Microsoft-funded TVWS in Bangladesh, yet no regulatory movement was expressed by the Bangladeshi government in regard to TVWS at that time. The reason believed to be behind this decision concerns all operators being busy with their 4G licensing during that period. Adding to this problem is the fact that the commercial deployment of TV blanks, especially 470–698 MHz, are not allowed to be used for research purposes in many countries, as they present a risk of security and interference with other sectors of commercial activity [30].

The works presented in [32,33] focus on the need for the existence of a geographic database of previous TVWS available in different countries, since the frequencies available are different from country to country and within countries (from region to region), each of which has their own policies and different regulatory regimes. It is therefore necessary to safeguard the spectrum of frequencies that are used by security forces, emergency and commercial entities, without any type of interference.

In [34], the authors describe external field measurements in TVWS carried out in Munich, Germany. Fixed and mobile measurements in rural, suburban and urban settings showed that the model presented is appropriate to describe the path loss over distances of up to a few kilometers and that they can be used in the process of filling a geolocation database. This work had the contribution of the European

project ICT-COGEU (COgnitive radio systems for efficient sharing of TV white spaces in EUropean context), whose website is currently offline.

In Portugal, the process of converting analog TV to digital TV started in 2012, and the Portuguese entities recently changed the frequencies of digital terrestrial television broadcasters to new frequencies in order to free up the space previously occupied for future 5G networks. This process is expected to be completed by the end of December 2020 [35,36].

The use of TVWS is of great interest to the scientific community, namely for communications on LPWAN and long-range networks, but there seems to be a lack of investment in this technology, namely by the current players in the telecommunications market. As an example, the most recent document on this subject published by the authority responsible for the regulation of communication policies in Portugal, ANACOM (Autoridade Nacional de Comunicações), is dated August 2016 [37].

#### *2.3. SigFox*

SigFox is an LPWAN network operator that offers a complete IoT connectivity solution based on its patented technologies. SigFox deploys its base stations with equipment previously configured with proprietary software and connects them to the back-end servers using an IP-based network. End devices are connected to these base stations using phase-shift keying (BPSK) modulation on an ultra-narrow band (100 Hz) sub-GHZ ISM carrier. Like LoRa technology, SigFox uses unlicensed ISM bands, for example, 868 MHz in Europe, 915 MHz in North America and 433 MHz in Asia. By using an ultra-narrow band, SigFox uses frequency bandwidth efficiently and achieves very low noise levels, leading to very low power consumption, ensuring the high sensitivity of the receiver and low cost antenna design at the expense of a maximum transfer rate of just 100 bps. SigFox initially supported only uplink communication, but later evolved into bidirectional technology with significant link asymmetry. Downlink communication, that is, data derived from base stations to end devices, can only occur after an uplink communication. The number of messages per uplink is limited to 140 messages per day. The maximum payload length for each uplink message is 12 bytes, but the number of messages in the downlink is limited to four per day, meaning that confirmation of each uplink message is not supported [38].

In [39], the authors show the use of a system based on SigFox networks, with applications in agriculture, for monitoring environmental factors. In this article, they present SigFox technology, as well as how this type of communication would be integrated into precision agriculture, while referring to other technologies already in use in this field. The authors concluded that SigFox and LPWAN technologies represent the future of IoT. Regardless the domain in which it is used, the IoT finds its applicability, leading researchers and developers to find and implement new solutions in order to increase its performance, productivity, and market value.

#### *2.4. Weightless-N*/*NWave*

NWave technology uses advanced demodulation techniques to allow a network to coexist with other radio technologies without additional noise. This proprietary technology is particularly aimed at the smart parking sensor monitoring market, where it has found a considerable market niche [40].

In [40], a comparative study of the three LoRa technologies, Xbee Pro (XBee868) and NWave, with LoRa technology appearing to have a slight advantage, is also presented. In the context of this study, specialized hardware was created to incorporate the different technologies and provide quantitative and qualitative scientific information related to data rates, success rates, modes of energy transmission and energy consumption and communication ranges.

#### *2.5. XBee868LP*/*ZigBee*

ZigBee communication technology uses a low data communication rate, low power consumption, and operates with a wireless network protocol aimed at computer applications and remote control. It has a low power specification based on the IEEE 802.15.4—2003 Wireless Personal Area Networks

standard, whose distance does not exceed 150 m [41]. The XBee 868LP (Low Power) is designed to provide a long-range radio frequency connection with significant performance and low power consumption. The modules have 30 channels between the frequencies 863 MHz and 870 MHz in the "Listen Before Talk" mode, which frees them from a work cycle. In [42], the authors refer that the Xbee868LP module is the first Radio frequency (RF) module in the industry to use Listen Before Talk and Adaptive Frequency Agility (LBT + AFA) techniques. The module "listens" to the environment before communicating. If disturbed, it automatically changes channels in a matter of microseconds, which does not affect its overall performance. With Surface Mount (SMT) technology, the XBee 868LP is compatible with the XBee ecosystem. The configuration is also carried out with the free software XCTU, a platform common to all products in the XBee ranges. Point to point, point to multipoint and DigiMesh networks are supported. The XBee868LP module allows communications up to 4 Km [42].

In [41], the authors show how a network of sensors can be implemented to monitor the doors of a building using ZigBee.

#### *2.6. LTE-M*

LTE-M technology (also LTE-Machine Type Communication (MTC) and LTE Cat M) also operates as an LPWAN, which allows for the the reuse of an installed base LTE (mobile network) with extended coverage. LTE-M, which stands for LTE-Machine Type Communication (MTC), is also an LPWAN technology developed by 3GPP to enable devices and services specifically for IoT applications. LTE-M offers a data rate of 1 Mbps for 3GPP Release 13, increasing to 4 Mbps for Release 14, leading to greater mobility and voice capacity on the network [43].

#### *2.7. NB-IoT*

Narrowband IoT (NB-IoT) technology is also a radio technology deployed in mobile networks that is especially suitable for indoor coverage, low cost and long battery life for a large number of devices. NB-IoT limits bandwidth to a single narrow band of 200 kHz, offering maximum downlink speeds of 26 kbs in version 13 of the 3GPP standard. Version 14 will see this increase to 127 kbps. Both LTE-M technology and NB-IoT operate over a mobile network, requiring coverage with a sufficient signal [43]. All Global System for Mobile communications (GSM) cells that work with LTE can also support NB-IoT, but this requires new protocol installation and licensee fees, so not all operators provide it by default. It is crucial to check if the local GSM operator offers NB-IoT. Moreover, the Subscriber Identity Module (SIM) card must have this protocol enabled. SIMs with LTE may or may not work with NB-IoT—this depends on the GSM operator [44].

In [45], the authors present a comparative study of the different technology applications in the health care area, namely SigFox, LoRaWAN and NB-IoT.

In [46], the authors present a study related to health care, particularly the remote development of rural regions and the application of IoT in these regions for remote health monitoring based on NB-IoT technology. They feature an intelligent IoT-based edge system for remote health monitoring, in which vital wearable sensors transmit data and alerts to an IoT system. The collected data and alerts are then sent to doctors based on a risk-stratified push/pull protocol using the best combination of cellular/mobile/NB-IoT networks. Clinical validation through implantation at the hospital where the system was tested and remote telemedicine location demonstrated that the NB-IoT-based system can be a low-cost, yet feature-rich alternative and that it adds value to devices for remote patient monitoring.

#### *2.8. Analysis and Decision*

Several authors present comparative studies of different technologies, namely [47,48], who contributed to the decision regarding the technology to be used in our work. Moreover, in [49], a technical comparison of LoRaWAN and NB-IoT can be found, explaining that LoRaWAN is an open LPWAN system architecture developed and standardized by LoRa Alliance, a non-profit association of more than 500 member companies that operates in the unlicensed spectrum, while, in opposition, the NB-IoT operates in the licensed spectrum. While both technologies can compete on QoS, IoT applications that require more frequent communications are better served by NB-IoT, which has no duty cycle limitations operating in the licensed spectrum, at the expense of higher TCO relative to LoRaWAN.

We elaborate on our analysis of the options offered by the two main long-range technologies—with the use of mobile networks vs. without the use of mobile networks—in Table 1, which summarizes the main characteristics of the two best options. When there is no mobile network coverage, LoRa technologies were considered the best option due to the several advantages over other technologies, the wide use, robustness, low cost, great ease and availability of equipment and also because they allow total customization and the system can be built entirely from scratch, and integrated into The Things Network. Alternatively, when using mobile networks, it is understood that NB-IoT technology is the one that can best meet the requirements, considering that it can be operated on the future 5G network, when globally available. However, this is not our focus in the present research work, since the studied areas are remote, rural and either do not have mobile network coverage or have poor signals.

The need for a project based on LoRa networks of low consumption, low acquisition cost and long reach is precisely related to the absence of mobile communications networks in the targeted regions, excluding any solution that implies the use of mobile networks. The existence of mobile network coverage would make possible other solutions. The possibility of using TVWS seems to be a distant reality; nevertheless, the results obtained in [30–34] are promising, as long as guaranteed commitment from the agents involved and the regulatory entities can be provided.

Advocated in this analysis, as well as in the works presented in [47–49], the authors conclude that LoRa technology supported by the LoRaWAN architecture is the one that best meets the requirements.


**Table 1.** Technology summary comparison: Long-Range Wide Area Network (LoRaWAN) vs. Narrowband Internet of Things (NB-IoT) (source: [49]).

#### **3. Materials and Methods**

The study and application of certain types of portable and easy-to-operate sensors have been growing considerably. Portable sensors, namely accelerometers, with small dimensions, low energy consumption and high precision have been used in many tests in individuals who have pathologies that can limit their mobility, allowing us to validate in real time if a given individual suffers an abrupt fall [50].

In the work presented in [20], several authors who have worked with these and other sensors, show the advantage of using these small devices for following and monitoring people. It is agreed that one of the main problems for the elderly is related to the occurrence of falls, which, in many cases, end up incapacitating people, namely due to fractures, and other disabling pathologies, namely those that are chronic, degenerative and naturally associated with aging (osteoarthritis, osteoporosis and chronic musculoskeletal pain (fibromyalgia), among others). People who suffer from disabling psychological and neurodegenerative diseases are naturally excluded.

Currently, mobile communication devices, commonly referred to as smartphones, have several sensors incorporated within them, including an accelerometer, gyroscope and GPS, etc., yet the elderly population often find them difficult to operate, not being accustomed to using this type of technology and, in most cases, having great physical limitations and barriers to the use of technologies, as mentioned in [51,52]. Thus, in the present work, we propose the real-time monitoring of the movement of elderly people, who are prone to eventual falls, as well as their state of health, both inside of their houses and in the surrounding area, while also monitoring their ability to move, their pulse and their fatigue resistance, using sensors incorporated in non-intrusive pervasive devices.

The system consists of an application set composed of software and hardware, namely an application developed for portable devices, based on the ESP32 microcontroller (MCU). This MCU incorporates technologies to support Wi-Fi and Bluetooth communications, except LoRa communication.

LoRa SX127x or RFM9x transceivers add the necessary support for LoRa communications and the LoRaWAN protocol that is required to establish communications with The Things Network (TTN) [53]. It should be noted that TTN is cloud server-based network communication infrastructure that connects LoRaWAN devices and gateways worldwide. Thus, every time someone connects a Gateway to TTN, coverage is expanded for all users and LoRaWAN devices, thus ensuring extended, free coverage of the LoRa network signal.

Equipment with different frequencies exists, depending on the target frequency band (433, 868 or 915 MHz). The frequencies used depend on the geographic region and the regulations of the local Industrial, Scientific, and Medical (ISM) band, being, in most countries in the European Union and, in particular, Portugal, the 868 MHz frequency band [54]. This can be integrated with a low-cost GPS sensor, for example GY-GPS6MV2 [55]. For personal use, another ESP32 device with LoRa support can be used, which already includes GPS [56]. The low-cost ADXL335 accelerometer sensor [57] is compatible with ESP32 and can be used for fall detection and system activation (by motion detection).

ESP32 is designed for mobile, wearable electronics and IoT applications. It has all the most recent features of low-power chips, including fine-grained clock gating, multiple power modes and dynamic power scaling. For example, in a low-power IoT sensor hub application scenario, the ESP32 is enabled periodically and only when a specified condition is detected. The low load cycle is used to minimize the amount of power the chip consumes. The output of the power amplifier is also adjustable, thus contributing to an optimized trade-off between communication range, data rate and energy consumption [58].

To control vital signs, we can connect the body temperature sensor [59], body humidity [60] and pulse rate [61] to the ESP32 microcontroller. The equipment is installed in a device suitable for each person (bracelet, waistcoat, etc.), in order to make it safe, concealed and comfortable, eliminating user interaction in most operations. Communication is carried out automatically through the communication of the main module with the LoRaWAN gateway, sending user monitoring data to the TTN at pre-defined intervals, which are stored in a database with real-time analysis by the entities and authorized in a network scheme similar to that shown in Figure 1. In this context, it is important to note some definitions [53]:


*Future Internet* **2020**, *12*, x FOR PEER REVIEW 9 of 32

**Figure 1.** LoRaWAN architecture (adapted from [62]). **Figure 1.** LoRaWAN architecture (adapted from [62]). **Figure 1.** LoRaWAN architecture (adapted from [62]).

#### *3.1. LoRaWAN Protocol 3.1. LoRaWAN Protocol 3.1. LoRaWAN Protocol*

LoRa is a wireless modulation for long-range, low-power, and low-data rate applications developed by Semtech. LoRaWAN is a network protocol that belongs to the set of LPWANs specified in [13] by the LoRa Alliance, which uses LoRa modulation in its physical layer. In the new specification (version 1.1), a Join Server (JS) was added in order to make communications more reliable and secure, being responsible for storing several keys. LoRa is a wireless modulation for long-range, low-power, and low-data rate applications developed by Semtech. LoRaWAN is a network protocol that belongs to the set of LPWANs specified in [13] by the LoRa Alliance, which uses LoRa modulation in its physical layer. In the new specification (version 1.1), a Join Server (JS) was added in order to make communications more reliable and secure, being responsible for storing several keys. LoRa is a wireless modulation for long-range, low-power, and low-data rate applications developed by Semtech. LoRaWAN is a network protocol that belongs to the set of LPWANs specified in [13] by the LoRa Alliance, which uses LoRa modulation in its physical layer. In the new specification (version 1.1), a Join Server (JS) was added in order to make communications more reliable and secure, being responsible for storing several keys.

LoRa devices (nodes) are located around the different gateways. Gateways then connect to servers (to the network) using IP connections, bridging the devices and the network (backend). LoRa devices (nodes) are located around the different gateways. Gateways then connect to servers (to the network) using IP connections, bridging the devices and the network (backend). LoRa devices (nodes) are located around the different gateways. Gateways then connect to servers (to the network) using IP connections, bridging the devices and the network (backend).

The devices use different channels and binary rhythms depending the request. By LoRa modulation, the change in this binary rhythm is promoted through an Adaptive Data Rate (ADR) The devices use different channels and binary rhythms depending the request. By LoRa modulation, the change in this binary rhythm is promoted through an Adaptive Data Rate (ADR) scheme specific to the LoRaWAN network. The devices use different channels and binary rhythms depending the request. By LoRa modulation, the change in this binary rhythm is promoted through an Adaptive Data Rate (ADR) scheme specific to the LoRaWAN network.

scheme specific to the LoRaWAN network. A representation of the LoRaWAN stack can be seen in Figure 2. A representation of the LoRaWAN stack can be seen in Figure 2. A representation of the LoRaWAN stack can be seen in Figure 2.

**Figure 2.** Stack LoRaWAN (adapted from [13]). **Figure 2.** Stack LoRaWAN (adapted from [13]). **Figure 2.** Stack LoRaWAN (adapted from [13]).

The LoRa application layer is composed of data from various actuators and sensors on the device. The LoRa Medium Access Control (MAC) layer is responsible for managing the network. This The LoRa application layer is composed of data from various actuators and sensors on the device. The LoRa Medium Access Control (MAC) layer is responsible for managing the network. This management obeys the type of device class used. Medium Access Control (MAC) commands allow The LoRa application layer is composed of data from various actuators and sensors on the device. The LoRa Medium Access Control (MAC) layer is responsible for managing the network. This management obeys the type of device class used. Medium Access Control (MAC) commands allow us to make changes or check the status from the web.

management obeys the type of device class used. Medium Access Control (MAC) commands allow us to make changes or check the status from the web. us to make changes or check the status from the web. The LoRa Modulation layer concerns the type of modulation used, which is usually modulation The LoRa Modulation layer concerns the type of modulation used, which is usually modulation LoRa. LoRaWAN also provides the use of frequency-shift keying (FSK) modulation.

The LoRa Modulation layer concerns the type of modulation used, which is usually modulation LoRa. LoRaWAN also provides the use of frequency-shift keying (FSK) modulation. LoRa. LoRaWAN also provides the use of frequency-shift keying (FSK) modulation. The Industrial, Scientific and Medical (ISM) band concerns a set of specifications of the frequency band of a given region, namely the frequencies and bandwidth of the transmission channels and a set

of rules to be respected. Among these rules are the duty cycle allowed per channel and the timing of entry into sleep and active modes. EU863-870 MHz is an example of a European ISM band.

The gateway bridges the device and the network and translates LoRa messages from the physical layer to IP protocol messages.

Before an end device (LoRa Node) can communicate on the LoRaWAN network, it must be activated and the following information is required [13]:


The LoRaWAN protocol defines three classes of devices (A, B and C) with different functionalities. The LoRaWAN network must be prepared to handle devices of all classes.


#### *3.2. Functional Requirements*

In terms of functional requirements, the following operations are mainly considered:


*Future Internet* **2020**, *12*, x FOR PEER REVIEW 11 of 32

#### *3.3. Non-Functional Requirements* entities and security forces), namely when the equipment signal is lost, or a fall occurs.

Equally important are the non-functional requirements, which are responsible for ensuring functionality and operability in accordance with minimum quality standards, namely: *3.3. Non-Functional Requirements*  Equally important are the non-functional requirements, which are responsible for ensuring


social needs at critical moments, such as those currently experienced by society.

#### **4. Conceptual Scheme**

The set of applications supporting our monitoring and follow-up system for the elderly includes several modules, as shown in Figure 3, namely: **4. Conceptual Scheme**  The set of applications supporting our monitoring and follow-up system for the elderly includes


**Figure 3. Figure 3.** System conceptual scheme. System conceptual scheme.

The LoRa gateway is connected to the Internet, receiving the data that are periodically sent from the LoRa nodes. As for LoRa nodes, these are divided into two distinct types—personal LoRa nodes and residential LoRa nodes.

#### *4.1. Personal LoRa Node*

The personal LoRa node is composed of an ESP32-based MCU with the various sensors coupled and placed in areas that do not interfere with the user's daily life, therefore being as unintrusive as possible. The ESP32 MCU allows a battery saving mode (Deep Sleep Mode) that is only activated during the scheduled period, collecting and sending the data at that moment.

Considering that one of the built-in sensors is the gyroscope, whenever there is a sudden change, due to a fall, for example, it can automatically activate the MCU by programming a General Purpose Input/Output (GPIO) interruption of the Real Time Clock (RTC). The ESP32 MCU consists of several modules (Figure 4b) and can operate in the following modes, as it seen in Table 2 [58]:



**Table 2.** Power consumption by power modes (source: [58]).

ESP32 has 34 GPIO pins that can be assigned several functions by programming the appropriate registers. There are several kinds of GPIOs: digital-only, analog-enabled, capacitive-touch-enabled, among others. Analog-enabled GPIOs and capacitive-touch-enabled GPIOs can be configured as digital GPIOs. The ESP32 Pin Layout is shown in Figure 4a. MCU ESP32 contains one or two low-power Xtensa 32-bit LX6 microprocessor(s) with several features, namely a seven-stage pipeline to support a clock frequency of up to 240 MHz (160 MHz for ESP32-S0WD, ESP32-D2WD, and ESP32-U4WDH) and a 16/24-bit instruction set that provides high code density, among others [58].

*Future Internet* **2020**, *12*, x FOR PEER REVIEW 13 of 32

(**a**)

**Figure 4.** (**a**) ESP32 DevKit V1 GPIO Scheme (adapted from [54]; (**b**) ESP32 microcontroller (MCU) modules (adapted from [58]). **Figure 4.** (**a**) ESP32 DevKit V1 GPIO Scheme (adapted from [54]; (**b**) ESP32 microcontroller (MCU) modules (adapted from [58]).

Therefore, via the ESP32 MCU, the Deep Sleep battery-saving mode can be activated, which will have an extremely low power consumption. In this mode, the CPUs, most RAM and all clocked digital peripherals are turned off. The only parts of the chip that can still be connected are the RTC controller, RTC peripherals (including the ULP coprocessor) and RTC memories. This device has several ways of activating ESP32 when in Deep Sleep mode, and wake-up sources can be set up at any time before entering Deep Sleep mode. It is possible to wake up ESP32 through the timer, external wakeup (ext0), external wakeup (ext1), ULP coprocessor wakeup and the touchpad (GPIO touch sensor), so in the present situation an external wakeup (ext0) can be used. The RTC IO module contains firmware to trigger the alarm clock when one of the RTC GPIOs enters a predefined logic level. RTC IO is part of the power domain of RTC peripherals; therefore, RTC peripherals will be kept on during Deep Sleep if this activation source is requested [58]. Therefore, via the ESP32 MCU, the Deep Sleep battery-saving mode can be activated, which will have an extremely low power consumption. In this mode, the CPUs, most RAM and all clocked digital peripherals are turned off. The only parts of the chip that can still be connected are the RTC controller, RTC peripherals (including the ULP coprocessor) and RTC memories. This device has several ways of activating ESP32 when in Deep Sleep mode, and wake-up sources can be set up at any time before entering Deep Sleep mode. It is possible to wake up ESP32 through the timer, external wakeup (ext0), external wakeup (ext1), ULP coprocessor wakeup and the touchpad (GPIO touch sensor), so in the present situation an external wakeup (ext0) can be used. The RTC IO module contains firmware to trigger the alarm clock when one of the RTC GPIOs enters a predefined logic level. RTC IO is part of the power domain of RTC peripherals; therefore, RTC peripherals will be kept on during Deep Sleep if this activation source is requested [58].

Only GPIOs with RTC functionality can be used, in this case pins 0, 2, 4, 12–15, 25–27 and 32–39.

#### *4.2. Residential LoRa Node*

As with the personal node, the residential LoRa node is composed of an ESP32-based microcontroller (MCU) with various sensors coupled and placed in areas that do not interfere with the use of the home. The data are sent periodically, in previously defined periods, and can also be sent immediately, whenever certain values read on the sensors exceed the previously established limits, considering that there will be a situation of alert or threat to the safety of residents and housing.

All the necessary data modeling is supported on a platform developed for this purpose and hosted on a dedicated server, which serves as a form of service infrastructure.

To take advantage of IoT technologies, namely LoRa communications, The Things Network (TTN), which is a collaborative communication infrastructure for Internet of Things, is used as a reference, and is accessible in [53].

#### **5. System Prototype**

For proof of concept and the demonstration of the potential of telecommunications by LoRa Technology, a LoRaWAN gateway (Single Channel) was configured with connection to the TTN network in the Viseu region and a LoRa node as a client that attaches a temperature and humidity sensor (DHT22). The equipment used has the following characteristics:

#### *5.1. LoRa Gateway*

The equipment used to build the LoRa gateway was as follows:


the general state of the connection.


In the prototype (Figure 5), the gateway is configured with software available on the GitHub page mentioned above [63], with appropriate adaptations both to the characteristics of the local internet connection network, and to the registration and access properties of TTN. *Future Internet* **2020**, *12*, x FOR PEER REVIEW 15 of 32

**Figure 5.** LoRa gateway registered with The Things Network (TTN). **Figure 5.** LoRa gateway registered with The Things Network (TTN).

as well as to gain access to the statistics of packets sent and received. In this administration interface (Figure 6), it is possible to changes some of the parameters and have access to the history as well as

It is important to know the address of the TTN routing server in advance, so that a correct

It is important to know the address of the TTN routing server in advance, so that a correct connection can be established and to create the gateway service on the TTN network. After establishing the Internet connection, accessing the server is possible via the IP address and by having access to its configuration, where it is also possible to make changes to the configuration parameters, as well as to gain access to the statistics of packets sent and received. In this administration interface (Figure 6), it is possible to changes some of the parameters and have access to the history as well as the general state of the connection. *Future Internet* **2020**, *12*, x FOR PEER REVIEW 16 of 32


**Figure 6.** LoRaWAN gateway based on ESP32 MCU in operation. **Figure 6.** LoRaWAN gateway based on ESP32 MCU in operation.

#### *5.2. LoRa Node 5.2. LoRa Node*

The equipment used to build the prototype node was as follows: The equipment used to build the prototype node was as follows:


system console.


Figure 7 shows the prototype assembled and in operation. Figure 7 shows the prototype assembled and in operation.

After the LoRa node is operational, an application has to be created on the TTN registration system console.

Through this application, a set of operations is understood, with which the devices communicate on the Internet via TTN. This can be as simple as a small web application, or a visual flow using Node-RED to customize code on a server, as described in [65]. Before communication with devices, it is necessary to add the application to TTN and register the device.

**Figure 7.** LoRa node in operation with reading data from the DHT22 sensor.

After the LoRa node is operational, an application has to be created on the TTN registration

• Protoboard;

• Resistance of 10KΩ; • Connection cables;

*5.2. LoRa Node* 

**Figure 6.** LoRaWAN gateway based on ESP32 MCU in operation.

• TTGO ESP32 OLED SX1276 LoRa 868/915 MHz Bluetooth WI-FI Lora Internet Antenna

• Node software based on Cayenne LPP (secure up to 51 bytes of data), available in [64].

The equipment used to build the prototype node was as follows:

• USB 3.3 V–5 V (Power Bank 5000 mAh SoundLogic Solar Powered);

• DHT22 sensor (temperature and humidity);

**Figure 7.** LoRa node in operation with reading data from the DHT22 sensor. **Figure 7.** LoRa node in operation with reading data from the DHT22 sensor. on the Internet via TTN. This can be as simple as a small web application, or a visual flow using

#### *5.3. TTN Application Creation* Node-RED to customize code on a server, as described in [65]. Before communication with devices, it is necessary to add the application to TTN and register the device.

After the LoRa node is operational, an application has to be created on the TTN registration system console. Once the gateway is configured and connected to TTN, the application that will collect the data can be added. For this, it is also necessary to register the device (LoRa node). The node in the present case only collects temperature and humidity data by sending the data to the server every minute, via the LoRa gateway. In order for the application to be able to collect the device data, it is necessary to proceed with the configuration of the device with the data of the access keys to the application, otherwise the added device will not be visible in the application. In this way, TTN ensures that packets sent by the device are effectively collected by the correct application (Figure 8). *5.3. TTN Application Creation*  Once the gateway is configured and connected to TTN, the application that will collect the data can be added. For this, it is also necessary to register the device (LoRa node). The node in the present case only collects temperature and humidity data by sending the data to the server every minute, via the LoRa gateway. In order for the application to be able to collect the device data, it is necessary to proceed with the configuration of the device with the data of the access keys to the application, otherwise the added device will not be visible in the application. In this way, TTN ensures that

packets sent by the device are effectively collected by the correct application (Figure 8).


**Figure 8.** *Cont.*

*Future Internet* **2020**, *12*, x FOR PEER REVIEW 18 of 32

**Figure 8.** Overview of the LoRa node and gateway devices and the application in the TTN: (**a**) gateway registration status information; (**b**) registration of the "apptesttemp" application on the TTN; (**c**) registration of the LoRa node device in the application; (**d**) application registration information. **Figure 8.** Overview of the LoRa node and gateway devices and the application in the TTN: (**a**) gateway registration status information; (**b**) registration of the "apptesttemp" application on the TTN; (**c**) registration of the LoRa node device in the application; (**d**) application registration information.

The more expanded the LoRa gateway network, is the better coverage it will have, so once the application is created and the LoRa node device is configured, data packets can be received by more than one gateway. Since multiple gateways can receive the same LoRa RF data packets from a single end device, LNS (LoRa Network Server) eliminates duplicate data and removes all copies. Based on the Received Signal Strength Indication (RSSI) levels of identical messages (data packets), the network server typically selects the gateway that received the best RSSI message when transmitting a downlink message because, from the outset, that gateway it is the closest to the device that sent the message, ensuring a better quality of service [65]. *5.4. Connection with ThingSpeak*  The more expanded the LoRa gateway network, is the better coverage it will have, so once the application is created and the LoRa node device is configured, data packets can be received by more than one gateway. Since multiple gateways can receive the same LoRa RF data packets from a single end device, LNS (LoRa Network Server) eliminates duplicate data and removes all copies. Based on the Received Signal Strength Indication (RSSI) levels of identical messages (data packets), the network server typically selects the gateway that received the best RSSI message when transmitting a downlink message because, from the outset, that gateway it is the closest to the device that sent the message, ensuring a better quality of service [65].

#### Once the prototype is working, it is important to select the payload format, which represents the way data are received and displayed on the network. By default, Cayenne LPP (low-power payload) *5.4. Connection with ThingSpeak*

will be selected; however, in this case, this has been changed to a custom format in order to program Once the prototype is working, it is important to select the payload format, which represents the way data are received and displayed on the network. By default, Cayenne LPP (low-power payload) will be selected; however, in this case, this has been changed to a custom format in order to program the decoder function so that the data are presented in the correct format, compatible with the platform we intend to use for data visualization, the ThingSpeak platform [66].

follows [67]:

format (Figure 10).

In the received packet, we need to decode the parameter "bytes" that comes in the Cayenne LPP format and present the fields in JavaScript Object Notation (JSON) format [64], with the positions bytes(2) and bytes(3) representing the temperature times 10, which is necessary to proceed with the correction. The bytes(6) position represents the humidity as a double value, so it is also necessary to correct this value. To this end, we implemented the JavaScript function shown in Figure 9a, because the ThingSpeak platform works with predefined composites (field1, field2, etc.). the decoder function so that the data are presented in the correct format, compatible with the platform we intend to use for data visualization, the ThingSpeak platform [66]. In the received packet, we need to decode the parameter "bytes" that comes in the Cayenne LPP format and present the fields in JavaScript Object Notation (JSON) format [64], with the positions bytes(2) and bytes(3) representing the temperature times 10, which is necessary to proceed with the correction. The bytes(6) position represents the humidity as a double value, so it is also necessary to correct this value. To this end, we implemented the JavaScript function shown in Figure 9a, because the ThingSpeak platform works with predefined composites (field1, field2, etc.).

*Future Internet* **2020**, *12*, x FOR PEER REVIEW 19 of 32


**Figure 9.** (**a**) Decoder function compatible with ThingSpeak; (**b**) received message (payload); (**c**) TTN integration with ThingSpeak infrastructure. **Figure 9.** (**a**) Decoder function compatible with ThingSpeak; (**b**) received message (payload); (**c**) TTN integration with ThingSpeak infrastructure.

For example, when temperature and humidity are detected and sent on the LoRa network to the

2. Device with humidity sensor: (Hex)—01 68 72. The data channel is one (01), the type is humidity

To register a data analysis application on the ThingSpeak platform, a registration is required, which is free in its basic version. After creating the channel, we selected the fields that we wanted to display and defined the metadata, field1—temperature and field2—humidity, according to what was defined in the decoder function (bytes, port). It is possible to have up to eight fields in a channel and GPS coordinates. The channel ID and channel write Application Program Interface (API) key are required to register the channel in the TTN (Figure 9c) and allow data communication. The channel also allows for the configuration of other parameters, as well as exporting the data in XML and JSON

temperature (67) and the value is 00FB ⇒ 251 ⇒ 25.1 ° C.

(68) and the value is 72 ⇒ 114 ⇒ 57%.

For example, when temperature and humidity are detected and sent on the LoRa network to the LoRaWAN gateway with payload 01 67 00 FB 01 68 72, as shown in Figure 9b, these are encoded as follows [67]:


To register a data analysis application on the ThingSpeak platform, a registration is required, which is free in its basic version. After creating the channel, we selected the fields that we wanted to display and defined the metadata, field1—temperature and field2—humidity, according to what was defined in the decoder function (bytes, port). It is possible to have up to eight fields in a channel and GPS coordinates. The channel ID and channel write Application Program Interface (API) key are required to register the channel in the TTN (Figure 9c) and allow data communication. The channel also allows for the configuration of other parameters, as well as exporting the data in XML and JSON format (Figure 10). *Future Internet* **2020**, *12*, x FOR PEER REVIEW 21 of 32


**Figure 10.** Parameterization of the ThingSpeak channel. **Figure 10.** Parameterization of the ThingSpeak channel.

#### *5.5. ThingSpeak Dashboard 5.5. ThingSpeak Dashboard*

After ensuring that the channel is properly configured and communicating with TTN, it is possible to gain access to the graphical display of the data, as well as the geographic location of the device (Figure 11). The ThingSpeak platform also provides the necessary APIs so that data can be collected by After ensuring that the channel is properly configured and communicating with TTN, it is possible to gain access to the graphical display of the data, as well as the geographic location of the device (Figure 11).

Representational State Transfer (REST) web services, to be incorporated into an Android, iOS or Windows application, thus allowing real-time monitoring in another system developed for this purpose. The ThingSpeak platform also provides the necessary APIs so that data can be collected by Representational State Transfer (REST) web services, to be incorporated into an Android, iOS or Windows application, thus allowing real-time monitoring in another system developed for this purpose.

*Future Internet* **2020**, *12*, x FOR PEER REVIEW 22 of 32

**Figure 11.** Real-time display of data sent by the DHT22 sensor. **Figure 11.** Real-time display of data sent by the DHT22 sensor.

#### **6. Results 6. Results**

In this article, we show that it is possible to implement low-cost and low-energy consumption systems, even for domestic consumption, based on LoRa networks and an ESP32 microprocessor. Nevertheless, there are some considerations that concern us, and these need to be solved so that the system's effectiveness can be measured, namely: In this article, we show that it is possible to implement low-cost and low-energy consumption systems, even for domestic consumption, based on LoRa networks and an ESP32 microprocessor. Nevertheless, there are some considerations that concern us, and these need to be solved so that the system's effectiveness can be measured, namely:


To analyze the performance in terms of the received signal power, several locations were previously selected at 10 distances (in meters), as presented in the following table (Table 3), with average values obtained from 100 measurements of RSSI power (LoRa gateway): To analyze the performance in terms of the received signal power, several locations were previously selected at 10 distances (in meters), as presented in the following table (Table 3), with average values obtained from 100 measurements of RSSI power (LoRa gateway):


**Table 3.** List of distances from gateway and average Received Signal Strength Indication (RSSI) value. value. **Distance (m) Avg (RSSI)** 

*Future Internet* **2020**, *12*, x FOR PEER REVIEW 23 of 32


**Figure 12.** Graphical representation of average RSSI data and respective distances. **Figure 12.** Graphical representation of average RSSI data and respective distances.

Higher RSSI values represent greater signal quality, while lower values represent poorer signal quality. According to [36], the RSSI values for LoRa networks are: Higher RSSI values represent greater signal quality, while lower values represent poorer signal quality. According to [36], the RSSI values for LoRa networks are:


The results obtained in previously defined hybrid rural and urban areas were different from what was expected, and it was found that any obstacle, wall, or housing could interfere with the signal. It was also found that, with the used equipment, it is not possible to communicate beyond 450 m. Nevertheless, several restrictions must be considered, namely the fact that the test gateway is only one channel, with an indoor antenna housed at the bottom, as shown in Figure 5. During data collection, the device operator remained in the same place for some time in order to collect 10 samples for each distance, moving only the LoRa node (random movement inside one circle with a bias of no more than 5 m) to check if there were failures, which was confirmed. The results obtained in previously defined hybrid rural and urban areas were different from what was expected, and it was found that any obstacle, wall, or housing could interfere with the signal. It was also found that, with the used equipment, it is not possible to communicate beyond 450 m. Nevertheless, several restrictions must be considered, namely the fact that the test gateway is only one channel, with an indoor antenna housed at the bottom, as shown in Figure 5. During data collection, the device operator remained in the same place for some time in order to collect 10 samples for each distance, moving only the LoRa node (random movement inside one circle with a bias of no more than5 m) to check if there were failures, which was confirmed.

#### *Linear Regression Model*

In order to obtain a detailed statistical analysis and validation of our system that allowed for the measurement of the service quality and the influence of environmental factors on the signal quality, *Linear Regression Model* 

we applied a linear regression model to the data obtained, with the dependent variable being power of RSSI (pRSSI) and the independent variable being the distance to the gateway. The results in Table 4 allow us to observe that, with a correlation factor, Multiple R is equal to 0.9016, showing that there is a strong correlation between the two variables. However, the value obtained for R Square, 0.813, shows us that only 81.3% of the observed cases fit the obtained model, when the desirable value would be 95%. Several factors may have contributed to this result, namely environmental factors such as obstacles, trees, walls, and the geography of the terrain. of RSSI (pRSSI)and the independent variable being the distance to the gateway. The results in Table 4 allow us to observe that, with a correlation factor, Multiple R is equal to 0.9016, showing that there is a strong correlation between the two variables. However, the value obtained for R Square, 0.813, shows us that only 81.3% of the observed cases fit the obtained model, when the desirable value would be 95%. Several factors may have contributed to this result, namely environmental factors such as obstacles, trees, walls, and the geography of the terrain. **Table 4.** Linear regression summary output.

we applied a linear regression model to the data obtained, with the dependent variable being power

*Future Internet* **2020**, *12*, x FOR PEER REVIEW 24 of 32

**Table 4.** Linear regression summary output.


From the analysis, a *p*-value much lower than 0.05 (tends to zero) was obtained, so it is clear that there is a strong dependence of the variable pRSSI on distance, as expected. From the analysis, a *p-*value much lower than 0.05 (tends to zero) was obtained, so it is clear that there is a strong dependence of the variable pRSSI on distance, as expected.

Figure 13a presents a boxplot of the data obtained, with some deviations that help to explain the bias observed in R Square. In Figure 13b, we present a scatter plot with a trend line, which shows the adjustment of the line to the point cloud obtained from the pRSSI readings. Figure 13a presents a boxplot of the data obtained, with some deviations that help to explain the bias observed in R Square. In Figure 13b, we present a scatter plot with a trend line, which shows the adjustment of the line to the point cloud obtained from the pRSSI readings.

(**a**)

**Figure 13.** *Cont.*

*Future Internet* **2020**, *12*, x FOR PEER REVIEW 25 of 32

**Figure 13.** (**a**) Boxplot graph for pRSSI; (**b**) Linear regression scatter plot graph with trend line. **Figure 13.** (**a**) Boxplot graph for pRSSI; (**b**) Linear regression scatter plot graph with trend line.**Figure 13.** (**a**) Boxplot graph for pRSSI; (**b**) Linear regression scatter plot graph with trend line.

To carry out accurate measurements with an error of less than one meter, we used the Google Maps© tool, specifically the "Measure distance" option. Figure 14 shows the process of obtaining the sites for measuring RSSI power. To carry out accurate measurements with an error of less than one meter, we used the Google Maps© tool, specifically the "Measure distance" option. Figure 14 shows the process of obtaining the sites for measuring RSSI power. To carry out accurate measurements with an error of less than one meter, we used the Google Maps© tool, specifically the "Measure distance" option. Figure 14 shows the process of obtaining the sites for measuring RSSI power.

**Figure 14.** Distance calculation process for RSSI tests. **Figure 14.** Distance calculation process for RSSI tests. **Figure 14.** Distance calculation process for RSSI tests.

We are convinced that the use of strategically located gateways that comply with the LoRa and LoRaWAN specifications, namely in terms of the power and gain of the external antennas, will have a considerable impact on the coverage and power of the received signal. We are convinced that the use of strategically located gateways that comply with the LoRa and LoRaWAN specifications, namely in terms of the power and gain of the external antennas, will have a considerable impact on the coverage and power of the received signal. We are convinced that the use of strategically located gateways that comply with the LoRa and LoRaWAN specifications, namely in terms of the power and gain of the external antennas, will have a considerable impact on the coverage and power of the received signal.

#### **7. Discussion 7. Discussion 7. Discussion**

Relevant facts related to the COVID-19 pandemic obliges us to think about new approaches of fast application regarding the protection and monitoring of the elderly, while promoting physical distancing and keeping them in their comfort zone, with the current proposal serving as a catalyst for a fast implementation of systems that can save human lives. In the case of housing, actuators may Relevant facts related to the COVID-19 pandemic obliges us to think about new approaches of fast application regarding the protection and monitoring of the elderly, while promoting physical distancing and keeping them in their comfort zone, with the current proposal serving as a catalyst for a fast implementation of systems that can save human lives. In the case of housing, actuators may Relevant facts related to the COVID-19 pandemic obliges us to think about new approaches of fast application regarding the protection and monitoring of the elderly, while promoting physical distancing and keeping them in their comfort zone, with the current proposal serving as a catalyst for a fast implementation of systems that can save human lives. In the case of housing, actuators may be

incorporated that will trigger certain actions, such as cutting the gas, water supply or electrical power, as well as triggering the discharge of fire-retardant chemicals.

Using the system proposed, isolated inhabitants, mostly the elderly, can move freely through the outside spaces of their homes without feeling confined in terms of their freedom and privacy, and in case of suffering some type of accident, fall or change in vital signs, a distress mechanism can be triggered by entities, family or friends, acquiring access to the GPS coordinates of their most recent location.

Taking into account both the current situation of the COVID-19 pandemic in Portugal and across the world, elderly people, who are naturally more vulnerable, and their families can benefit from this system, essentially due to the fact that family members, firefighters and security forces will have access to users' information and will be able to trigger a support action whenever any critical value in a given sensor is reached.

By including monitoring alongside georeferencing, the event of a fall or immobilization outside the residence will also enable the triggering of rescue means.

One of the most frequent causes of death in Portuguese rural regions has to do with carbon monoxide poisoning related to the use of braziers. This is another situation in which there can be a considerable benefit—whenever the sensors detect too high values of carbon monoxide, support teams, security forces or family members can provide support immediately.

It is also important to refer to the data obtained in the RSSI power readings, which raise some doubts in terms of coverage, as analyzed in the results section. The global solution to solving these coverage failures must use gateways with redundant and multichannel coverage, so that there is no blocking of devices when a gateway is sending data. When a device (LoRa node) sends data, it can be received by several gateways, though, depending on the quality of the received RSSI signal, only one gateway sends data, with the other data being discarded.

Another issue to be considered in this field is related to the placement of the antenna of each gateway, ensuring that they are properly located, at strategic points, in order to maximize the gain.

#### **8. Conclusions**

This article explores a very relevant application area for society, considering the potential underlying Long-Range (LoRa) telecommunications equipment and devices that are currently available on the market at low cost, but with high potential. The massification of IoT, directly related to the use of these miniaturized devices in the field of ubiquitous and pervasive computing, provides an excellent opportunity for their use in the follow-up and monitoring of elderly people and in the monitoring of their homes, namely with sensors that can detect floods, gas leaks, excess carbon monoxide, fires and other data.

The use of LoRa and TTN networks is specifically targeted at agricultural production and farming as well as the monitoring of environmental conditions in cities. Our approach, by introducing aspects related to the monitoring of people who are in a particularly vulnerable situation, especially the elderly, derived from COVID-19, is a challenge for us. We believe that we have demonstrated that it is possible to monitor people and their homes, offering them more security as well as a low-cost system, while ensuring their privacy.

Nevertheless, there are some barriers to the mass use of systems based on this technology, first of all due to the weak network of gateways available in the region, making it necessary to carry out studies on the implementation of equipment that reduces the shadow zones and allows redundant coverage.

Another relevant factor is related to the frequency of sending data and the volume of data produced, since LoRa networks are not designed to send large volumes of data, nor to be permanently connected in order to send data at a high frequency, for example, every 5 s. They are usually designed to send data in intervals of several minutes (10 to 30 min or more), which, to guarantee assistance to individuals in danger or who have experienced an accident, may be too long and may save lives or minimize risks. For this reason, the use of Artificial Intelligence with machine learning algorithms

can make an important contribution, foreseeing and anticipating risk situations and minimizing the probability of risky events occurring.

As in all data collection systems with continuous processes, having production databases in Online Analytical Process (OLAP) mode would be ideal; however, given the restrictions mentioned above, it is not currently possible to have systems that are capable of continuous data analysis processes. Thus, the inclusion of data mining, machine learning and Artificial Intelligence algorithms will have to operate on previously prepared databases rather than on production databases, using the concept of data warehousing, with pre- and post-processing. However, this does not invalidate the fact that, through Node-RED, a continuous connection for data analysis can be established, for example, by Message Queue Telemetry Transport (MQTT), which is the standard for IoT messaging.

Finally, it should be noted that, in order to guarantee all ethical and data protection principles in future work, the National Data Protection Commission will be informed of the objectives of our system and the way in which it functions. Anonymous data collection authorization will be requested, for statistical purposes only, such as for academic and scientific research.

#### **9. Future Work**

In terms of future work, the implementation of a robust system is foreseen, with technology that is more suitable for the common user, such as miniaturized sensors, and with a second-generation prototype, where the various sensors proposed here are all operational and coupled.

Another feature to be developed includes the use of Artificial Intelligence with machine learning algorithms, so that the data acquired by the system can be used in predictive and data mining methods and algorithms. With this functionality, it becomes possible to predict risk situations for the elderly, anticipating situations that could be harmful. As an example, when some parameters of the user's body position are successively exceeded, perhaps meaning a situation of imminent risk of falling, a possible preventive action can be triggered.

This approach will be based on studies carried out on subjects, namely the study presented in [68], where the authors characterize different types of sensors and their applications to prevent and predict both fall situations and the possible factors contributing to falls, namely physiological and biological factors. Real-time monitoring of the elderly can benefit from the use of data mining algorithms, namely Support Vector Machine (SVM), Gaussian Distribution of Clustered Knowledge, Multilayer Perceptron, Naive Bayes, Decision Trees, ZeroR, and OneR to gain insights into the data in order to detect and even predict future falls, as referred to in [69]. The integration of the system with Cloud platforms, namely the commercial platforms of Azure ML [70] or MathLab ML [71], may be an option, but they have high maintenance costs, so opensource platforms are the most favorable option, namely Node-RED [72].

The implementation of machine learning flows in Node-RED can be performed on a small low-cost computer, "Raspberry PI 3", by simply installing the necessary software and its dependencies, "[node-red-contrib-machine-learning]". This library adds the necessary functionalities to Node-RED to implement flows and to test and evaluate the predictive methods of machine learning incorporated in the tool. Figure 15 shows a set of sample workflows for a predictive method, in this case a decision tree classifier.

**Figure 15.** Example of flows for machine learning (source [72]): (**a**) this flow loads a csv file, shuffles it and creates a training and a test partition; (**b**) this flow loads a training partition and trains a 'decision tree classifier', saving the model locally; (**c**) this flow loads a test partition and evaluates a previously trained model; (**d**) this flow shows how to use a trained model during deployment. Data are received via Message Queue Telemetry Transport (MQTT), predictions are made and then sent **Figure 15.** Example of flows for machine learning (source [72]): (**a**) this flow loads a csv file, shuffles it and creates a training and a test partition; (**b**) this flow loads a training partition and trains a 'decision tree classifier', saving the model locally; (**c**) this flow loads a test partition and evaluates a previously trained model; (**d**) this flow shows how to use a trained model during deployment. Data are received via Message Queue Telemetry Transport (MQTT), predictions are made and then sent back.

**Author Contributions:** Conceptualization, methodology, software and hardware assembly, J.P.L.; validation, S.A.; writing—review and editing, J.P.L., S.A. All authors have read and agreed to the published version of the **Author Contributions:** Conceptualization, methodology, software and hardware assembly, J.P.L.; validation, S.A.; writing—review and editing, J.P.L., S.A. All authors have read and agreed to the published version of the manuscript.

manuscript. **Funding:** This work was funded by National Funds through the Foundation for Science and Technology (FCT), **Funding:** This work was funded by National Funds through the Foundation for Science and Technology (FCT), I.P., within the scope of the project Refª UIDB/05583/2020.

I.P., within the scope of the project Refª UIDB/05583/2020. **Acknowledgments:** This work was funded by National Funds through the Foundation for Science and **Acknowledgments:** This work was funded by National Funds through the Foundation for Science and Technology (FCT), I.P., within the scope of the project Refª UIDB/05583/2020. Furthermore, we would like to thank the Research Centre in Digital Services (CISeD) and the Polytechnic of Viseu for their support.

Technology (FCT), I.P., within the scope of the project Refª UIDB/05583/2020. Furthermore, we would like to thank the Research Centre in Digital Services (CISeD) and the Polytechnic of Viseu for their support. **Conflicts of Interest:** The authors declare no conflict of interest.

#### **Conflicts of Interest:** The authors declare no conflicts of interest. **References**

back.


durante a pandemia às respostas pós-pandemia Territorial and urban health: From pre-pandemic and


**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
