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

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.


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][4][5][6][7][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.
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 Future Internet 2020, 12, 206 4 of 30 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.

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 Future Internet 2020, 12, 206 5 of 30 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].

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.

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.

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 Future Internet 2020, 12, 206 6 of 30 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.

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.

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 Future Internet 2020, 12, 206 7 of 30 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][31][32][33][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][48][49], the authors conclude that LoRa technology supported by the LoRaWAN architecture is the one that best meets the requirements.

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]: • End Device, Node, Mote: an object with an embedded low-power communication device. • Gateway: devices that form the bridge between other devices and The Things Network. These devices use low-power networks like LoRaWAN to connect to the gateway, while the gateway uses high bandwidth networks like Wi-Fi___33, ethernet or cellular connections to connect to The Things Network.

•
Network Server: servers that route messages from end devices to the right application, and back.

•
Application: a piece of software running on a server.

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 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) scheme specific to the LoRaWAN network.
A representation of the LoRaWAN stack can be seen in Figure 2. 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.
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.

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 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) scheme specific to the LoRaWAN network.
A representation of the LoRaWAN stack can be seen in Figure 2.

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 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) scheme specific to the LoRaWAN network.
A representation of the LoRaWAN stack can be seen in Figure 2. 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.
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 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.
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 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]: • Device Address (DevAddr): This is a 32-bit identifier that is unique within the network, present in each data frame and shared between the end device, network server, and application server. This differentiates nodes within the network, allowing the network to use the correct encryption keys and properly interpret the data. • Network Session Key (NwkSKey): This is a 128-bit AES encryption key that is unique per end device and is shared between the end device and network server. This provides message integrity for communications and provides security for end device to network server communication.

•
Application Session Key (AppSKey): This is a 128-bit AES encryption key that is unique per end device and is shared between the end device and application server. This is used to encrypt/decrypt application data messages and to provide security for application payload.
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.

•
Class A: All devices on the LoRaWAN network need to implement the functions described by this class, even those of class B and class C. Class A devices send information at their discretion (ALOHA). ALOHA is a specific type of MAC that is characterized by sending packets through the terminals when there is information to send from higher layers. As such, collisions can occur when there are simultaneous transmissions, since the medium is shared and not dedicated. In the case of not receiving a message, this type of MAC waits a certain time, called backoff, in order to retransmit the packet. • Class B: In addition to the capacity of class A devices, these devices are characterized by opening windows of extra time (ping slots) at defined time intervals. So, more data from the servers can be forwarded to devices in this class. Gateways send beacons so that the devices are synchronized and ready to open these extra windows. If a device wants to have class B functionality, it looks for the existence of these beacons. If these are not found, a BEACON_NOT_FOUND message is sent from the MAC layer to the application layer of the device. If a message from BEACON_LOCKED is found, it is sent to the application. The information that the device has passed class B is communicated to the network by sending a 1 bit message in the Fctrl field of the uplink messages. • Class C: This type of device configuration often has active reception windows, which implies higher energy consumption, so its implementation in real systems is rare. The reception windows practically only close when the device is transmitting.

Functional Requirements
In terms of functional requirements, the following operations are mainly considered: • Creation of a LoRaWAN gateway network in remote and isolated regions with redundant coverage, in which at least one gateway will be connected to the Internet (3G/4G); • Secure connection service with user registration, authentication and validation; • Data collection function of sensors attached to the device (GPS, accelerometer, temperature, pulse, body humidity); • Housing sensor data collection function (temperature, gases, smoke, flood); • User data sending function via LoRa communication;

•
Portable device parameterization and configuration function; • Real-time analysis of the data collected, to detect deviations beyond the permitted tolerances; • Alerts when there is an abnormal occurrence in the user's device (sent to family, friends or entities and security forces), namely when the equipment signal is lost, or a fall occurs.

Non-Functional Requirements
Equally important are the non-functional requirements, which are responsible for ensuring functionality and operability in accordance with minimum quality standards, namely: • Reliability-the system must be tested in order to improve its robustness, guaranteeing its operation in low-signal situations • Security-the system must be safe from the user's point of view, namely through both the placement of sensors in places that do not compromise the user's mobility, and the use of sensors that are not so fragile that they deteriorate, making the data collection useless. • Usability-the system should be easy to use. At this level, it is intended that the system has an easy-to-use interface, without requiring major user intervention. • Effectiveness-the system must be effective, accurate and proven to be useful in response to social needs at critical moments, such as those currently experienced by society.

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: • A data collection module for personal use, consisting of an ESP32-LoRa microcontroller with sensors, as mentioned above; • A housing status data collection module, consisting of an ESP32/LoRa microcontroller with environmental sensors (temperature, humidity, carbon monoxide, gas and smoke). Real-time analysis of the data collected, to detect deviations beyond the permitted tolerances; • Alerts when there is an abnormal occurrence in the user's device (sent to family, friends or entities and security forces), namely when the equipment signal is lost, or a fall occurs.

