Indoor Localization System Based on Bluetooth Low Energy for Museum Applications

: In the last few years, indoor localization has attracted researchers and commercial developers. Indeed, the availability of systems, techniques and algorithms for localization allows the improvement of existing communication applications and services by adding position information. Some examples can be found in the managing of people and / or robots for internal logistics in very large warehouses (e.g., Amazon warehouses, etc.). In this paper, we study and develop a system allowing the accurate indoor localization of people visiting a museum or any other cultural institution. We assume visitors are equipped with a Bluetooth Low Energy (BLE) device (commonly found in modern smartphones or in a small chipset), periodically transmitting packets, which are received by geolocalized BLE receivers inside the museum area. Collected packets are provided to the locator server to estimate the positions of the visitors inside the museum. The position estimation is based on a feed-forward neural network trained by a measurement campaign in the considered environment and on a non-linear least square algorithm. We also provide a strategy for deploying the BLE receivers in a given area. The performance results obtained from measurements show an achievable position estimate accuracy below 1 m.


Introduction
Accurate estimation and tracking of the positions of people, objects or animals enables the provisioning of several advanced services such as the automatic execution of task(s) triggered by events consisting for example of a person passing a specific position in the area, commercial or recreational applications requiring location information inside a specific area, etc. [1]. In the last few years, the possibility of realizing advanced communication applications and services supported by position information have favored and encouraged the development of systems for the indoor localization of people and objects. In parallel, the evolution of these systems has been constantly supported by the technological advancements of internet of things (IoT) [2] technologies specifically conceived for low-cost short-range radio transmission such as Bluetooth [3] and its variants and radio frequency identification (RFID) technologies [4].
The design of localization systems based on short range radio technologies is not a trivial task. In fact, radio signal propagation inside buildings is influenced by several factors, such as construction signal-to-noise ratio (SNR) of each received signal and can extract the identity of the BLE transmitter by retrieving the associated message. The measured RSSI and SNR and the corresponding BLE message are then passed to a central server in the museum. The locator entity in the server processes the received data and messages to extract the position of the visitor in the museum. The localization algorithm of each visitor is based on the minimization of an objective function including the pathloss measurements obtained from the associated RSSIs and SNRs. The optimal solution to the minimization problem corresponding to the estimated position of the visitor is obtained by applying a non-linear least square (NLS) algorithm. At the end of this paper, we also analyze the problem of the deployment of the BLE receiver in a given area. Results show that a BLE transmitter can be localized with an accuracy lower than 1 m (i.e., the Euclidean distance between the true and estimated position is lower than 1 m) when the BLE receiver is properly deployed in the area.
Due to difficulties in estimating the wireless channel by modeling its behavior in indoor environment through classical power law trends, we performed a measurement campaign in a typical museum space, used to train a neural network. This allowed us to avoid the fingerprinting of the entire area, which is time-consuming and loses accuracy in the next phase when people are present in the environment. Moreover, it allowed us to take into account the physical characteristics of the environment (e.g., materials, reflection, diffraction), which is usually difficult to model. After the neural network training, the BLE receiver can better estimate the distances based on the RSSI and SNR measurements collected during visitor movement around the artworks.
Here, we report the main contributions of this paper to the topic of localization in indoor environments: • The preparation phase (performed offline) is based on a non-invasive measurement campaign in the considered space where people are going to be localized. The offline phase in most papers can be long and costly (see below) [15,16]. In our case it consisted of collecting RSSI values between the receiver and the transmitter in a few positions in the area, with the aim of gaining knowledge of the propagation environment and the involved mechanisms (e.g., scattering and reflections); • Unlike some works in the literature (such as [17][18][19][20]; see Related Works section) where the distance estimation was expressed by evaluation of the radio frequency signal attenuation and its related pathloss model (i.e., model-based positioning), we introduced a neural network trained by the measurements collected in the preparation phase. This allowed us to overcome the problem of estimating the distance based on propagation distance and radio signal strength, which may give very complex results in indoor environments; • We analyzed different deployment strategies in the considered area by evaluating the positioning errors in terms of the deployed scenarios. Differently from [21], in this analysis we gained an indication of how many receivers should be deployed, and where; • Finally, unlike other methods proposed in the literature such as fingerprinting (such as in [22,23]), we performed an analysis where possible human obstruction could occur during the normal phase. This is important since other studies have failed in position estimation because their RSSI collection was done without any human presence, which means results are different when people obstruct the RF signal.
The paper is organized as follows. In Section 2, related works on this topic are discussed. In Section 3, the principal scheme of the system architecture is detailed. In Section 4, the testbed for the measurement campaign is described and the neural network adopted for the distance estimation is detailed. In Section 5, the localization procedure and the corresponding localization algorithm are explained. In Section 6, the performance results of the considered localization system are reported in terms of the achievable accuracy with the density of BLE receivers in the area installed by the museum operator. Finally, conclusions are drawn.

