Localization module for missing child scenario in IoT safety domains

Lately, we observe an increase in the development of Internet of Things (IoT) systems. The interconnection of multiple devices offers improved solutions in many sectors. In the current paper, we describe the localization framework of a project that incorporates IoT technologies to face unwanted incidents in crowded spaces. The localization framework responds to the scenario of a missing child in crowded outdoor spaces and combines Received Signal Strength Indicator (RSSI), Bluetooth low energy tags and trilateration. The experimental results of trials performed in two outdoor spaces are also reported. This framework is currently being tested in the actual pilot premises.


I. INTRODUCTION
In the last years we have noticed a rise in the number of smart buildings, cities or environments in general. These smart environments exploit a number of Internet of Things (IoT) devices and applications in real life applications of various domains, like health, security and marketing. In the IoT applications of the security domain, a frequent task that needs to be solved is indoor or outdoor localization.
In this paper we analyze the localization framework of Desmos project. DESMOS is a framework for the interconnection of smart infrastructures, devices and applications that aims to increase security in crowded environment for citizens, especially for visitors and tourists. The platform requires the collaboration of people and devices. Applications, smart wearable devices, volunteers and visitors will be employed in the testing of the project's solutions. The pilot trials will take place in the smart city of Trikala, Greece, in two locations, a central square and a theme park, that were chosen because they attract a lot of visitors. There are three use case scenarios that refer to a) on time treatment of health incidents (MylosKarpa, CityKarpa), b) localization of missing children in the premises of Mylos Theme Park (MylosKidFinder) and c) real time reporting and handling of criminal and violent acts (MylosSense, CitySense) [4].
The localization framework is mostly relevant to the My-losKidFinder scenario. This scenario is approached with an RSSI-based outdoor localization solution. Staff of the theme park will be able to identify the location of children reported missing by their parents, inside the theme park. Parents will be given a smartband with a BLE tag as they enter the theme park. The child will wear the smart band and the supervising parents will install an application on their phones. In case a child goes missing, the parent will press an alarm button in the application that will send a notification to the working stuff, who have the respective version of the application installed [3].
The selection of Bluetooth Low Energy beacons for indoor and outdoor localization in the project, was based on their energy consumption and low cost, reasons that justify their availability in multiple devices [11]. In previous work, we used the smartbands with the attached BLE beacons, to collect data from indoor spaces and test several algorithms for the localization, using the fingerprint approach [5]. The data collected were also made publicly available. Here, we present data collected at outdoor spaces and present the results of the localization procedure that will also be used in the pilots.
The rest of the paper is organized as follows: Section 2 reviews relevant literature. In Section 3 we present the theoretical background of the framework, while Section 4 shows the experiments conducted. Section 5 outlines the final localization framework and the conclusions along with future goals are shown in Section 6.

