An IoT Smart Environment in Support of Disease Diagnosis Decentralization

: The percentage of seniors in the global population is constantly growing and solutions in the ﬁeld of fall detection and early detection of neuro-degenerative pathologies have a crucial role in order to increase life expectancy and quality of life. This study aims to extend fall detection and e ﬀ ective recognition of early signs of diseases to new smart environments, conceiving the decentralization of diagnostic monitoring in everyday life activities in a more pervasive paradigm. Inspiring to research outcomes, in this work an architecture is designed to detect falls in crowded indoor environments during events / exhibitions, for favoring a timely and e ﬀ ective intervention. It also foresees a continue monitoring of the gait for seniors during the visit, thus extracting key features which are stored on a dedicated database. The proposed solution allows third party researchers to perform analysis on the obtained gait datasets, through the adoption of advanced data-mining techniques for the detection of early signs of neuro-degenerative diseases and other pathologies. The architecture designed here aims to provide a step forward concerning the extension of smart monitoring environments for the detection of falls and early signs of pathologies in everyday life, in a more pervasive and decentralized paradigm.


Introduction
Aging of population and the percentage of seniors with respect to young people are constantly growing. In 2016, the world average life expectancy at birth was about 72.0 years (74.2 years for females and 69.8 years for males) [1], and it is expected to increase, as the global population above 65 years old is moving to reach one billion in 2030; its percentage over the population aged 20-64 years is expected to reach about 35% in 2050 [2].
In this demographic scenario, falling is one of the principal events that can cause injury leading to infirmity, long periods of treatment, and prolonged hospital stay, thus decreasing the quality of life of older adults. It is proved that fall probability increases with age, fragility level, obsessive history, and living conditions (i.e., living alone, in nursing homes or long-haul establishments) [3]. For these reasons, many researchers focused their efforts on fall detection algorithms and Ambient Assisted Living (AAL) systems that can automatically detect the fall event and notify it, even providing the user location for prompt help. These AAL solutions can increase independence and enhance the quality of life of seniors, especially for those living alone. On the other hand, aging also introduces several neuro-degenerative diseases, such as Parkinson's disease (PD) or Alzheimer's disease (AD).
At the time of writing, more than 1% of people over 60 years of age living in industrialized countries are affected by Parkinson's disease [4]. This percentage starts at 0.5% for people within devices. Basing on research efforts in these two fields, Section 3 describes the proposed system architecture for fall detection, fall location, and gait monitoring in crowded indoor environments. This effort aims to provide a step forward on the possibility to extend the monitoring of early signs of neuro-degenerative disorders beyond specific clinic tests in smart environments, to enhance the timely detection of such diseases and to prevent the exacerbation phase. Finally, Section 4 reports concluding remarks.

Fall Detection
This section gives an overview of fall-detection systems and their main principles. A fall detection system is defined as "an assisting device that is capable of sensing, processing and communicating alarm data if a fall happens under real-life conditions effectively" [10].
A common fall detection framework focuses on sending movement information to a handling unit. Once the device identifies a fall, a specific alert or action is triggered, for example, by playing specific sounds, executing actions, or sending alert messages which embed time of the fall, location, and status (i.e., cognizant/unaware) of the fallen person. Fall detection systems usually adopt a wearable sensor or use vision/ambient-based sensors for ambient sensing or implement hybrid solutions. Each approach shows different advantages and disadvantages related to accuracy, response time, and complexity [11].
The detection area of vision/ambient-based solutions is limited to the implemented sensor range, so their adoption is often limited to indoor premises only. Furthermore, the detection of falls in crowded environments is a very critical task even for state-of-the-art image recognition software. For this reason, in this work the attention is focused on wearable approach, which offers the chance to design and develop cost-effective monitoring solutions, both for indoor and outdoor scenarios, with a reduced loss of accuracy. In this approach, several low power electronic devices, equipped with accelerometer, gyroscope, and other sensors, are positioned on the human body according to an Internet of Things (IoT) paradigm.
Concerning data processing, threshold-based approaches are the first and simplest fall detection strategies. The work proposed in [12] is based on accelerometer and gyroscope data transformations, adopting specific thresholds to detect whether a movement is actually a fall.
Another approach is focused on the acceleration pattern recognition. In [13], researchers present a low-cost solution based on a microcontroller, an accelerometer and a short message service (SMS) module. The device monitors the acceleration pattern, in order to infer a fall event by identifying the correct acceleration phases (i.e., weightlessness, impact, motionless phases). When a fall is detected, the system sends an SMS in order to track the falling event location for medical help.
A key issue arising in fall detection is the difficulty to distinguish falls from other movements performed in daily activities. For this reason, several fall detection approaches monitor different biological signals in order to increase awareness and accuracy. Fusion of accelerometer sensor and other environmental sensors such as a microphone, useful to receive and identify sounds like human screaming and crying, can help to reduce false alarms for fall detection. Work described in [14] proposes a system able to detect falls through the analysis of accelerometer, audio input, and magnetometer sensor data.
In order to increase the accuracy and to enhance the fall detection affordability, machine learning (ML) algorithms have been investigated in recent research works, being them very promising for data analysis and prediction in several different research fields [15,16].
Focusing on the fall detection task, the study in [17] adopts a Naive Bayes algorithm to detect fall detection with sensor attached to chest and thigh. This solution is able to provide a classification accuracy of about 88%, while in [18], the choice of Support Vector Machines (SVM) solution allows to achieve higher accuracy (i.e., between 90% and 95%) on a single waist mounted sensor.
Electronics 2020, 9, 2108 4 of 21 The work reported in [19] provides an interesting comparison between different machine learning algorithm such as k-Nearest Neighbor (k-NN), SVM, Dynamic Time Warping (DTW), Least Squares Method (LSM), Bayesian Decision Making (BDM), Artificial Neural Networks (ANNs) on a six sensors-based system. Results show that LSM and k-NN appear to be the best solutions, providing 99% sensitivity, accuracy, and specificity. Furthermore, it has to be noted that for wearable fall detection systems based on a single device, the detection accuracy strictly depends on the position of the device (i.e., waist, arms, legs, etc.). In this case, solution near the center of mass of the human body [20] are preferred, due to the fact that it is much easier to detect a fall using the wearable device in such placement [21].

Gait Monitoring
As a new research frontier for wearable IoT systems, the study of human gait is arising as one of the most interesting methods to early detect neuro-degenerative diseases, in order to promptly intervene with medication strategies and to prevent aggravation of the pathology.
In literature, several gait monitoring tests have been performed through sensors placed on the body, thus providing several feature extraction methods from accelerometer and gyroscopes information. Concerning key parameters for gait, studies report that distinct gait features like increased double support time [22], reduced step/stride length and gait speed [23], decreased gait symmetry and regularity [24], reduced rotation of thigh, knee [25], trunk [23], and foot [26] are prototypical signs of Parkinson's disease or other pathologies.
Focusing on Inertial Measurement Unit (IMU) values, the authors in [27] have identified Parkinson walking patterns by selecting features related to the range of motion of the foot adopting SVM. They included step, sequence, and frequency-dependent features, combining information coming from different tasks in addition to straight walking, as inputs to an AdaBoost classifier. In the work described in [28], researchers used statistical features, together with some step features, using linear discriminant analysis (LDA). In the experiments conducted in [22], results show that Parkinsonian patients have lower step speed, step length, and swing time when compared to healthy control subjects.
In the direction of including motor symptoms of the whole body, researchers in [29] used Hidden Markov Models to represent gait sequences from lumbar IMUs, in association to a k-NN classifier. Furthermore, the study in [30] used only statistical features extracted from a smartphone accelerometer during postural sway and gait tests for the classification process through a Random Forest classifier.
Work described in [31] studied which of the gait features in a heterogeneous scenario are better to indicate the presence of Parkinson's disease. The study involved sensors location, feature extraction, classification ability obtained through several machine learning techniques available in the literature.
Work in [32] estimated step length using vertical acceleration measurements from a point near the center of mass (i.e., positioned at the waist) through the adoption of continuous wavelet transform and inverted pendulum models. It demonstrated that the center of mass is a good position for gait monitoring, due to the fact that sacrum oscillations are a good biomarker for Parkinson's disease [33].
Summarizing, several techniques are under investigation to effectively detect falls and to extract key features from gait, with the aim to identify early stages of neuro-degenerative pathologies. However, convergence between fall detection and gait monitoring solutions can be individuated at the waist position for sensors, since this position can provide both good fall detection accuracy and significant gait monitoring information for further analysis.