Related Works
Indoor positioning is a well-studied topic in the current literature [1,24]. The proposed localization systems have been based on different strategies/algorithms for deriving positioning information. Some of them have presented limitations in terms of deployed infrastructure, precise environmental characterization, and the costs of the equipment. As an example, positioning methods based on a pathloss fingerprint dataset of the area as in [22] require lengthy preparation for the collection of fingerprints. This can be difficult to achieve especially when the area under consideration is very large such as museum spaces, making the proposed system independent from the size of the environment. Moreover, the relationship between the RSSI and the estimated channel model is difficult to obtain due to multipath, reflections and scattering mechanisms occurring in the area.
Other systems have used the direction of the signal (angle of arrival, AoA) or time of arrival of the signal (time of arrival, ToA) [25] for the localization. For this purpose, the use of antenna arrays is mandatory, especially for AoA measurements. Furthermore, ToA adoption requires time synchronization between the transmitting and receiving devices. This leads to an increase in the complexity and costs of the localization system. In addition, non-line of sight (NLoS) propagation conditions lead to a worsening of accuracy for the position estimate. Other positioning systems have been based on recursive optimization procedures for the position estimate [26] leading to a delay in the calculation.
BLE-based localization systems were illustrated in [27]. Unlike the system presented in this paper, they did not consider in detail the important aspect concerning the transfer of information from the BLE receivers to the centralized server. In the system presented in the present paper the asynchronous protocol Message Queue Telemetry Transport (MQTT) [28] was used. It allows message distribution to be performed very quickly, while minimizing traffic over the network. This results in more efficient communication, reduced response times and allows improvement of the tracking feature. Furthermore, the proposed system allows the estimation of the distance between the receiver and transmitter based on the neural network and the direct application of the localization algorithm, making the whole process simpler and faster. Finally, the adoption of BLE technology allows the localization or tracking of not only high performing devices such as smartphones but also low-cost IoT devices, maintaining reliability and accuracy without requiring particular hardware components or specific and costly synchronization functionalities.
In [23], the authors proposed using recurrent neural networks for wireless fidelity (Wi-Fi) fingerprinting based on RSSI for indoor localization. Their effort was limited to corridors and the neural network estimation was not accurate in the presence of other people, due to the fact that fingerprinting is collected without people. To reduce the time-consuming procedure of performing fingerprinting in an area, the authors in [29] proposed training a long short-term memory recurrent neural network but limiting the algorithm to the considered trajectories of people. In [30] the authors proposed a technique to detect the presence of a human body blocking the RSSI reception in a dynamic environment. The authors applied an artificial neural network for the compensation of RSSI values. In contrast, in [30], we considered not just one single person obstructing the RSSI, but an entire group of visitors. In [17] the authors presented a localization method based on the classical power-law behavior of RSSI. This paper did not consider the effect of obstacles in the relationship between RSSI and distance. In addition, this method was realized for an outdoor environment; [18] is affected by the same limitation. The method proposed in the paper did not estimate the real channel function of the environment and it was tailored to a specific environment. The parameters used for distance estimation were correlated with a specific room and are not easy to generalize. The method proposed in [15] presented two limitations: the training procedure is very long, and it is not clear how the localization method would perform in the presence of other people in the same room. The method proposed in [31] needed the localized person to be equipped with a smartphone since their algorithm exploited the fusion of sensors embedded in the mobile device. This limits the applicability of the localization due to vendor-dependent sensors. The work proposed in [32] seems to be very interesting but the authors did Electronics 2020, 9, 1055 5 of 20 not provide information in terms of accuracy (the error in meters was not presented). The localization technique presented in [21], similarly to [31], required the use of Android smartphones or tablets. Another limitation of this work is that the authors did not analyze any deployment strategy for the BLE access points. In [19] the authors presented a localization procedure based on the estimation of the channel model by classical power laws. Such a technique provides accuracy in the order of 5-20 m for technologies such as Wi-Fi at 2.4 GHz and at 5 GHz, and BLE at 2.4 GHz. This level of accuracy and that in [33] are not compatible with a museum scenario. The approach proposed in [16] implies a very complex and slow training phase. It requires 5000 samples every 4.5 min with the necessity of many receiving BLE devices. In addition, such a system has been tested on a narrow corridor characterized by reduced position uncertainty. In addition, the authors did not analyze performance in the presence of more than one person in the environment. Finally, the work proposed in [20] was based on the power law and the authors did not analyze the performance in the presence of human obstacles. Figure 1 reports the environment of the proposed BLE-based localization system and its possible deployment in a museum [34].

System Architecture
Electronics 2020, 9,1055 5 of 20 presented). The localization technique presented in [21], similarly to [31], required the use of Android smartphones or tablets. Another limitation of this work is that the authors did not analyze any deployment strategy for the BLE access points. In [19] the authors presented a localization procedure based on the estimation of the channel model by classical power laws. Such a technique provides accuracy in the order of 5-20 m for technologies such as Wi-Fi at 2.4 GHz and at 5 GHz, and BLE at 2.4 GHz. This level of accuracy and that in [33] are not compatible with a museum scenario. The approach proposed in [16] implies a very complex and slow training phase. It requires 5000 samples every 4.5 min with the necessity of many receiving BLE devices. In addition, such a system has been tested on a narrow corridor characterized by reduced position uncertainty. In addition, the authors did not analyze performance in the presence of more than one person in the environment. Finally, the work proposed in [20] was based on the power law and the authors did not analyze the performance in the presence of human obstacles. Figure 1 reports the environment of the proposed BLE-based localization system and its possible deployment in a museum [34]. The architecture of the proposed system highlighting its components is depicted in Figure 2. The architecture of the proposed system highlighting its components is depicted in Figure 2. We assume that the object/person to be localized and (possibly) tracked is equipped with a BLE device. This transmits BLE frames at regular time intervals. A number of BLE receivers are (intelligently) installed by the museum authority in the visiting area and they measure the RSSI and the SNR of the received signals and extract the associated BLE messages. Depending on the specific position of the BLE receiver, the RSSI and the identity (ID) of the visitor in the BLE message are transmitted to a centralized server using Ethernet and/or Wi-Fi links.