II. RELATED WORK
There are two main algorithms utilizing RSSI to compute the distance between the target and the reader; trilateration and fingerprinting. Trilateration is based on the distance of a target node from multiple fixed nodes. Using at least three fixed nodes' distance it is possible to estimate the exact position of the target. Fingerprinting is based on a predefined map of RSSI values at certain positions. This method can provide a reasonable accuracy but has the downfalls of requiring training of the system and being very sensitive to environmental changes [12]. It is also restricted to a certain environment that the training has been performed and cannot be immediately applied in other cases. Therefore, our interest lies in the trilateration algorithm for position estimation.
In [6], the authors gathered multiple RSSI measurements in fixed distances in direct view and the presence of a wall obstacle using three SensorTags. Using the mean value of each SensorTag at each known distance, they fitted a second-order polynomial curve in the data of each tag. Using trilateration, they compared the polynomial model with the path loss model to convert measured RSSI values to a distance. Their proposed polynomial model showed more accurate results, mainly in greater distances. However, the unstable RSSI readings due to obstacles causing fading and multipathing are a major drop back.
In the same direction, the authors in [8] implement a fitted distance curve to perform the distance calculation. The calculated distance was smoothed using a median filter and an intelligent filter for moving target, considering the maximum speed a target can have. Although they found this method to offer better accuracy, the results were not favorable since they did not obtain accurate positions.
To mitigate RSSI fluctuations, the implementation of some filtering is a common method. Kalman Filtering (KF) is quite often chosen because its lightweight implementation allows real-time tracking. The authors in [9] introduced KF to improve position estimation accuracy. They developed an Android application that receives filtered RSSI data to accurately estimate the moving target's position. By applying the KF, the authors aimed to minimize the variance of the RSSI values, thus improving the position estimation accuracy. Nevertheless, their application is only able to determine the position of the user at room level, not providing their exact position.
A system using KF with an improved trilateration algorithm is proposed by [2]. Since the basic trilateration algorithm is based on an ideal scenario, the authors used a weighted trilateration method giving more weight to the node having the smallest distance to the target. By applying the KF and the improved trilateration algorithm, the authors achieved high accuracy results, especially in the small room scenario. Another research using KF with an improved trilateration method is [7]. Their proposed method is based on minimizing the error of the RSSI measurements covering all cases to estimate the most accurate position for the target. Although their results showed very high accuracy, they only tested their system in line-of-sight (LOS) cases.
Authors in [10] proposed a method for indoor localization of a mobile robot. Using a trilateration method that minimizes the fractional error and applying a particle filter they were able to achieve very low error. They reported that only the use of their improved trilateration algorithm was a huge improvement, compared to the classic trilateration algorithm. By utilizing the particle filter in the trilateration results, they were able to manage outliers, thus reducing the error even more. The algorithm was tested in an indoor environment, a part of which was filled with furniture. The presence of obstacles affected their algorithm's performance, but the mean error was still below 1m.

III. METHODS
RSSI is a technique that finds the distance between the transmitter and the receiver by measuring the signal strength on the receiver [11]. Theoretically, the signal strength should decrease as the transmitter moves further away from the receiver. In reality, this is not always the case, since RSSI is quite sensitive to noise, thus it requires filtering techniques to get more homogeneous measurements.
Kalman filtering is used to eliminate the noise and smooth the RSSI signals. RSSI values show high levels of discrepancy, however the method is available in many devices and this makes it preferable for such occasions. The noise in the RSSI values is present even in outdoor environments. The following Kalman filtering refers to static devices that transmit and receive the signal [1].
Assuming a static state, the transition matrix A k is set to an identity matrix, and since there is no control, the control matrix B k is set to zero. As the state is modeled directly, the observation matrix H k is also set to identity. Therefore, the transition and observation model can be turned down to: where w k and v k describe Gaussian noise. The prediction step of the Kalman Filter is then: where R k is the process noise which is set to a small value (0.008). The Kalman gain is computed as: Q k is the measurement noise which is set to the variance of the measurements. The final update is: To demonstrate the effectiveness of Kalman Filter, we can observe the results of its application over a sample of the raw RSSI data from mobile 1 (Mob1) at CERTH premises in Figure 1. The Kalman filter removes most of the noise of the measurement, but, since it is a recursive method, it needs to throw back a bit of its responsiveness.
After filtering, we need to relate the RSSI to distance. This is achieved with the path-loss model (Eq. 8), a simple and direct method to transform the RSSI measurements to actual distance between the transmitter and the receiver [11].
In Eq. 8, n is the signal propagation exponent and C is the reference RSSI value at 1m distance. After the transformation of RSSI to distance, trilateration is used, in order to find the coordinates of the user in a two dimensional map. Trilateration needs three receiving nodes. Based on the distance of the transmitter from the three nodes and their locations, the position of the user in the map is determined [11].
Considering the position of the 3 receiving nodes A, B, C, is given by the coordinates (x 1 , y 1 ), (x 2 , y 2 ), (x 3 , y 3 ) respectively, whose distances from the transmitter are d 1 , d 2 , d 3 respectively, we can then calculate the coordinates of the point of interest, i.e. the transmitter (x, y) using the following equation: IV. EXPERIMENTAL RESULTS Data were collected prior to the initiation of the first pilot phase of the project, so as to test the devices and the algorithms that would produce the best results. As already mentioned in the introduction section, previous work of the team was focused on collecting RSSI measurements from indoor spaces and apply machine learning techniques for the prediction of the true distance [5]. For the real time application though, the machine learning approach was not considered suitable, since it requires more readings in order to provide good results. Taking into consideration the conditions of the pilot trials and the devices used, we resulted in a framework that combines Kalman filtering, the path loss model and trilateration as the final step for the localization.
The first approach was to test the more simple scenario, where both the child and the volunteer were steady. We utilized different mobile phones since three at least are needed for the trilateration and also because there will be a variety of different devices used by the personnel that will take part in the pilots. The use of multiple mobile phones also allows us to check the variability of the RSSI measurements and how it affects the RSSI transformation to distance. In the application at CERTH premises, the user carrying the smart band was moving at a fixed distance from the receiver.
In all of the following application examples, 100 RSSI values were collected at each distance point. The analysis was performed separately for each phone and the RSSI values were filtered using Kalman filtering technique. RSSI values collected at 1m were used for the calibration of each phone in order to get a reference RSSI value at that distance. The following results show the prediction of the actual distance with the help of the path-loss model.