The Proposed System
This work proposes a hardware and software architecture for fall detection and gait monitoring, for seniors moving in a crowded event scenario such as an exhibition, a congress, a theatre (for opera, concerts, drama), a museum, or other indoor initiatives. The system envisages a smart environment designed to detect potential falls during the presence of the older adult within the facility; it is able to provide the precise location (i.e., room, floor, etc.) of the fall event, so as to allow the timely and effective intervention from security/health rescue personnel. Furthermore, the system is also able to continuously monitor the senior's gait during the event (i.e., observed in a free life condition) and to store the data in an appropriate database.
Specific analysis can be performed on this precious information dataset, by adopting third parties machine learning algorithms [31] for the detection of early signs of diseases (i.e., Parkinson's or Alzheimer's) on the associated users. In this way, the patient monitoring and early detection of pathologies can be extended to non-clinical facilities, in order to favor timely and effective treatments aimed to prevent the aggravation of their health condition.
The solution here proposed offers an effective real-time help in case of fall and it enables older adults to follow exhibitions, museums, theatres, and other events in a safer way, thus contributing to increase their inclusion in social and cultural life.
In the following, an overview of the designed system is provided. The architecture is composed by: • wearable IoT devices embedding low power edge computing capabilities, which are able to implement state-of-the-art fall detection algorithms (reported in Section 2.1) and to extract gait features (i.e., elaborating data acquired from accelerometer and gyroscope sensors); • an efficient, cost effective, and pervasive wireless communication network, which is able to manage hundreds/thousands of wearable devices with a low number of gateways, by adopting a very bandwidth efficient communication strategy; • a central software implementing check-in/check-out and fall alerting functionalities, and performing the storage of the meaningful gait data (retrieved wirelessly from wearable monitoring devices) in a specific database; such data can be useful for successive gait analysis with machine learning algorithms proposed in literature (reported in Section 2.2).
The designed solution adopts a belt with a wireless device (see Figure 1) placed at lower back (i.e., at sacrum) of the human body, communicating wirelessly with a central server through gateways disseminated in the indoor location facilities.
Electronics 2020, 9, x FOR PEER REVIEW 5 of 22 system is also able to continuously monitor the senior's gait during the event (i.e., observed in a free life condition) and to store the data in an appropriate database. Specific analysis can be performed on this precious information dataset, by adopting third parties machine learning algorithms [31] for the detection of early signs of diseases (i.e., Parkinson's or Alzheimer's) on the associated users. In this way, the patient monitoring and early detection of pathologies can be extended to non-clinical facilities, in order to favor timely and effective treatments aimed to prevent the aggravation of their health condition.
The solution here proposed offers an effective real-time help in case of fall and it enables older adults to follow exhibitions, museums, theatres, and other events in a safer way, thus contributing to increase their inclusion in social and cultural life.
In the following, an overview of the designed system is provided. The architecture is composed by: • wearable IoT devices embedding low power edge computing capabilities, which are able to implement state-of-the-art fall detection algorithms (reported in Section 2.1) and to extract gait features (i.e., elaborating data acquired from accelerometer and gyroscope sensors); • an efficient, cost effective, and pervasive wireless communication network, which is able to manage hundreds/thousands of wearable devices with a low number of gateways, by adopting a very bandwidth efficient communication strategy; • a central software implementing check-in/check-out and fall alerting functionalities, and performing the storage of the meaningful gait data (retrieved wirelessly from wearable monitoring devices) in a specific database; such data can be useful for successive gait analysis with machine learning algorithms proposed in literature (reported in Section 2.2).
The designed solution adopts a belt with a wireless device (see Figure 1) placed at lower back (i.e., at sacrum) of the human body, communicating wirelessly with a central server through gateways disseminated in the indoor location facilities. The electronic device embeds an accelerometer, a gyroscope, an internal temperature sensor, a microcontroller, a battery with power level sensor, and a Bluetooth Low Energy (BLE) transmitter.
The positioning chosen for wearing the device (i.e., at the waist on sacrum, near the center of mass of the human body) allows to obtain high quality accelerometer and gyroscope data, being it the best placement for fall detection with a single monitoring device, as described in literature [18,20,21]. The center of mass is a good position also for gait monitoring, due to the fact that sacrum oscillations are a good biomarker (e.g., for Parkinson's disease [33]). In fact, through sacrum data retrieved from the device, it is possible to measure meaningful data, such as its oscillations [33], and to estimate other key features, such as stride length, step length [32], and gait speed [23].
The wireless protocol, the communication, and location architecture, as well the wearable device design and functionalities are deeply explained in Section 3.2, Section 3.3, and Section 3.4, The electronic device embeds an accelerometer, a gyroscope, an internal temperature sensor, a microcontroller, a battery with power level sensor, and a Bluetooth Low Energy (BLE) transmitter.
The positioning chosen for wearing the device (i.e., at the waist on sacrum, near the center of mass of the human body) allows to obtain high quality accelerometer and gyroscope data, being it the best placement for fall detection with a single monitoring device, as described in literature [18,20,21]. The center of mass is a good position also for gait monitoring, due to the fact that sacrum oscillations are a good biomarker (e.g., for Parkinson's disease [33]). In fact, through sacrum data retrieved from the device, it is possible to measure meaningful data, such as its oscillations [33], and to estimate other key features, such as stride length, step length [32], and gait speed [23].
The wireless protocol, the communication, and location architecture, as well the wearable device design and functionalities are deeply explained in Section 3.2, Section 3.3, and Section 3.4, respectively. However, in order to better understand the system, the defined use cases are briefly described in the next section.

Use Cases
The use case scenario here depicted focuses on two cases: an older adult (or another person needing fall detection and recovery assistance) and a younger (presumably healthy) person going to visit a museum or an event.

Case A: Older Adult with Wearable Device
The first use case regards a senior who usually prefers to stay at home instead of attending events in public and crowded places (i.e., due to fear of falling or lack of confidence). When the senior buys a ticket or registers at the reception desk, she/he receives the belt with the embedded monitoring device. If needed, she/he is helped by receptionist to wear the belt, in order to comfortably wear it during the whole visit (i.e., few hours, depending on the type of event).
During the check-in procedure, the numerical identification (ID) of the monitoring device is associated with the registration ID of that specific user. In case the elderly person wearing the device is accompanied by a carer or a familiar, the smartphone of the accompanying person can be associated to the device (see the following use case "B" regarding the young subject), in order to share notifications and alerts.
During the visit/event, the wearable device monitors body accelerations (in order to detect a fall) and other relevant data related to gait (such as sacrum oscillations and accelerations), sending the obtained information to a central server through wireless communication. This central server parses the data received from all the gateways, monitoring information related to falls, and locating each worn device (i.e., each associated person) or enabled smartphones. In this way, the software location and alerting logic is able to recognize whether a fall occurs and to effectively locate the fallen person, so as to notify the event and to provide prompt help for her/his rescue.
Furthermore, gait data that are continuously received from wearable devices are stored in the envisaged database and they can be made available for analysis by third parties' algorithms, in order to infer if the senior user might be affected by pathologies.
At the end of the event, the device is returned to the facility reception during the check-out procedure. However, the association between the user and its gait data stored in the database enables the possibility to contact her/him successively, if gait analysis detects early signs of pathologies.

Case B: Younger Subject with Smartphone
In this second use case, a person without specific health problems is considered. The person can buy the ticket at the facility reception check-in or remotely, through a standard registration form inside the app (depending on the type of event). She/he can also choose to enable Bluetooth functionality in its smartphone, in order to be located by the system for safety issues. Furthermore, if the person is accompanying an older adult (who needs to use/wear the monitoring device as in case A) to the event, she/he can ask the personnel (e.g., at the facility reception check-in) to associate to its app account ID the identification number related to the monitoring device worn by a familiar/assisted person.
During the visit, the app provides the following functionalities: • Monitoring the location of the user smartphone for safety issues (e.g., fire, terrorist attack, health tracking, etc.); • monitoring the location of wearable(s) associated to the account; • receipt of a notification related to a potential problem (e.g., fall event or help request) associated to a wearable, together with its location, so as to promptly reach her/him if necessary.
• Finally, at the end of the event, a check-out procedure is envisaged when the user leaves the facility.

Wireless Communication Protocol: Bluetooth Low Energy
The wireless protocol adopted for IoT communication between wearable devices and the gateways is Bluetooth Low Energy, which is the low power version of a standard Bluetooth specifically designed for IoT [34] and wearable low power devices (i.e., able to operate on a coin cell battery for months or years). Applications adopting BLE are usually related to health care, fitness trackers, beacons, smart home, safety, entertainment, proximity sensors, industrial, and automotive. The choice of BLE as communication technology for the proposed architecture is motivated by the following reasons: • BLE gateways are easy to configure and to install (less time to configure, less cost); • each BLE gateway is able to monitor BLE advertising frames of hundreds of devices; • BLE devices can operate for at least some years with a coin cell battery without replacement.
Furthermore, the BLE framework is implemented on every commercial device, such as iOS, Android smartphones, or tablets, as well as Linux, Windows, and MacOS computers. This is mandatory to extend the indoor location service (i.e., with help request and navigation capabilities) also to usual user's smartphones in an easy and effective way.

Advertising Mode versus Connection Mode
A BLE device can communicate in two ways: by advertising data (i.e., connectionless broadcasting) or through a connection establishment procedure (i.e., connection mode).
By connectionless broadcasting, a device delivers data to a scanning device in its range, through the advertising frame payload, in a one-way data exchange mode. Broadcasting represents a lighter solution to send small amount of data to one or multiple devices at fixed time intervals.
Conversely, connection mode is used to transmit data in both directions, or to transfer a greater amount of information. It also offers security and privacy to data exchange, which are not provided in the advertising mode.
Specifically, focusing on the use cases related to the proposed architecture, there is no actual need of BLE connection mode. In fact, it is possible to broadcast all the envisaged data (device ID, fall detection flag, monitored gait features such as oscillation on 3D axis, etc.) inside the BLE advertising frame payload, in a connectionless and lighter solution without privacy issues. Under these assumptions, a commercial BLE gateway is able to sense several hundreds of BLE advertising frames, keeping low collision probability, thus monitoring several hundreds of different devices, if the advertising interval is about 500-700 ms [35].
In Bluetooth 4.x, the advertising payload contains a maximum of 31 octets, while in Bluetooth 5.x, the payload is increased to reach 255 octets by adding more advertising channels and new advertising Protocol Data Units (PDUs). However, the use of advertising mode for sending data is feasible only if a limited amount of data has to be transmitted. This issue introduces the crucial role of edge-computing on the wearable.
Concerning privacy issues, a particular attention has to be focused on the association of user and sensitive data, due to the fact that the advertising frame can be read by all other BLE devices in range. For this reason, the health-related values (i.e., sensitive data related to fall or gait monitoring) have to be associated with a wearable device identification value (device ID) generated during the user-wearable association at the reception check-in. This association is safely stored in the DB at the central server and the identity information is never transmitted in the wireless environment.

Eddystone BLE Advertising
Eddystone is a cross-platform, open-source beacon standard introduced by Google, similar to Apple iBeacon standard [36], but differing from it because it can be adopted without restrictions (it is compatible with both Android and IOS devices). Eddystone advertising employs beacons disseminated Electronics 2020, 9, 2108 8 of 21 in the environment, in order to provide the user with a better indication of the objects and places around her/him [37] in a Physical Web IoT paradigm [38]. The Eddystone advertising frame format is a good starting point for the design of dedicated BLE advertising frame format, being it fully compliant with gateways and devices already present on the market.
Eddystone defines several frame types [37] that can be advertised individually or in combination, such as:

•
Eddystone Ephemeral ID (EID), broadcasting an encrypted ephemeral identifier for increased security, thus requiring beacons and a specific resolving web service; • Eddystone Unique ID (UID), which broadcasts a specific beacon ID similar to iBeacon; • Eddystone TLM, which can be used to transmit telemetry (health and status) data related to the beacon itself; • Eddystone Uniform Resource Locator (URL), which broadcasts Uniform Resource Locators (URLs).

System Architecture
The communication architecture is composed by several location antennas, namely BLE gateways, disseminated in the indoor environment. They can be installed one per room in case of a museum, or they can follow a cellular coverage in case of wide areas such a concert hall, theatre, and so on. The gateways are connected to a central server, which implements all the core logic functionalities of the system, through a wired or Wi-Fi network (see Figure 2). Electronics 2020, 9, x FOR PEER REVIEW 8 of 22 frame format is a good starting point for the design of dedicated BLE advertising frame format, being it fully compliant with gateways and devices already present on the market. Eddystone defines several frame types [37] that can be advertised individually or in combination, such as: • Eddystone Ephemeral ID (EID), broadcasting an encrypted ephemeral identifier for increased security, thus requiring beacons and a specific resolving web service; • Eddystone Unique ID (UID), which broadcasts a specific beacon ID similar to iBeacon; • Eddystone TLM, which can be used to transmit telemetry (health and status) data related to the beacon itself; • Eddystone Uniform Resource Locator (URL), which broadcasts Uniform Resource Locators (URLs).

System Architecture
The communication architecture is composed by several location antennas, namely BLE gateways, disseminated in the indoor environment. They can be installed one per room in case of a museum, or they can follow a cellular coverage in case of wide areas such a concert hall, theatre, and so on. The gateways are connected to a central server, which implements all the core logic functionalities of the system, through a wired or Wi-Fi network (see Figure 2). A Service DataBase (sDB) is envisaged to store data related to: • fall location and detection service, • association between user and ID of the worn device, • gateways location coordinates (i.e., room, floor), • temporary association between devices/smartphones and gateways for indoor localization, • other telemetry data (battery level, device temperature, etc.). A Gait Monitoring DataBase (gmDB) stores gait monitoring data retrieved from wearable devices which are moving around, under the coverage of BLE gateways.
Briefly, when a fall event is detected by the logic of the wearable device placed at the belt, the fall detection flag in the BLE advertised frame changes, thus triggering an alert to the system. Furthermore, the wearable device also monitors the gait behavior of the seniors, through the elaboration of accelerometer and gyroscope real time data in an edge-computing paradigm, in order to extract key movement features which can be useful to recognize dysfunctions in gait related to A Service DataBase (sDB) is envisaged to store data related to: • fall location and detection service, • association between user and ID of the worn device, • gateways location coordinates (i.e., room, floor), • temporary association between devices/smartphones and gateways for indoor localization, • other telemetry data (battery level, device temperature, etc.).
A Gait Monitoring DataBase (gmDB) stores gait monitoring data retrieved from wearable devices which are moving around, under the coverage of BLE gateways.
Briefly, when a fall event is detected by the logic of the wearable device placed at the belt, the fall detection flag in the BLE advertised frame changes, thus triggering an alert to the system. Furthermore, the wearable device also monitors the gait behavior of the seniors, through the elaboration of accelerometer and gyroscope real time data in an edge-computing paradigm, in order to extract key movement features which can be useful to recognize dysfunctions in gait related to pathologies. Subsequently, the device writes this information inside the BLE advertising frame to be delivered to the central server.
Gait data for each senior (wearable) are then stored in the specific gmDB and they remain available for analysis by third parties' algorithm (e.g., machine learning algorithms), which can help to detect any early signs of pathologies. The storage of the information in the databases can be removed after a configurable time, depending on the privacy laws of countries and on the requirements imposed by third parties' data mining algorithms.

BLE Gateways
Gateways are commercial devices (e.g., Raspberry PI systems with BLE radio and directional antennas) that are positioned at known fixed coordinates; each gateway location is stored in the service DB. They are able to detect the BLE advertising frames emitted by the devices moving in their monitoring area. Specifically, these gateways perform scanning procedure to detect advertising frames of BLE devices nearby. Consequently, they provide the list of detected BLE advertising frames to the central server through HTTP/Post method. These frames contain the following specific information: Common IOS and Android devices can advertise BLE frames as iBeacon or Eddystone device. In that case, the logic of the proposed system is also able to locate smartphones, in order to obtain their location (e.g., in case of emergency or fall detection), as described in the use case B in Section 3.1.2. These gateways will consequently provide the list of detected BLE advertising frames to the central server, through HTTP/Post method.

Central Server
The central server is the core element of the system. Its main features are summarized as follows: • It associates the wearable device to the user during the check-in procedure; association can be actuated, for example, through e-mail or phone number, so as to contact the senior when early symptoms of diseases are detected by algorithms on acquired gait data; • it manages the event registration through the app for smartphone users; • if needed, it associates the wearable to the smartphone user for app notifications; • it implements the location logic (see Section 3.3.3) in order to constantly locate each device within the facility; • it implements the alert notification logic for the app; • it is responsible of storing gait data retrieved by wearable devices in the related database, in order to make them available for analysis by third parties' algorithms; • when early symptoms of diseases are detected by algorithms on its acquired gait data, it communicates with third parties' servers, in order to retrieve the identification associated with the examined user; • it constantly monitors the presence of fall events, by reading the fall detection flag of all wearables' advertising frames forwarded by gateways; • in case of a fall event, it locates the device and automatically forwards the information to the care takers and to associated smartphone users, if any, for emergency response.

Location Logic
The logic envisaged for locating the wearable devices and the smartphones within the facility covered by the service is implemented in the central server. In particular, each device, being it a wearable device or a smartphone, provides its unique ID in the advertised frame. This ID is detected and reported in one or more lists with a specific RSSI value, filtered in order to mitigate fluctuations due to shadowing and multipath fading effects [39]. All the lists of detected devices forwarded by gateways in a specific time interval (e.g., 1 s) are parsed. The device is then considered associated with the gateway reporting the better (i.e., highest) RSSI value, so it is located within the ranging area of such gateway.

Wearable Device
The wearable monitoring device designed in this system (see Figure 3) is composed of a battery (equipped with voltage and temperature sensor), an accelerometer, a gyroscope, a microcontroller, and a BLE transmitter, which broadcasts a specific advertisement frame.

Location Logic
The logic envisaged for locating the wearable devices and the smartphones within the facility covered by the service is implemented in the central server. In particular, each device, being it a wearable device or a smartphone, provides its unique ID in the advertised frame. This ID is detected and reported in one or more lists with a specific RSSI value, filtered in order to mitigate fluctuations due to shadowing and multipath fading effects [39]. All the lists of detected devices forwarded by gateways in a specific time interval (e.g., 1 s) are parsed. The device is then considered associated with the gateway reporting the better (i.e., highest) RSSI value, so it is located within the ranging area of such gateway.

Wearable Device
The wearable monitoring device designed in this system (see Figure 3) is composed of a battery (equipped with voltage and temperature sensor), an accelerometer, a gyroscope, a microcontroller, and a BLE transmitter, which broadcasts a specific advertisement frame. Data processing on the wearable is carried out according to an edge-computing paradigm, in order to shift the computation load inside the wearable for both fall detection and gait features extraction.
While the user wears the belt with the embedded monitoring device, sensors acquire real time acceleration data related to the X, Y, Z axes and oscillation data related to the three-dimension angles, and they deliver this data to the microcontroller unit (MCU) for processing and further transmission to the system through BLE advertisement. The adopted sensors provide adequate quality of measurement in terms of accuracy, precision, resolution and range.
This solution allows to communicate only few data (i.e., some status/parameters) in the BLE advertising frame, thus allowing to monitor many devices with less bandwidth usage, faster response times, and transfer rates.

Technical Details of the Wearable Device
The adopted hardware is an Intel Curie module with an Intel Quark Core x86 CPU running at 32 MHZ clock with 8 kilobytes (KB) of L1 cache and a 32-bit Argonaut RISC Core for the sensor subsystem. It also integrates on the same board a Bluetooth 4.0 transmitter and a six-axes gyroscope/accelerometer sensor. The memory storage is 384 KB on Flash and 80 KB of SRAM. Data processing on the wearable is carried out according to an edge-computing paradigm, in order to shift the computation load inside the wearable for both fall detection and gait features extraction.
While the user wears the belt with the embedded monitoring device, sensors acquire real time acceleration data related to the X, Y, Z axes and oscillation data related to the three-dimension angles, and they deliver this data to the microcontroller unit (MCU) for processing and further transmission to the system through BLE advertisement. The adopted sensors provide adequate quality of measurement in terms of accuracy, precision, resolution and range.
This solution allows to communicate only few data (i.e., some status/parameters) in the BLE advertising frame, thus allowing to monitor many devices with less bandwidth usage, faster response times, and transfer rates.

Technical Details of the Wearable Device
The adopted hardware is an Intel Curie module with an Intel Quark Core x86 CPU running at 32 MHZ clock with 8 kilobytes (KB) of L1 cache and a 32-bit Argonaut RISC Core for the sensor subsystem. It also integrates on the same board a Bluetooth 4.0 transmitter and a six-axes gyroscope/accelerometer sensor. The memory storage is 384 KB on Flash and 80 KB of SRAM.
The Intel Quark embeds a pattern recognition accelerator with 128 built-in neuron nodes, thus envisaging machine learning capabilities with low power consumption. It can operate from −25 • to 70 • degrees, and the device is powered in DC mode (i.e., with Li-Po battery) at 3.3 V or 1.8 V.
Concerning power consumption, in laboratory tests the device (positioned on the belt as shown in Figure 4) is able to monitor fall and gait behavior for more than 37 h continuously (i.e., with an average current intensity of about 45 mA) when the device is powered by a 1700 mAh-3.7 V battery pack and the BLE advertising interval is set at 700 ms.
Electronics 2020, 9, x FOR PEER REVIEW 11 of 22 The Intel Quark embeds a pattern recognition accelerator with 128 built-in neuron nodes, thus envisaging machine learning capabilities with low power consumption. It can operate from −25° to 70° degrees, and the device is powered in DC mode (i.e., with Li-Po battery) at 3.3 V or 1.8 V.
Concerning power consumption, in laboratory tests the device (positioned on the belt as shown in Figure 4) is able to monitor fall and gait behavior for more than 37 h continuously (i.e., with an average current intensity of about 45 mA) when the device is powered by a 1700 mAh-3.7 V battery pack and the BLE advertising interval is set at 700 ms. However, battery life and power consumption can be improved by using better performing chipsets in future refinements, such as ARM Cortex M4.

Fall Detection Algorithm
In order to implement the fall detection functionality, the device continuously monitors the acceleration to which the wearable is subject. A local fall detection algorithm processes the data detected by the acceleration sensor, so as to infer whether a fall has occurred or not. When a fall is detected, a specific flag (i.e., fall flag) in the advertised data frame is switched from 0 to 1. This flag persists unaltered for several advertisement frames before being reset to zero, in order to cope with possible frame losses. The persistence of the fall detection flag can be carefully calibrated (e.g., 2-3 s), in order to allow the alerting logic to detect every fall notification. In this way, the system is able to proceed with the detection of the event at central server level and to activate all the needed help and notification procedures.
As a first stage, a pattern recognition procedure can be implemented as suggested in [13], by processing the acceleration behavior on X, Y, Z axes and matching it with a specific fall pattern. Typically, this pattern is composed by three consecutive phases: a weightlessness phase, during which acceleration goes to zero due to free fall, followed by an impact phase, characterized by an acceleration peak occurring when the body hits the ground, and a final motionless phase.
As a second stage, in order to refine the fall detection accuracy, different neural-network classifiers can be implemented on the machine learning module of the wearable device, trained with specific fall datasets [40]. Recent studies, implementing Radial Basis Function (RBF) on SVM [41,42] and k-NN [43] on low power devices, demonstrate that the adoption of machine learning algorithms allows to achieve an accuracy higher than 95%. Furthermore, applicability of machine learning algorithms can be expanded with the adoption of more performing processors, enabling the adoption of TensorFlow libraries. It is possible to integrate such devices in the BLE communication infrastructure through the implementation of the same advertising frame format. However, battery life and power consumption can be improved by using better performing chipsets in future refinements, such as ARM Cortex M4.

Fall Detection Algorithm
In order to implement the fall detection functionality, the device continuously monitors the acceleration to which the wearable is subject. A local fall detection algorithm processes the data detected by the acceleration sensor, so as to infer whether a fall has occurred or not. When a fall is detected, a specific flag (i.e., fall flag) in the advertised data frame is switched from 0 to 1. This flag persists unaltered for several advertisement frames before being reset to zero, in order to cope with possible frame losses. The persistence of the fall detection flag can be carefully calibrated (e.g., 2-3 s), in order to allow the alerting logic to detect every fall notification. In this way, the system is able to proceed with the detection of the event at central server level and to activate all the needed help and notification procedures.
As a first stage, a pattern recognition procedure can be implemented as suggested in [13], by processing the acceleration behavior on X, Y, Z axes and matching it with a specific fall pattern. Typically, this pattern is composed by three consecutive phases: a weightlessness phase, during which acceleration goes to zero due to free fall, followed by an impact phase, characterized by an acceleration peak occurring when the body hits the ground, and a final motionless phase.
As a second stage, in order to refine the fall detection accuracy, different neural-network classifiers can be implemented on the machine learning module of the wearable device, trained with specific fall datasets [40]. Recent studies, implementing Radial Basis Function (RBF) on SVM [41,42] and k-NN [43] on low power devices, demonstrate that the adoption of machine learning algorithms allows to achieve an accuracy higher than 95%. Furthermore, applicability of machine learning algorithms can be expanded with the adoption of more performing processors, enabling the adoption of TensorFlow libraries. It is possible to integrate such devices in the BLE communication infrastructure through the implementation of the same advertising frame format.
Concerning sensor data reception and their meaningfulness related to fall events and gait behavior, accelerometer data on the three axes related to a fall occurrence during a walk are shown in Figure 5. Here, it is clearly visible the weightlessness phase, followed by an impact and a successive motionless phase.
Electronics 2020, 9, x FOR PEER REVIEW 12 of 22 Concerning sensor data reception and their meaningfulness related to fall events and gait behavior, accelerometer data on the three axes related to a fall occurrence during a walk are shown in Figure 5. Here, it is clearly visible the weightlessness phase, followed by an impact and a successive motionless phase.

Gait Monitoring Algorithm
A second algorithm continuously monitors the accelerometer and gyroscope data. In the following figures data retrieved from accelerometer (see Figures 6 and 7) and gyroscope (see Figures  8 and 9) are reported. They are obtained during a healthy gait on a straight path (i.e., walking through a theatre hall) and compared with a shuffling gait on the same path.

Gait Monitoring Algorithm
A second algorithm continuously monitors the accelerometer and gyroscope data. In the following figures data retrieved from accelerometer (see Figures 6 and 7) and gyroscope (see Figures 8 and 9) are reported. They are obtained during a healthy gait on a straight path (i.e., walking through a theatre hall) and compared with a shuffling gait on the same path. Concerning sensor data reception and their meaningfulness related to fall events and gait behavior, accelerometer data on the three axes related to a fall occurrence during a walk are shown in Figure 5. Here, it is clearly visible the weightlessness phase, followed by an impact and a successive motionless phase.

Gait Monitoring Algorithm
A second algorithm continuously monitors the accelerometer and gyroscope data. In the following figures data retrieved from accelerometer (see Figures 6 and 7) and gyroscope (see Figures  8 and 9) are reported. They are obtained during a healthy gait on a straight path (i.e., walking through a theatre hall) and compared with a shuffling gait on the same path.   Concerning sensor data reception and their meaningfulness related to fall events and gait behavior, accelerometer data on the three axes related to a fall occurrence during a walk are shown in Figure 5. Here, it is clearly visible the weightlessness phase, followed by an impact and a successive motionless phase.

Gait Monitoring Algorithm
A second algorithm continuously monitors the accelerometer and gyroscope data. In the following figures data retrieved from accelerometer (see Figures 6 and 7) and gyroscope (see Figures  8 and 9) are reported. They are obtained during a healthy gait on a straight path (i.e., walking through a theatre hall) and compared with a shuffling gait on the same path.     Accelerometer and gyroscope values are then processed in order to obtain sacrum accelerations on the three axes and oscillations through the three dimension angles. Specifically, fusion of signals from accelerometer and gyroscope is envisaged: gyroscope data are filtered through a high-pass filter to reduce the impact of gyroscope drift, and accelerometer data are filtered through a low-pass filter to mitigate the effect of vibration. Subsequently, data fusion is obtained through the combination of such data by adopting a Kalman filter [44] (see Figure 10), in order to accurately calculate oscillation angles in dynamic conditions (i.e., during gait) and to improve the accuracy of oscillation estimation. Features are extracted during the elaboration process, and they are listed as follows: • oscillation amplitude on the X, Y, Z angles; • oscillation frequency on the X, Y, Z angles.
These oscillations are strictly correlated with step length, sacrum oscillation, and other meaningful features related to Parkinson's and Alzheimer's diseases [32,33,45]. Data features obtained are then added to the BLE advertising frame to be transmitted. Finally, when saving the  Accelerometer and gyroscope values are then processed in order to obtain sacrum accelerations on the three axes and oscillations through the three dimension angles. Specifically, fusion of signals from accelerometer and gyroscope is envisaged: gyroscope data are filtered through a high-pass filter to reduce the impact of gyroscope drift, and accelerometer data are filtered through a low-pass filter to mitigate the effect of vibration. Subsequently, data fusion is obtained through the combination of such data by adopting a Kalman filter [44] (see Figure 10), in order to accurately calculate oscillation angles in dynamic conditions (i.e., during gait) and to improve the accuracy of oscillation estimation. Features are extracted during the elaboration process, and they are listed as follows: • oscillation amplitude on the X, Y, Z angles; • oscillation frequency on the X, Y, Z angles.
These oscillations are strictly correlated with step length, sacrum oscillation, and other meaningful features related to Parkinson's and Alzheimer's diseases [32,33,45]. Data features obtained are then added to the BLE advertising frame to be transmitted. Finally, when saving the Accelerometer and gyroscope values are then processed in order to obtain sacrum accelerations on the three axes and oscillations through the three dimension angles. Specifically, fusion of signals from accelerometer and gyroscope is envisaged: gyroscope data are filtered through a high-pass filter to reduce the impact of gyroscope drift, and accelerometer data are filtered through a low-pass filter to mitigate the effect of vibration. Subsequently, data fusion is obtained through the combination of such data by adopting a Kalman filter [44] (see Figure 10), in order to accurately calculate oscillation angles in dynamic conditions (i.e., during gait) and to improve the accuracy of oscillation estimation.  Accelerometer and gyroscope values are then processed in order to obtain sacrum accelerations on the three axes and oscillations through the three dimension angles. Specifically, fusion of signals from accelerometer and gyroscope is envisaged: gyroscope data are filtered through a high-pass filter to reduce the impact of gyroscope drift, and accelerometer data are filtered through a low-pass filter to mitigate the effect of vibration. Subsequently, data fusion is obtained through the combination of such data by adopting a Kalman filter [44] (see Figure 10), in order to accurately calculate oscillation angles in dynamic conditions (i.e., during gait) and to improve the accuracy of oscillation estimation. Features are extracted during the elaboration process, and they are listed as follows: • oscillation amplitude on the X, Y, Z angles; • oscillation frequency on the X, Y, Z angles.
These oscillations are strictly correlated with step length, sacrum oscillation, and other meaningful features related to Parkinson's and Alzheimer's diseases [32,33,45]. Data features obtained are then added to the BLE advertising frame to be transmitted. Finally, when saving the Features are extracted during the elaboration process, and they are listed as follows: • oscillation amplitude on the X, Y, Z angles; • oscillation frequency on the X, Y, Z angles.
These oscillations are strictly correlated with step length, sacrum oscillation, and other meaningful features related to Parkinson's and Alzheimer's diseases [32,33,45]. Data features obtained are then added to the BLE advertising frame to be transmitted. Finally, when saving the data in the gmDB at server side, also a mean value and a standard deviation for these features can be calculated and stored.

BLE Advertising
The Bluetooth module embedded in the wearable device periodically broadcasts (e.g., every 500 ms) an advertising frame that is detected by BLE gateways in its range. The advertising interval is configurable, so as to reach an optimal tradeoff between gateways capacity and promptness of fall detection.
In order to assure compatibility and easy integration with market BLE gateways and standard Eddystone/iBeacon ranging and location, the implemented payload format is a modified Eddystone UID advertising frame. Specifically, in the adopted solution, the 16-byte beacon ID of the original Eddystone UID frame format, which is composed of a 10-byte field named namespace and a 6-byte field named instance (as depicted in Figure 11), are exploited for sending information related to wearable device identification, fall status, gait features and some telemetry data related to the health and operation of the device (i.e., high temperature flag, low battery level flag, etc.).
Electronics 2020, 9, x FOR PEER REVIEW 14 of 22 data in the gmDB at server side, also a mean value and a standard deviation for these features can be calculated and stored.

BLE Advertising
The Bluetooth module embedded in the wearable device periodically broadcasts (e.g., every 500 ms) an advertising frame that is detected by BLE gateways in its range. The advertising interval is configurable, so as to reach an optimal tradeoff between gateways capacity and promptness of fall detection.
In order to assure compatibility and easy integration with market BLE gateways and standard Eddystone/iBeacon ranging and location, the implemented payload format is a modified Eddystone UID advertising frame. Specifically, in the adopted solution, the 16-byte beacon ID of the original Eddystone UID frame format, which is composed of a 10-byte field named namespace and a 6-byte field named instance (as depicted in Figure 11), are exploited for sending information related to wearable device identification, fall status, gait features and some telemetry data related to the health and operation of the device (i.e., high temperature flag, low battery level flag, etc.). In details, the 16 bytes are assigned to the following fields (see Figure 12): • 3 bytes for a unique device identification, enabling the possibility to identify more than 16 million devices; • 2 bytes for each X, Y, Z oscillation amplitude and frequency data, providing the availability of 65,536 appreciable levels for each value (for a total of 12 bytes); • 1 bit for the fall flag, notifying a detected fall; • 1 bit for high temperature flag (for device health telemetry); • 2 bits for maximum four battery levels (for device health telemetry); • 4 bits for maximum sixteen error codes (for device operation error reporting).  In details, the 16 bytes are assigned to the following fields (see Figure 12): • 3 bytes for a unique device identification, enabling the possibility to identify more than 16 million devices; • 2 bytes for each X, Y, Z oscillation amplitude and frequency data, providing the availability of 65,536 appreciable levels for each value (for a total of 12 bytes); • 1 bit for the fall flag, notifying a detected fall; • 1 bit for high temperature flag (for device health telemetry); • 2 bits for maximum four battery levels (for device health telemetry); • 4 bits for maximum sixteen error codes (for device operation error reporting). data in the gmDB at server side, also a mean value and a standard deviation for these features can be calculated and stored.

BLE Advertising
The Bluetooth module embedded in the wearable device periodically broadcasts (e.g., every 500 ms) an advertising frame that is detected by BLE gateways in its range. The advertising interval is configurable, so as to reach an optimal tradeoff between gateways capacity and promptness of fall detection.
In order to assure compatibility and easy integration with market BLE gateways and standard Eddystone/iBeacon ranging and location, the implemented payload format is a modified Eddystone UID advertising frame. Specifically, in the adopted solution, the 16-byte beacon ID of the original Eddystone UID frame format, which is composed of a 10-byte field named namespace and a 6-byte field named instance (as depicted in Figure 11), are exploited for sending information related to wearable device identification, fall status, gait features and some telemetry data related to the health and operation of the device (i.e., high temperature flag, low battery level flag, etc.). In details, the 16 bytes are assigned to the following fields (see Figure 12): • 3 bytes for a unique device identification, enabling the possibility to identify more than 16 million devices; • 2 bytes for each X, Y, Z oscillation amplitude and frequency data, providing the availability of 65,536 appreciable levels for each value (for a total of 12 bytes); • 1 bit for the fall flag, notifying a detected fall; • 1 bit for high temperature flag (for device health telemetry); • 2 bits for maximum four battery levels (for device health telemetry); • 4 bits for maximum sixteen error codes (for device operation error reporting).
By adopting this frame format, it is possible to transmit the wearable data to the central server through commercial gateways, in an anonymous and bandwidth-efficient way. Concerning smartphones, they adopt the same frame format, filling only the Device ID field for identification.
Data encryption can also be adopted for providing more privacy, security, and robustness to the communication, but it introduces an overhead by using some bytes of the payload, thus reducing the maximum number of addressable devices. To avoid this drawback, the last two RFU bytes (reserved for future use) of the payload can be exploited.

Testing and Validation of the Architecture
This section reports several meaningful tests which show the correctness, suitability, and feasibility of the proposed solution in real case scenarios, such as exhibitions, theatres, museums, concert hall, and so on. The architecture has been tested in its key features, with the aim to verify the proper functioning of the entire system. Different experiments have been conducted in various settings (laboratories, small and big classrooms, lecture halls, etc.), in a way to accurately reproduce a real scenario setting. Such experiments have been performed in University facilities, due to the difficulty to perform a fast and non-invasive trial installation in real environments (such as exhibitions, museums, theatres). In fact, the installation of the entire architecture needs specific permits, coverage plans, and on-site intervention which have not been possible since March 2020, due to the well-known restrictions related to the coronavirus disease 2019 (Covid-19) pandemic.
For these reasons, in order to carry out tests that reflect the real conditions as much as possible, such validations have been conducted in different University buildings and facilities, so as to cover several real scenarios close to the ones for which the system was developed. In particular, some experiments have been performed in a lecture hall with high ceiling (7 m), surrounded by reinforced concrete walls (compatible with a real exposition hall), and others in two contiguous classrooms, divided, and surrounded by brick walls, with a four meters high ceiling (simulating a museum).
As a first step, a single BLE gateway has been installed in a wide lecture hall (reproducing a small theatre) and configured through its embedded webserver to communicate with the central server through a Wi-Fi connection.
Subsequently, the broadcasting of the BLE advertising frame has been tested, by monitoring at the BLE gateway the reception of the transmitted frame by the wearable device, or possible losses/transmission errors. Several tests have been performed to measure the transmission range of the devices (i.e., gateway reception range related to the wearable advertised frame), by positioning the device at different distances from the gateway (as depicted in Figure 13) and retrieving RSSI values.
Electronics 2020, 9, x FOR PEER REVIEW 15 of 22 By adopting this frame format, it is possible to transmit the wearable data to the central server through commercial gateways, in an anonymous and bandwidth-efficient way. Concerning smartphones, they adopt the same frame format, filling only the Device ID field for identification.
Data encryption can also be adopted for providing more privacy, security, and robustness to the communication, but it introduces an overhead by using some bytes of the payload, thus reducing the maximum number of addressable devices. To avoid this drawback, the last two RFU bytes (reserved for future use) of the payload can be exploited.

Testing and Validation of the Architecture
This section reports several meaningful tests which show the correctness, suitability, and feasibility of the proposed solution in real case scenarios, such as exhibitions, theatres, museums, concert hall, and so on. The architecture has been tested in its key features, with the aim to verify the proper functioning of the entire system. Different experiments have been conducted in various settings (laboratories, small and big classrooms, lecture halls, etc.), in a way to accurately reproduce a real scenario setting. Such experiments have been performed in University facilities, due to the difficulty to perform a fast and non-invasive trial installation in real environments (such as exhibitions, museums, theatres). In fact, the installation of the entire architecture needs specific permits, coverage plans, and on-site intervention which have not been possible since March 2020, due to the well-known restrictions related to the coronavirus disease 2019 (Covid-19) pandemic.
For these reasons, in order to carry out tests that reflect the real conditions as much as possible, such validations have been conducted in different University buildings and facilities, so as to cover several real scenarios close to the ones for which the system was developed. In particular, some experiments have been performed in a lecture hall with high ceiling (7 m), surrounded by reinforced concrete walls (compatible with a real exposition hall), and others in two contiguous classrooms, divided, and surrounded by brick walls, with a four meters high ceiling (simulating a museum).
As a first step, a single BLE gateway has been installed in a wide lecture hall (reproducing a small theatre) and configured through its embedded webserver to communicate with the central server through a Wi-Fi connection.
Subsequently, the broadcasting of the BLE advertising frame has been tested, by monitoring at the BLE gateway the reception of the transmitted frame by the wearable device, or possible losses/transmission errors. Several tests have been performed to measure the transmission range of the devices (i.e., gateway reception range related to the wearable advertised frame), by positioning the device at different distances from the gateway (as depicted in Figure 13) and retrieving RSSI values.  In order to reduce known wireless propagation issues such as multipath fading, scattering and shadowing effects, the gateway has been attached to the ceiling as for a real case scenario; the wearable device was positioned at the sacrum.
The correct association of the device to the gateway located in its same room has been verified by covering two different rooms with two gateways (see Figure 14), moving the device in different positions inside the rooms and measuring, at each gateway, the different RSSI values related to the device position. Results show that RSSI values obtained for each position allow the location logic module to correctly associate the wearable to the gateway installed in its same room.
Electronics 2020, 9, x FOR PEER REVIEW 16 of 22 In order to reduce known wireless propagation issues such as multipath fading, scattering and shadowing effects, the gateway has been attached to the ceiling as for a real case scenario; the wearable device was positioned at the sacrum.
The correct association of the device to the gateway located in its same room has been verified by covering two different rooms with two gateways (see Figure 14), moving the device in different positions inside the rooms and measuring, at each gateway, the different RSSI values related to the device position. Results show that RSSI values obtained for each position allow the location logic module to correctly associate the wearable to the gateway installed in its same room. As a further test, two gateways were installed inside a unique wide room, as shown in Figure 15. This scenario adds the shadowing effect that a human body can provoke when it is interposed between gateway and IoT device. RSSI values measured for each device location allow to associate the wearable position to the correct gateway (the closest one) in almost all cases, even if shadowing effect can rarely cause a wrong association (as highlighted in the center of Figure 15). As a further test, two gateways were installed inside a unique wide room, as shown in Figure 15. This scenario adds the shadowing effect that a human body can provoke when it is interposed between gateway and IoT device. RSSI values measured for each device location allow to associate the wearable position to the correct gateway (the closest one) in almost all cases, even if shadowing effect can rarely cause a wrong association (as highlighted in the center of Figure 15). Further trials have been conducted in halls and classrooms differing in dimensions and/or shape, corridors, rooms divided by wooden walls, glass separators, and so on, involving different wood/metal furniture and settings, in order to verify that results are not significantly affected.
In all performed tests, the advertised frame is always received correctly by gateways with a negligible loss/error rate, when the distance between the device and the gateway is maintained below 25/30 m (i.e., by keeping the RSSI over −95/−99 dBm). This distance can be suitably reduced in order to cover crowded environments and to maintain a negligible loss/error rate. In case of lecture Further trials have been conducted in halls and classrooms differing in dimensions and/or shape, corridors, rooms divided by wooden walls, glass separators, and so on, involving different wood/metal furniture and settings, in order to verify that results are not significantly affected.
In all performed tests, the advertised frame is always received correctly by gateways with a negligible loss/error rate, when the distance between the device and the gateway is maintained below 25/30 m (i.e., by keeping the RSSI over −95/−99 dBm). This distance can be suitably reduced in order to cover crowded environments and to maintain a negligible loss/error rate. In case of lecture halls spanning more than 200/300 square meters, more than one gateway is envisaged for a good coverage (see Figure 15). On the other hand, the adoption of several gateways in the same room introduces some areas of uncertainty, related to the association device-gateway. This is due to electromagnetic effects such as multipath fading, scattering, and shadowing, which might grow in case of crowded environments. However, the location error caused by these effects remains limited to a few meters, without precluding a prompt intervention in case of fall detection.
Concerning the data management, tests have successfully checked the forwarding of the received data from gateways to the central server and its correct parsing (i.e., extracting information related to device id, fall flag, device temperature, battery level, gait oscillation amplitude, and frequency on the three axes), and DB storing. The location logic has been validated by monitoring the movement of the worn device while walking across different rooms, served by different BLE gateways, as briefly shown in Figure 14.
Fall detection functionality has been verified through the implementation of an acceleration pattern recognition algorithm inspiring to [13]. Fall events have been performed in order to verify that the process of localization and real-time notification works correctly, according to the whole detection-transmission-reception-localization process envisaged in the system.
As regards the feature extraction functionality during gait, BLE data transmission and successive DB storing have been tested with several monitored walks. A demonstration of good fall detection performance, obtained through the adoption of machine learning algorithms with the proposed hardware, has already been presented in [41]. In particular, research work [41] reports a performance analysis of fall detection algorithm implemented on our same wearable IoT device (i.e., the Intel Curie chipset described in Section 3.4), by adopting RBF neural network classifier [42] on the Intel Quark Core x86 CPU. Although the chipset and the electronics are the same, with respect to [41], the device adopted in the proposed work has a smaller form factor, in order to be easily worn in a smart belt. Results show that the device adopted in the proposed architecture is able to identify falls related to older adults with a detection accuracy higher than 95%, achieving a high recognition rate, reliability, and stability.
Concerning other machine learning algorithms, k-NN classifier has also been tested in [43], on a slightly different wearable device (i.e., Arduino Mega), providing more than 99% sensitivity, accuracy, and specificity. However, with respect to our device, the Arduino Mega adopted in [43] has not been optimized with pattern recognition acceleration for the adoption of k-NN. Therefore, we can reasonably assume that our device can achieve at least the same satisfactory performance (more than 99%).
Since the present work does not focus on the implementation of specific fall-detection algorithms, no further evaluation has been performed on such algorithms. This architecture leaves an open choice among the best solutions proposed in literature (see Section 2).
However, a key factor for the effectiveness of the whole architecture is the correct perception of each fall event detected by algorithms in the device. This functionality has been tested in different environment configurations, and the persistence of the active fall flag for 2-3 s (i.e., 3-4 advertising frames separated by 700 ms interval) allows to correctly receive the 100% of frames in absence of crowd, with subsequent data forwarding, parsing, and alerting notification of prompt assistance. However, a crowded environment can provoke the loss of some advertising frames, but it is sufficient to receive one out of five frames (i.e., 80% loss rate) to guarantee the notification of all fall events. Such loss rates are never reached in short range communications, even for indoor crowded situations, therefore the notification is always successfully received.
Concerning efficiency, the system is energy-efficient because it exploits Bluetooth Low Energy devices. BLE is commonly adopted also in earphones and wearable medical devices, due to its low power feature. Moreover, the proposed edge computing solution reduces communications, transmitting on the wireless channel only few bytes every 0.5-0.7 s on a connectionless mode (99% idle time), thus offering also very bandwidth-efficient communication.
The proposed architecture is also cost-effective, because no expensive hardware is needed for fall detection (i.e., with respect of HD cameras with expensive optics adopted in vision based or mixed approaches), exploiting only the proposed wearable and the wireless communication network, composed by cheap commercial gateways. Each gateway can monitor several hundreds of devices/persons in a wide area, thus offering a Wi-Fi connection for the data delivery, without the need of additional infrastructures.
The central server and DBs can be hosted on a commercial server, respecting the necessary security and privacy regulations of different countries. The wearable devices (which, at the time of writing, are implemented on experimental boards) can be developed with a cost-effective hardware and engineered in a small and cheap electronic board.
As regards the adoption of the architecture in real case scenarios, no particular steps are needed to perform a correct and effective transposition of the system for the use in theatres, exhibitions, museums, etc. However, as for a common Wi-Fi network installation, a coverage plan is needed to cope with each building specificity. In fact, the configuration and installation procedures and settings adopted in these trials are the same of a real case scenario, and the testing environment has been chosen in order to be as similar as possible to real use case environments (i.e., big rooms, halls, corridors), except for crowded scenarios.
As highlighted in experiments reported in Figure 15, the presence of crowd can introduce signal degradation and attenuation; hence, a gateway installation procedure envisaging a denser positioning (i.e., one gateway for every 70-100 square meters) has to be preferred.

Conclusions
This work provides an overview about some solutions based on the adoption of wearable devices for accurate fall detection and effective gait features extraction and classification. From this outline, the opportunity to analyze gait data in daily living scenarios arises, moving from clinical trials towards more ubiquitous, cost-effective, and decentralized early detection processes.
A hardware and software innovative architecture has been proposed; it envisages a smart environment focused on fall detection and gait monitoring for seniors during indoor events, museum visits, and so on. The designed architecture aims to provide safe and prompt rescue in case of fall, thus extending the early detection of neuro-degenerative disorders in smart indoor environments. This is accomplished by processing gait data and storing them in a specific DB for third parties data-mining, through machine learning algorithms.
The main contribution resides in the study, design, and development of the architecture, which is capable of transposing, in a seamless way, the performance of a smart IoT device in challenging scenarios, such as crowded indoor environments. An added value is also given by the parallel execution of fall detection and gait features extraction, in order to support both pervasive monitoring and decentralization of disease diagnosis.
The system is based on a wearable smart device composed by an accelerometer, a gyroscope, a microcontroller unit and a BLE transmitter. A BLE advertising technique is adopted for a lightweight communication, so as to monitor a high number of devices in crowded indoor facilities. However, the edge-computing paradigm adopted by the system opens to the use of Long Range (LoRa) transmitters [46] and GPS location which can extend the coverage to outdoor/rural areas (e.g., for municipality monitoring solutions) where people density may be lower, in a more pervasive scenario.
The main limitation of this work is the absence of real experiments in a crowded indoor scenario, although electromagnetic effects of a multitude of people is known, so some precautions can be taken to mitigate such effects on the system performance. Such trials can be performed in future works, studying also scalability issues related to the contemporary presence of thousands of wearable devices in the same environment. To carry out these tests, specific agreements with event organizers are needed for the installation of the entire system. Moreover, informed consent must be administered to meet different country regulations, concerning privacy issues related to the user's gait monitoring.
As a further enhancement, the wearable device can be enriched with additional health sensors (e.g., temperature, pulse-oximeter, blood pressure, etc.) for the decentralization of other important detection processes, like chronic diseases or other pathologies.