System Architecture
In our practical implementation, each BLE receiver is equipped with a MQTT client, which provides the MQTT broker with the collected data. The broker forwards data to the central server, where they are first stored and then processed so to discard outliers. As shown in the following section, RSSI and SNR data can be used to estimate path loss and the visitor's position.
The BLE transmitter typically operates in the advertising mode to transmit information. Figure  3 reports the BLE advertising Protocol Data Unit (PDU) indicated in the Bluetooth standard [35]. In the same figure we also indicate the packet formats corresponding to three popular advertising applications currently available in the market [36] i.e., Apple's iBeacon, the AltBeacon open format from Radius Networks, and Google's Eddystone. In this work, we have considered the Eddystone UID format. This consists of a unique code, which can be used to identify visitors or specific categories of objects/people. The Eddystone format defines four types of frames: unique ID (UID) frames, ephemeral ID (EID) frames, URL frames, and telemetry (TLM) frames.  We assume that the object/person to be localized and (possibly) tracked is equipped with a BLE device. This transmits BLE frames at regular time intervals. A number of BLE receivers are (intelligently) installed by the museum authority in the visiting area and they measure the RSSI and the SNR of the received signals and extract the associated BLE messages. Depending on the specific position of the BLE receiver, the RSSI and the identity (ID) of the visitor in the BLE message are transmitted to a centralized server using Ethernet and/or Wi-Fi links.
In our practical implementation, each BLE receiver is equipped with a MQTT client, which provides the MQTT broker with the collected data. The broker forwards data to the central server, where they are first stored and then processed so to discard outliers. As shown in the following section, RSSI and SNR data can be used to estimate path loss and the visitor's position.
The BLE transmitter typically operates in the advertising mode to transmit information. Figure  In the same figure we also indicate the packet formats corresponding to three popular advertising applications currently available in the market [36] i.e., Apple's iBeacon, the AltBeacon open format from Radius Networks, and Google's Eddystone. In this work, we have considered the Eddystone UID format. This consists of a unique code, which can be used to identify visitors or specific categories of objects/people. The Eddystone format defines four types of frames: unique ID (UID) frames, ephemeral ID (EID) frames, URL frames, and telemetry (TLM) frames. We assume that the object/person to be localized and (possibly) tracked is equipped with a BLE device. This transmits BLE frames at regular time intervals. A number of BLE receivers are (intelligently) installed by the museum authority in the visiting area and they measure the RSSI and the SNR of the received signals and extract the associated BLE messages. Depending on the specific position of the BLE receiver, the RSSI and the identity (ID) of the visitor in the BLE message are transmitted to a centralized server using Ethernet and/or Wi-Fi links.
In our practical implementation, each BLE receiver is equipped with a MQTT client, which provides the MQTT broker with the collected data. The broker forwards data to the central server, where they are first stored and then processed so to discard outliers. As shown in the following section, RSSI and SNR data can be used to estimate path loss and the visitor's position.
The BLE transmitter typically operates in the advertising mode to transmit information. Figure  3 reports the BLE advertising Protocol Data Unit (PDU) indicated in the Bluetooth standard [35]. In the same figure we also indicate the packet formats corresponding to three popular advertising applications currently available in the market [36] i.e., Apple's iBeacon, the AltBeacon open format from Radius Networks, and Google's Eddystone. In this work, we have considered the Eddystone UID format. This consists of a unique code, which can be used to identify visitors or specific categories of objects/people. The Eddystone format defines four types of frames: unique ID (UID) frames, ephemeral ID (EID) frames, URL frames, and telemetry (TLM) frames.

Propagation Model Estimation in the Considered Environment
In order to evaluate the effectiveness of the proposed system in providing the localization service in a museum, we developed a testbed to characterize the antenna behavior in the considered environment and to perform a measurement campaign for the training of the neural network. In particular, we considered receivers equipped with two different types of antennas: an integrated antenna and an external antenna with a gain of 5 dBi. In this section, we describe the testbed setup, the radiation pattern of the two receiving antennas, and the neural network definition.

Testbed Setup
In the testbed we used two devices: the ESP32-WROOM-32D equipped with an integrated antenna and the ESP32-WROOM-32U equipped with an external antenna of 5 dB gain [37,38]. ESP32-WROOM-32D and ESP32-WROOM-32U are generic Wi-Fi + Bluetooth + BLE microcontroller modules that target a wide variety of applications, ranging from low-power sensor networks to the most demanding tasks, such as voice encoding, music streaming and MP3 decoding. Thanks to the dual mode, each receiver is allowed to receive packets on the BLE link and transmit them over the Wi-Fi link, reported in Figure 4a.

Propagation Model Estimation in the Considered Environment
In order to evaluate the effectiveness of the proposed system in providing the localization service in a museum, we developed a testbed to characterize the antenna behavior in the considered environment and to perform a measurement campaign for the training of the neural network. In particular, we considered receivers equipped with two different types of antennas: an integrated antenna and an external antenna with a gain of 5 dBi. In this section, we describe the testbed setup, the radiation pattern of the two receiving antennas, and the neural network definition.