A. Application at Mylos premises
These data were collected during the Mill of Elves festival, in an outdoor space with visitors. A total of 100 RSSI measurements were collected at each of 1,3,5 and 7 meters while both the transmitter and the receiver were static. Three mobile phones were used as the receiving devices. It is obvious from Table I that the transformations of RSSI to distance vary a lot between distances and mobiles. Although a deviation of 1 to 2 meters is always expected with the RSSI technique, in some cases, like the 7 meters distance of mobile 1 (mob1) this was exceeded.

B. Application at CERTH premises
The data were collected at an outdoor space in the Center for Research and Technology Hellas, using 3 mobile phones as receivers at distances of 1,2,3,4,5,6, and 7 meters between the smartband and the phones. The smartphones were static and the smart band was worn by a volunteer who was moving, preserving constant distance from the receivers. The number of measurements collected from each smartphone at each distance was 100. Using the same technique previously discussed, the results are shown in Table II. Our results demonstrate the inconsistency of the RSSI transformation to distance in different phones and distances. The error of the RSSI becomes greater with the distance, e.g. the mobile 3 (Mob3) in Table  II. The pilot phase of these trials is currently ongoing and there is still not an adequate amount of data to present here. However, the trials conducted in the actual premises and with the "child" moving, showed that this framework approached the real location successfully.

A. Collection of data
The smartbands used for collecting data, function as a BLE beacon. At intervals, packets are being broadcast from the smartband. The packets include smartband's name and MAC address. The broadcast packets are being scanned from a smart phone using Android. For each BLE device scanned, the Android can report the received signal strength in dBm. With the help of an application named "Everygate", we are able to collect this information (Fig. 2). The application scans for BLE beacons in range. Every 5 seconds, it pushes the scanned MAC addresses together with the RSSI in a MQTT Broker. A topic is created for each device that uses the application with several subtopics. The topic name consists of the device's IMEI. The subtopics include the scan results, various information about the device (operating system version, application version and device datetime) and device's location. In order to collect data for specific device and smartband, a script has been developed. The script uses a single-level wildcard in the IMEI topic to subscribe to topics containing only the needed information (i.e., the results from the BLE scan and the device's location). As such, the script receives information from all the devices publishing to the broker about their BLE scan results and their location. The data from the devices that are not used during the data collection are discarded through a white-list filter in the script. Specifically, a list of the IMEI of the devices that are used in the data collection is provided to the script. In addition, the smartband's MAC address is being provided in order to discard all other BLE devices that may be present during the data collection process. Finally, the total amount of required results is given. By knowing the total amount and the number of devices, the script calculates how many results are needed from each device. After the subscription to the topic, an object is created for each smart phone in the white list containing the IMEI, latitude, longitude, altitude and time of the device. The object is updated each time new data are pushed about that device. When a smart phone pushes scan results in the broker, the script first checks if the device is of interest. If it is, it iterates through the list of scan results and keeps only the information of the smartband that is its MAC address is being provided. Then, it creates a new record object consisting of the smart phone information, smartband's MAC address, RSSI and the time that the scan was performed. Finally, it appends the record in a list. When the desired number of data has been collected, the script creates a CSV file. The first row of the file contains the label for the data (IMEI, Latitude, Longitude, Altitude, Device Time, RSSI, MAC, Scan time) with the following rows containing the information from the record list.