Non-Functional Requirements
Equally important are the non-functional requirements, which are responsible for ensuring functionality and operability in accordance with minimum quality standards, namely: • Reliability-the system must be tested in order to improve its robustness, guaranteeing its operation in low-signal situations • Security-the system must be safe from the user's point of view, namely through both the placement of sensors in places that do not compromise the user's mobility, and the use of sensors that are not so fragile that they deteriorate, making the data collection useless. • Usability-the system should be easy to use. At this level, it is intended that the system has an easy-to-use interface, without requiring major user intervention. • Effectiveness-the system must be effective, accurate and proven to be useful in response to social needs at critical moments, such as those currently experienced by society.

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: • A data collection module for personal use, consisting of an ESP32-LoRa microcontroller with sensors, as mentioned above; • A housing status data collection module, consisting of an ESP32/LoRa microcontroller with environmental sensors (temperature, humidity, carbon monoxide, gas and smoke).  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.

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  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].  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].

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].

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:

LoRa Gateway
The equipment used to build the LoRa gateway was as follows: One-channel gateway, with server software adapted from [63].
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. 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 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.

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

LoRa Node
The equipment used to build the prototype node was as follows: • Node software based on Cayenne LPP (secure up to 51 bytes of data), available in [64]. 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.

•
Resistance of 10KΩ; • Connection cables; • USB 3.3 V-5 V (Power Bank 5000 mAh SoundLogic Solar Powered); • Node software based on Cayenne LPP (secure up to 51 bytes of data), available in [64]. 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.

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). 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.

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). 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].

Connection with ThingSpeak
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 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].

Connection with ThingSpeak
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].
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 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.).  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).

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 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.

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 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.

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: • Statistical analysis of RSSI in remote areas, rural areas, and rugged terrains. • Shadow zones with several urban and natural obstacles, such as buildings and hills, among others, that cause disturbances in communication, reducing coverage.

•
The poor network of gateways installed in Portugal, which does not allow for minimum acceptable coverage for the implementation of a generalized system.

•
The tests carried out, despite being very limited and taking into account the fact that the gateway is installed indoors, did not allow communications beyond 1.2 km, which, although not negligible, is below the expected value.

•
The one-channel experimental gateway does not allow for application stress tests, nor system overload and robustness, so it only served as a proof of concept; however, the recent installation in the multi-channel gateway region can easily extend the range of the test and its robustness.
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):

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: • Statistical analysis of RSSI in remote areas, rural areas, and rugged terrains. • Shadow zones with several urban and natural obstacles, such as buildings and hills, among others, that cause disturbances in communication, reducing coverage.

•
The poor network of gateways installed in Portugal, which does not allow for minimum acceptable coverage for the implementation of a generalized system.

•
The tests carried out, despite being very limited and taking into account the fact that the gateway is installed indoors, did not allow communications beyond 1.2 km, which, although not negligible, is below the expected value.

•
The one-channel experimental gateway does not allow for application stress tests, nor system overload and robustness, so it only served as a proof of concept; however, the recent installation in the multi-channel gateway region can easily extend the range of the test and its robustness.
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):  Figure 12 shows a graph of the average data obtained, as presented in the previous table.   Figure 12 shows a graph of the average data obtained, as presented in the previous table. Higher RSSI values represent greater signal quality, while lower values represent poorer signal quality. According to [36], the RSSI values for LoRa networks are: • -30 dBm -> excellent quality; • -120 dBm -> very poor quality.
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. Higher RSSI values represent greater signal quality, while lower values represent poorer signal quality. According to [36], the RSSI values for LoRa networks are: • -30 dBm -> excellent quality; • -120 dBm -> very poor quality.
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.

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, 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. 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.

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, 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. 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. 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. 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.

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 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. 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.

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 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.

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 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.

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.

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. Future Internet 2020, 12, x FOR PEER REVIEW 28 of 32 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.