Testbed Setup
In the testbed we used two devices: the ESP32-WROOM-32D equipped with an integrated antenna and the ESP32-WROOM-32U equipped with an external antenna of 5 dB gain [37,38]. ESP32-WROOM-32D and ESP32-WROOM-32U are generic Wi-Fi + Bluetooth + BLE microcontroller modules that target a wide variety of applications, ranging from low-power sensor networks to the most demanding tasks, such as voice encoding, music streaming and MP3 decoding. Thanks to the dual mode, each receiver is allowed to receive packets on the BLE link and transmit them over the Wi-Fi link, reported in Figure 4a.  The transmitter beacon was a "BlueUp mini", which is Google-certified and compliant with the BLE standard, reported in Figure 4b. It is very small in size (40 mm × 40 mm × 15 mm) and it is equipped with an nRF51822 Nordic chip. The management software allows the definition of different configurations such as transmission interval, transmission power, and frame format. The battery has a long life (from 6 months to 5 years). For the testbed we adopted the following setup: Eddystone frame UID format, a transmission time interval of 500 ms, and a transmission power (TxPower) of -4 dBm. The packet contained the information necessary to measure the RSSI.
Both receivers were programmed to acquire the advertising packets via BLE transmitted by enabled beacons. For the transmission from the receivers to the central server we used the MQTT protocol [28] on the Wi-Fi link. MQTT is a simple and light communication protocol based on the publish/subscribe paradigm; it is asynchronous and therefore suitable for data transmission between IoT devices. The broker receives data in JavaScript Object Notation (JSON) format.
The data were stored in a relational SQL Server database, which simplified the analysis and processing operations on the received RSSI values.
In Figure 5 we report the setup of the testbed used to characterize the antenna of the two receivers ( Figure 5a) and to perform the measurement campaign (Figure 5b). The transmitter beacon was a "BlueUp mini", which is Google-certified and compliant with the BLE standard, reported in Figure 4b. It is very small in size (40 mm × 40 mm × 15 mm) and it is equipped with an nRF51822 Nordic chip. The management software allows the definition of different configurations such as transmission interval, transmission power, and frame format. The battery has a long life (from 6 months to 5 years). For the testbed we adopted the following setup: Eddystone frame UID format, a transmission time interval of 500 ms, and a transmission power (TxPower) of -4 dBm. The packet contained the information necessary to measure the RSSI.
Both receivers were programmed to acquire the advertising packets via BLE transmitted by enabled beacons. For the transmission from the receivers to the central server we used the MQTT protocol [28] on the Wi-Fi link. MQTT is a simple and light communication protocol based on the publish/subscribe paradigm; it is asynchronous and therefore suitable for data transmission between IoT devices. The broker receives data in JavaScript Object Notation (JSON) format.
The data were stored in a relational SQL Server database, which simplified the analysis and processing operations on the received RSSI values.
In Figure 5 we report the setup of the testbed used to characterize the antenna of the two receivers ( Figure 5a) and to perform the measurement campaign (Figure 5b).

Measurement Campaign
In order to characterize the radiation pattern of the receiving antennas and to collect proper indications for training the neural network, we placed the transmitter in the center of the considered environment. Then, we positioned the receivers (one a at time) in four directions (namely north, west, south, and east with respect to the transmitter) and at different distances from the transmitter. The positions of the receivers and the transmitter are showed in Figure 6. Each measurement was based on the transmission of 150 UID Eddystone frames. For each received frame, the RSSI value was stored in the database. These values were raw and needed to be processed to limit the fluctuations accounting for the variability of the wireless channel. This filtering process was based on two steps. First, the values were averaged. Then, values exceeding the average plus/minus the standard deviation were identified and discarded, since they are considered outliers [39]. Other filtering strategies can be considered [40]. A measurement sample set is reported in Figure  7a, while Figure 7b reports its probability density function (PDF).

Measurement Campaign
In order to characterize the radiation pattern of the receiving antennas and to collect proper indications for training the neural network, we placed the transmitter in the center of the considered environment. Then, we positioned the receivers (one a at time) in four directions (namely north, west, south, and east with respect to the transmitter) and at different distances from the transmitter. The positions of the receivers and the transmitter are showed in Figure 6.

Measurement Campaign
In order to characterize the radiation pattern of the receiving antennas and to collect proper indications for training the neural network, we placed the transmitter in the center of the considered environment. Then, we positioned the receivers (one a at time) in four directions (namely north, west, south, and east with respect to the transmitter) and at different distances from the transmitter. The positions of the receivers and the transmitter are showed in Figure 6. Each measurement was based on the transmission of 150 UID Eddystone frames. For each received frame, the RSSI value was stored in the database. These values were raw and needed to be processed to limit the fluctuations accounting for the variability of the wireless channel. This filtering process was based on two steps. First, the values were averaged. Then, values exceeding the average plus/minus the standard deviation were identified and discarded, since they are considered outliers [39]. Other filtering strategies can be considered [40]. A measurement sample set is reported in Figure  7a, while Figure 7b reports its probability density function (PDF). Each measurement was based on the transmission of 150 UID Eddystone frames. For each received frame, the RSSI value was stored in the database. These values were raw and needed to be processed to limit the fluctuations accounting for the variability of the wireless channel. This filtering process was based on two steps. First, the values were averaged. Then, values exceeding the average plus/minus the standard deviation were identified and discarded, since they are considered outliers [39]. Other filtering strategies can be considered [40]. A measurement sample set is reported in Figure 7a, while Figure 7b reports its probability density function (PDF).