B. RSSI to distance
Different mobile phones will be used to collect the RSSI signals from the wearable sensors, thus this will cause additional noise to the measurements that will be obtained. It is important to calibrate each mobile phone, before proceeding with the transformation of RSSI values to actual distance. During the calibration phase, the receiver node and the BLE tag are placed at a fixed distance, in particular 1 meter, and 100 measurements are collected. The average RSSI value at the fixed distance of 1 meter is needed for the RSSI to distance equation. After the calibration phase, the new RSSI signals collected, will be used as input to the path loss model (Eq.8), to get the actual distance.
RSSI measurements are known to show discrepancies even at the same distance. To eliminate this issue, the Kalman filter technique was applied, to obtain more coherent measurements. In the "LostChild" scenario, the transmitter, which is the child, is moving. The Kalman filtering technique applied, refers to a steady transmitter. However, it can be used with the moving transmitter also, as long as we update frequently [1]. One more reason that allows the use of the particular filtering technique is the transmission frequency of the RSSI signals, which is 1 signal per 5 seconds. The detailed steps of the transformation of RSSI to distance, as applied in the experiments of the realtime localization, are described below: 1) Collect 100 RSSI values at 1 meter distance from each mobile device, that will participate in the pilot phases. Apply Kalman filtering to eliminate the noise and then compute the average RSSI value of each device. 2) Apply the Kalman filtering to the new RSSI values and then apply path-loss equation (Eq. 8) to get the real distances. For the near-real time application, we select the three last obtained values to apply the filtering and get the distances. The averaged value of the three calculated distances will afterwards be used in the trilateration algorithm.

C. Trilateration
In the context of the MylosKidFinder use case, people working in the theme park have an application installed in their mobile devices that a) periodically sends their own location to the system (i.e. latitude and longitude) and b) receives the RSSI signals of the wearable devices that are used by the children. The localization component of the system then analyzes those RSSI values using the aforementioned techniques and transforms them to distance. Given the position of the 3 most recent observers of a given wearable device with known coordinates (x 1 , y 1 ), (x 2 , y 2 ), (x 3 , y 3 ) and known distances from the point of interest (i.e. lost child), we can then calculate the coordinates of the point of interest (x, y) using the Eq 9. The distances between the child with the wearable device and the mobile phones are calculated from the previous steps.

VI. CONCLUSION
This paper presents the first version of the localization framework of Desmos project. The project used low cost devices with integrated BLE tags in combination with smartphones and custom applications, in order to locate a missing child in outdoor spaces. RSSI technique was preferred due to its availability in many devices. The same holds for the BLE beacons that are cost effective, consume low energy and can be found integrated in affordable devices that can be worn by children. The trials conducted revealed that the proposed framework performed adequately. However, the technologies used, impose some limitations, such as the extent of distance they can cover and the transmission frequency of the RSSI values. Thus the framework is suitable for limited sized spaces. In the project, this issue is mitigated by the spread of numerous workers in the pilot premises, thus there will always be three workers in the range of the missing child, that will be able to locate it.
Issues we had to deal with during the trials, were the GPS range in some outdoor spaces and the slow response of some mobile phones. Future work includes the evaluation of the existing framework after the completion of the first pilot phase and the possible improvement of the algorithms so that they incorporate movement more successfully.