Radiation Diagram Evaluation
The procedure for the measurement campaign to evaluate the radiation pattern of the two considered antennas is reported as follows: 1. The receiver was placed at a distance of 1 m north with respect to the transmitter. 2. 150 RSSI values were acquired at 0°, 90°, 180°, and 270° by rotating the receiver on its position in the directions north-east-south-west. Thus, a total of 600 values were acquired in the north direction. 3. Point 2 was repeated in the east, south, and west directions with respect to the transmitter.
Then, at a distance of 1 m, 2400 RSSI values were acquired in total. Points (1) to (3) were repeated at distances from 2 m to 5 m. After the acquisition phase, the values were then filtered, thus excluding outliers, i.e., values greater than the average (at a given distance and for a given direction) plus the standard deviation and lower than the average minus the standard deviation in the considered position.
The results of the receiver with the internal antenna are reported in Figure 8a,b at distances of 2 and 5 m, respectively.

Radiation Diagram Evaluation
The procedure for the measurement campaign to evaluate the radiation pattern of the two considered antennas is reported as follows: 1.
The receiver was placed at a distance of 1 m north with respect to the transmitter. 2.
150 RSSI values were acquired at 0 • , 90 • , 180 • , and 270 • by rotating the receiver on its position in the directions north-east-south-west. Thus, a total of 600 values were acquired in the north direction.

3.
Point 2 was repeated in the east, south, and west directions with respect to the transmitter.
Then, at a distance of 1 m, 2400 RSSI values were acquired in total. Points (1) to (3) were repeated at distances from 2 m to 5 m. After the acquisition phase, the values were then filtered, thus excluding outliers, i.e., values greater than the average (at a given distance and for a given direction) plus the standard deviation and lower than the average minus the standard deviation in the considered position.
The results of the receiver with the internal antenna are reported in Figure 8a,b at distances of 2 and 5 m, respectively.

Radiation Diagram Evaluation
The procedure for the measurement campaign to evaluate the radiation pattern of the two considered antennas is reported as follows: 1. The receiver was placed at a distance of 1 m north with respect to the transmitter. 2. 150 RSSI values were acquired at 0°, 90°, 180°, and 270° by rotating the receiver on its position in the directions north-east-south-west. Thus, a total of 600 values were acquired in the north direction. 3. Point 2 was repeated in the east, south, and west directions with respect to the transmitter.
Then, at a distance of 1 m, 2400 RSSI values were acquired in total. Points (1) to (3) were repeated at distances from 2 m to 5 m. After the acquisition phase, the values were then filtered, thus excluding outliers, i.e., values greater than the average (at a given distance and for a given direction) plus the standard deviation and lower than the average minus the standard deviation in the considered position.
The results of the receiver with the internal antenna are reported in Figure 8a,b at distances of 2 and 5 m, respectively.     With reference to the radiation diagram, identified for both receivers, it can be noted that the receiver with integrated antenna, under a certain distance, maintained omnidirectional radiation, while the receiver with external antenna had a higher gain with a narrower radiation beam offering excellent coverage with beam width of +60° to −60° in the north/south direction.
As an example, in Figure 10 we report the results of measures ranging from 1 m to 3 m. The correlation between the average received RSSI and the measured direction can be highlighted. In this case, we used the receiver with the internal antenna.

Neural Network for Distance Estimation
In the following, we report the theoretical equations aiming to describe the physical behavior of the communication system between the transmitter and receivers. In order to estimate the distance between them, we express pathloss as a function of the measured RSSI and SNR, whose Equations are reported in (1) and (2), respectively: where N is the received noise power of the receiver and PR is the received power. Its expression is reported in (3): With reference to the radiation diagram, identified for both receivers, it can be noted that the receiver with integrated antenna, under a certain distance, maintained omnidirectional radiation, while the receiver with external antenna had a higher gain with a narrower radiation beam offering excellent coverage with beam width of +60 • to −60 • in the north/south direction.
As an example, in Figure 10 we report the results of measures ranging from 1 m to 3 m. The correlation between the average received RSSI and the measured direction can be highlighted. In this case, we used the receiver with the internal antenna. With reference to the radiation diagram, identified for both receivers, it can be noted that the receiver with integrated antenna, under a certain distance, maintained omnidirectional radiation, while the receiver with external antenna had a higher gain with a narrower radiation beam offering excellent coverage with beam width of +60° to −60° in the north/south direction.
As an example, in Figure 10 we report the results of measures ranging from 1 m to 3 m. The correlation between the average received RSSI and the measured direction can be highlighted. In this case, we used the receiver with the internal antenna.

Neural Network for Distance Estimation
In the following, we report the theoretical equations aiming to describe the physical behavior of the communication system between the transmitter and receivers. In order to estimate the distance between them, we express pathloss as a function of the measured RSSI and SNR, whose Equations are reported in (1) and (2), respectively: where N is the received noise power of the receiver and PR is the received power. Its expression is reported in (3)

Neural Network for Distance Estimation
In the following, we report the theoretical equations aiming to describe the physical behavior of the communication system between the transmitter and receivers. In order to estimate the distance between them, we express pathloss as a function of the measured RSSI and SNR, whose Equations are reported in (1) and (2), respectively: where N is the received noise power of the receiver and P R is the received power. Its expression is reported in (3): Electronics 2020, 9, 1055 11 of 20 where P T is the transmitting power, and G T and G R are the gain of the transmitter and receiver antennas, respectively. By evaluating N in (2) and substituting it into (1), after some algebra we can explicit the pathloss L(d): Due to the very short distances between the BLE transmitter and the receivers in the museum we can assume that RSSI is equal to the received power, i.e., SNR is high, and that noise power is negligible.
The modeling of the pathloss as a function of the distance between the transmitter and the receiver is difficult to obtain even when a massive measurement campaign is provided. This is due to the fact that the signal behavior follows reflection, diffraction and scattering mechanisms, especially in an indoor environment. Moreover, a complete campaign should be performed extensively in each environment where the localization system is deployed. To overcome the difficulties in environment characterization, we performed a relatively fast measurement campaign in the museum spaces. As explained below, this is different from performing a very time-consuming measurement campaign in the whole museum (or in the generic area where the localization service is provided). Our measurements are based on a limited test, which are then used to train the neural network, with the aim of characterizing the environment where the localization system is deployed.
We performed measurements according to the scheme reported in Figure 11. Starting from the reference distance d 0 equal to 1 m, we collected frames at 17 points. The first 6 points were spaced by 0.5 m, while the rest of the points were at a distance of 1 m from each other. As previously, we collected 150 RSSI values for each distance. For each distance, we rotated the receiver in four directions: north, west, south and east, with respect to the transmitter. Again, in this case, outliers were discarded.
Electronics 2020, 9, 1055 11 of 20 where PT is the transmitting power, and GT and GR are the gain of the transmitter and receiver antennas, respectively. By evaluating N in (2) and substituting it into (1), after some algebra we can explicit the pathloss L(d): Due to the very short distances between the BLE transmitter and the receivers in the museum we can assume that RSSI is equal to the received power, i.e., SNR is high, and that noise power is negligible.
The modeling of the pathloss as a function of the distance between the transmitter and the receiver is difficult to obtain even when a massive measurement campaign is provided. This is due to the fact that the signal behavior follows reflection, diffraction and scattering mechanisms, especially in an indoor environment. Moreover, a complete campaign should be performed extensively in each environment where the localization system is deployed. To overcome the difficulties in environment characterization, we performed a relatively fast measurement campaign in the museum spaces. As explained below, this is different from performing a very time-consuming measurement campaign in the whole museum (or in the generic area where the localization service is provided). Our measurements are based on a limited test, which are then used to train the neural network, with the aim of characterizing the environment where the localization system is deployed.
We performed measurements according to the scheme reported in Figure 11. Starting from the reference distance d0 equal to 1 m, we collected frames at 17 points. The first 6 points were spaced by 0.5 m, while the rest of the points were at a distance of 1 m from each other. As previously, we collected 150 RSSI values for each distance. For each distance, we rotated the receiver in four directions: north, west, south and east, with respect to the transmitter. Again, in this case, outliers were discarded. For the fitting of the distance estimation function, we used a two-layer feed-forward neural network: one hidden layer and one output layer. The hidden layer was composed of ten neurons with a sigmoid activation function. The output layer consisted of a single neuron with a linear activation For the fitting of the distance estimation function, we used a two-layer feed-forward neural network: one hidden layer and one output layer. The hidden layer was composed of ten neurons with a sigmoid activation function. The output layer consisted of a single neuron with a linear activation Electronics 2020, 9,1055 12 of 20 function. The neural network was been trained with the scaled conjugate gradient backpropagation algorithm. The training of the neural network was performed by providing the RSSI received by the single beacon as the input vector and the distance between the transmitter and the beacon as a target vector. Both the training and the design of the neural network were performed in MATLAB. The resulting neural network was converted into the C++ language using the MATLAB coder, in order to be implemented in the receiver board. Figure 12 reports the output of the neural network for receivers with both external and internal antennas. In the same figure, RSSI measurements and their average are reported as a function of distance. Due to local propagation mechanisms (e.g., multipath, reflections, scattering, etc.) characterizing the environment, the relationship between RSSI and the distance between the transmitter and the receiver can be difficult to estimate and it is often far from the monotonic behavior of the typical power-law propagation models. The neural network tries to fit as much as possible with the behavior of the radio signal in the considered environment based on the RSSI measurements.
Electronics 2020, 9,1055 12 of 20 function. The neural network was been trained with the scaled conjugate gradient backpropagation algorithm. The training of the neural network was performed by providing the RSSI received by the single beacon as the input vector and the distance between the transmitter and the beacon as a target vector. Both the training and the design of the neural network were performed in MATLAB. The resulting neural network was converted into the C++ language using the MATLAB coder, in order to be implemented in the receiver board. Figure 12 reports the output of the neural network for receivers with both external and internal antennas. In the same figure, RSSI measurements and their average are reported as a function of distance. Due to local propagation mechanisms (e.g., multipath, reflections, scattering, etc.) characterizing the environment, the relationship between RSSI and the distance between the transmitter and the receiver can be difficult to estimate and it is often far from the monotonic behavior of the typical power-law propagation models. The neural network tries to fit as much as possible with the behavior of the radio signal in the considered environment based on the RSSI measurements.

Localization Procedure
In this section, we provide the description of the localization procedure proposed in this paper. It was based on the preliminary phase for the distance estimation in the considered environment and the characterization of the transmitter and receiver antennas. The procedure was based on the reception of three or more BLE receivers placed in the room to be monitored, i.e., where transmitters needed to be localized in the museum in order to provide a greater user experience to visitors as well as to improve the museum management. When the server is able to collect data from more than three receivers because the distance and the propagation conditions allow it, the localizer should select the best receivers for the localization. This is necessary since we observed that an increase in receivers introduces higher noise in the estimation phase.
The following reports the localization procedure: 1. The transmitter starts to transmit frames with the set transmission power and the set frequency. This value is fixed (and known by the localizer) in the environment where the localization service is provided. 2. For each receiver in the room that receives frames (i.e., the distance between the transmitter and the receiver is such that the SNR is above the threshold), it collects NX = 5 frames (i.e., a measurement set). 3. For each measurement set, the receiver filters the data and the neural network estimates the distance between the transmitter and the receiver. 4. The receiver sends the pair of estimated distances to the server. 5. The localizer in the server sorts the array with the estimated distances and selects the three shortest distances.

Localization Procedure
In this section, we provide the description of the localization procedure proposed in this paper. It was based on the preliminary phase for the distance estimation in the considered environment and the characterization of the transmitter and receiver antennas. The procedure was based on the reception of three or more BLE receivers placed in the room to be monitored, i.e., where transmitters needed to be localized in the museum in order to provide a greater user experience to visitors as well as to improve the museum management. When the server is able to collect data from more than three receivers because the distance and the propagation conditions allow it, the localizer should select the best receivers for the localization. This is necessary since we observed that an increase in receivers introduces higher noise in the estimation phase.
The following reports the localization procedure: 1.
The transmitter starts to transmit frames with the set transmission power and the set frequency. This value is fixed (and known by the localizer) in the environment where the localization service is provided.

2.
For each receiver in the room that receives frames (i.e., the distance between the transmitter and the receiver is such that the SNR is above the threshold), it collects N X = 5 frames (i.e., a measurement set).

3.
For each measurement set, the receiver filters the data and the neural network estimates the distance between the transmitter and the receiver.

4.
The receiver sends the pair of estimated distances to the server.

5.
The localizer in the server sorts the array with the estimated distances and selects the three shortest distances. 6.
The localizer applies the NLS algorithm to these distances and estimates the position of the transmitter.
The complete formulation of the NLS algorithm is in [41]. Figure 13 reports a flowchart of the localization procedure.
Electronics 2020, 9,1055 13 of 20 6. The localizer applies the NLS algorithm to these distances and estimates the position of the transmitter.
The complete formulation of the NLS algorithm is in [41]. Figure 13 reports a flowchart of the localization procedure.

Performance Evaluation of the Distance Estimator
In order to evaluate the position and the number of BLE receivers to be deployed in the considered area to be monitored, it is necessary to analyze the errors in real distance with respect to the estimated distance between the transmitter and the receiver evaluated according to the neural networks. In Figure 14, we report the distance error between the real position in Figure 11 and the neural network-estimated position. The error was less than 2 m for a distance of 9 m for receivers with both internal and external antennas. For higher distances the error increased to 4 m for the external antenna receiver and to 6 m for the internal antenna receiver. In the same figure, we also reported the distance error obtained using the theoretical pathloss model in (4) L(d) = 49 + 19.9 + Log10(d) where the parameters of the classical power-law behavior have been estimated according to the measurement campaign.

Performance Evaluation of the Distance Estimator
In order to evaluate the position and the number of BLE receivers to be deployed in the considered area to be monitored, it is necessary to analyze the errors in real distance with respect to the estimated distance between the transmitter and the receiver evaluated according to the neural networks. In Figure 14, we report the distance error between the real position in Figure 11 and the neural network-estimated position. The error was less than 2 m for a distance of 9 m for receivers with both internal and external antennas. For higher distances the error increased to 4 m for the external antenna receiver and to 6 m for the internal antenna receiver. In the same figure, we also reported the distance error obtained using the theoretical pathloss model in (4) L(d) = 49 + 19.9 + Log 10 (d) where the parameters of the classical power-law behavior have been estimated according to the measurement campaign.

Deployment of BLE Receivers and Accuracy Evaluation of the Localization Procedure
In this section we analyze the localization accuracy of the procedure. Furthermore, we also investigate the position and the number of BLE receivers to be deployed in the considered museum rooms. In Table 1, we described the scenarios involved in accuracy evaluation. In the experiment, we varied the number and position of the BLE receivers in the area. Figure 15 reports the position of the BLE receivers. All receivers were placed at a height of approximately 1.5 m from the ground.

Deployment of BLE Receivers and Accuracy Evaluation of the Localization Procedure
In this section we analyze the localization accuracy of the procedure. Furthermore, we also investigate the position and the number of BLE receivers to be deployed in the considered museum rooms. In Table 1, we described the scenarios involved in accuracy evaluation. In the experiment, we varied the number and position of the BLE receivers in the area. Figure 15 reports the position of the BLE receivers. All receivers were placed at a height of approximately 1.5 m from the ground. To evaluate the accuracy of the position procedure we selected eight possible positions (Xreal, Yreal) of the transmitter in the area reported in Table 2. The NLS algorithm solves non-linear problems given a number of receivers greater than or equal to three in known positions. It is therefore required that the array with the distance estimate is composed of at least three elements. Theoretically, if the distance array is composed of only three elements (no fewer), the trilateration algorithm provides even in this case a distance estimate, but with reduced accuracy.

Scenario 5 BLE receivers located in positions A
Two receivers with internal antenna (dashed) Two receivers with external antenna (solid) Scenario 6 BLE receivers located in positions B Two receivers with internal antenna (dashed) Two receivers with external antenna (solid) Scenario 7 BLE receivers located in positions C Five receivers with internal antenna (dashed) Four receivers with external antenna (solid) Figure 15. Positions of the BLE receivers in the scenarios considered for localization procedure. Figure 15. Positions of the BLE receivers in the scenarios considered for localization procedure.  Table 2 also reports the results of the position estimations from the localizer (Xestimated, Yestimated) for the considered deployment scenarios described in Table 1.
The average accuracy was between 2 and 3.6 m in cases where only four receivers were deployed in the museum room according to the strategies in Figure 15. In order to improve the accuracy of the position of the visitor in a room of the museum we increased the number of BLE receivers according to scenario 7. In the event, it provided a reduced estimation error of 84 cm. In this configuration, the external antenna receivers guaranteed, in accordance with the radiation diagram, good coverage in the north-south direction even beyond 4 m, while those with an integrated antenna compensated for the lack of coverage in the narrowest corners of the radiation beam, although with a limited range of action of approximately 4 m. Table 2 also reports the average error and its standard deviation for each considered scenario. Figure 16 reports the cumulative distribution function (CDF) of the errors in position estimation for the considered scenarios. It allows easy visualization of the non-overcome error for a given percentage in order to assess the reliability of the localization system in the scenarios. For example, in scenario 5 the localization system guaranteed an error lower than 4.35 m in 90% of the cases, while it guaranteed an error lower than 1.45 m in 90% of the cases in scenario 7. Due to the introduction of greater errors in cases of considering more than three receivers (i.e., the closest), Figure 17 reports the error in the position estimate when all receivers are considered in the NLS algorithm.
The results show that an increase in the considered receivers (and then in the estimated distances) provides greater errors in the position estimate. This means that the distance estimate for receivers far from the transmitter has high errors that reduce the accuracy of the procedure. As a final result, we considered the fact that in museums the one or two best receivers (according to the ordering obtained without humans in the room) can be obstructed by the presence of visitors. To take into account any possible human obstruction, we assumed the RSSI received by the obstructed receivers to be considered under the SNR threshold (worst case), thus not allowing the localizer to exploit its measurement sets. To evaluate these cases, we repeated the estimates by eliminating one or two distance estimates provided by the best receivers. In case of one obstructed receiver (i.e., 33%, since the NLS algorithm considers the best three estimates), we supposed eliminating one of the three best receivers and adding the fourth best receiver for the position estimate, according to the order in which they performed. We averaged this procedure for the three best receivers and for the fifteen transmitter positions reported in Table 2. We also considered the case of obstruction of two of the three best receivers corresponding to 66%. In this case, we needed to consider the fifth best receiver for the position algorithm. We considered scenario 7 and the results are reported in Table 3. In the obstructed cases, the error increased to about 1.6 m and 1.8 m. Due to the introduction of greater errors in cases of considering more than three receivers (i.e., the closest), Figure 17 reports the error in the position estimate when all receivers are considered in the NLS algorithm. Due to the introduction of greater errors in cases of considering more than three receivers (i.e., the closest), Figure 17 reports the error in the position estimate when all receivers are considered in the NLS algorithm.
The results show that an increase in the considered receivers (and then in the estimated distances) provides greater errors in the position estimate. This means that the distance estimate for receivers far from the transmitter has high errors that reduce the accuracy of the procedure. As a final result, we considered the fact that in museums the one or two best receivers (according to the ordering obtained without humans in the room) can be obstructed by the presence of visitors. To take into account any possible human obstruction, we assumed the RSSI received by the obstructed receivers to be considered under the SNR threshold (worst case), thus not allowing the localizer to exploit its measurement sets. To evaluate these cases, we repeated the estimates by eliminating one or two distance estimates provided by the best receivers. In case of one obstructed receiver (i.e., 33%, since the NLS algorithm considers the best three estimates), we supposed eliminating one of the three best receivers and adding the fourth best receiver for the position estimate, according to the order in which they performed. We averaged this procedure for the three best receivers and for the fifteen transmitter positions reported in Table 2. We also considered the case of obstruction of two of the three best receivers corresponding to 66%. In this case, we needed to consider the fifth best receiver for the position algorithm. We considered scenario 7 and the results are reported in Table 3. In the obstructed cases, the error increased to about 1.6 m and 1.8 m. The results show that an increase in the considered receivers (and then in the estimated distances) provides greater errors in the position estimate. This means that the distance estimate for receivers far from the transmitter has high errors that reduce the accuracy of the procedure.
As a final result, we considered the fact that in museums the one or two best receivers (according to the ordering obtained without humans in the room) can be obstructed by the presence of visitors. To take into account any possible human obstruction, we assumed the RSSI received by the obstructed receivers to be considered under the SNR threshold (worst case), thus not allowing the localizer to exploit its measurement sets. To evaluate these cases, we repeated the estimates by eliminating one or two distance estimates provided by the best receivers. In case of one obstructed receiver (i.e., 33%, since the NLS algorithm considers the best three estimates), we supposed eliminating one of the three best receivers and adding the fourth best receiver for the position estimate, according to the order in which they performed. We averaged this procedure for the three best receivers and for the fifteen transmitter positions reported in Table 2. We also considered the case of obstruction of two of the three best receivers corresponding to 66%. In this case, we needed to consider the fifth best receiver for the position algorithm. We considered scenario 7 and the results are reported in Table 3. In the obstructed cases, the error increased to about 1.6 m and 1.8 m. Table 3. Errors in position estimate when one (33%) or two (66%) obstructions of the best three receivers occur for scenario 7: average and standard deviation of the error for each scenario are in bold. In Figure 18 we report the CDF of the errors in position estimation for scenario 7 when human obstruction is considered. In both cases (33% and 66%), the localization system was able to guarantee an error lower than about 2.5 m in 90% of cases.
Electronics 2020, 9,1055 17 of 20 Table 3. Errors in position estimate when one (33%) or two (66%) obstructions of the best three receivers occur for scenario 7: average and standard deviation of the error for each scenario are in bold.