Smartphone-Based Indoor Tracking in Multiple-Floor Scenarios

With the rapid development of location-based services (LBSs), efficient and mobile-friendly localization algorithms should be designed for users to deliver a reliable LBS. In this paper, we present an algorithm with the corresponding smartphone app that enables users to calculate their locations based on representative infrastructures, such as nearby Wi-Fi access points and Bluetooth low energy (BLE) beacons subject to low-cost, rapid system deployment, and competitive location accuracy. Working under indoor multiple-floor scenarios, our app has three prominent features for estimating user locations. First, we establish a feature identifier to detect the current floor and the feasible area in which the user may walk. Second, owing to the structures of the indoor environment and the presence of different obstacles, the unpredictable variation of the received signal strength (RSS) in indoor environments is considered in the RSS-distance relationship to provide accurate location estimates. Third, with the prevalence of smartphones, we extract smartphone-inertial measurement units to learn users’ behavior preferences, while collecting reference signals (e.g., Wi-Fi/BLE readings) along the pathway and input to the tracking algorithm. Then, the user’s current location is displayed on the app. With this solution, we can provide an accurate location estimate with relatively low computational complexity regarding mobile device capability, while reducing labor costs from traditional fingerprint deployments. Finally, we test our tracking app in real-time multiple floor scenarios and evaluate the collected tracking data. Experimental results show that our proposed scheme achieves an average localization accuracy of more than 80% within a 2-m error bound in multiple-floor scenarios, while all areas (i.e., corridors, rooms, and stairs) were successfully identified.


I. INTRODUCTION
Recently, the design of efficient and effortless localization algorithms is essential for mobile users when tracking their locations in indoor environments. Although the global positioning system (GPS) works very well in outdoor environments, it has high localization errors in indoor environments because GPS signals do not pass through walls and obstacles in buildings. To provide a reliable solution in indoor environments, many indoor technologies have been developed, including Wi-Fi, Bluetooth, and radio frequency identification (RFID). Hence, the task of the localization problem is to extract location information based on the relevant signals according to the given infrastructure installed in indoor buildings [1]- [4]. With the wide range of mobile wireless systems, the aim of indoor localization tasks is to perform real-time and accurate object location using the current infrastructure. In indoor environments, Wi-Fi access points (APs) have become more prevalent because they provide Internet access and other location-based services (LBSs) on mobile devices (e.g., laptops and smartphones). Thus, Wi-Fi has become more popular for indoor tracking, while modern smartphones are able to track the direction and distance traveled [1]- [4]. As a result, the smartphone-based Wi-Fi and pedestrian dead reckoning (PDR) hybrid scheme is often integrated for selftracking purposes. However, according to [5], Wi-Fi-based localization on the iPhones is currently very difficult because it is not possible to extract Wi-Fi network information on iOS. Moreover, Wi-Fi-based ranging is inaccurate and produces large localization errors when tracking. Consequently, to upgrade the Wi-Fi-based localization on smartphones, a new dimension that considers wireless signals is required.
Over short distances, Bluetooth low energy (BLE) enables numerous emerging applications that are associated with the Internet of things (IoT), such as asset tracking, home automation, and smart factories. BLE beacons are typically small, inexpensive, and power-efficient. Each BLE beacon can be deployed either as a stand-alone or in combination with Wi-Fi as an AP to cover the area of interest (AoI) [5]. Objects can be tracked indoors using BLE beacons, mobile devices (e.g., smartphones), or BLE tags. Depending on the target application and budget, object tracking can be automatic (i.e., no human participation is needed) or semi-automatic (i.e., people participating with smartphones). In our study, we focus on semi-automatic systems. Here, a smartphone carried by a user is treated as a Wi-Fi/BLE receiver and exploits the reference signals to determine its location, which is the current user's location. Typical BLE broadcast packages contain a universally unique identifier (UUID) and a received signal strength (RSS), which can be detected by smartphones. Owing to its limited accuracy, BLE-based tracking methods are often combined with other technologies such as Wi-Fi and PDR to support tracking.
Regarding the two-dimensional (2D) case, recent works [5]- [12] have adopted fusion or hybrid algorithms that combine Wi-Fi/BLE and PDR to achieve consistent tracking. Most experimental activities take place on a single floor, such as a research lab [10], [11], complex areas consisting of office rooms and long corridors [5], or large-scale areas [12]. Conventional BLE scanners often measure either the presence status (i.e., the presence or absence of an object at a given location corresponding to a given proximity threshold) or report the distance to an object in centimeters. The observed received signal quality is inversely dependent on the distance between the smartphone and nearby reference nodes (RNs). Assuming that the RSS is known when the peripheral and central signals are 1m apart as A, a commonly used relationship between the distance and Bluetooth signal strength is given as in [17].
where R is the RSS at the current distance and n is the radio propagation constant. In terms of location estimation, three major techniques were used to obtain the location from the RSS readings. These include triangulation, proximity, and fingerprints [6]- [9]. The triangulation and proximity techniques are more low-cost and energy-efficient, and they enable real-time localization because they do not require a site survey and database maintenance for radio maps. Meanwhile, the fingerprinting techniques in [18]- [20] require a site survey over the AoI to build the finest fingerprint database, which may lead to increased costs, effort, and inflexibility to the indoor environment dynamics. Recently, a new fingerprinting-based localization was developed using channel state information (CSI) to construct fingerprint maps through CSI and deep learning [21]- [23], which frequently adapts to time and environmental changes. Nevertheless, the manual collection of the corresponding database is costly, not only for dataset construction but also for interpolated classification and analysis. There are few practical approaches for three-dimensional (3D) space, such as [24]- [28]. With respect to multiple-floor scenarios, a typical 3D localization problem consists of the following three basic steps: (i) current floor detection, (ii) localization in a single floor, and (iii) detecting the areas in which the user may climb or descend stairs. With problem (i), the RSS profile-based floor-detection method is commonly used. In particular, it has been shown that the RSS from nearby Wi-Fi APs on multiple floors can be used for floor detection [26]- [28]. A lightweight fingerprint database can be utilized from the collected RSS readings during the training phase. Problem (ii) can be efficiently solved using the aforementioned approaches in the 2D cases [5]- [12].
In our research, we focused on localizing a mobile user in multiple-floor scenarios. In particular, we aim to develop a localization system for estimating the smartphone location using existing Wi-Fi/BLE infrastructure and inertial sensors with less human effort. Our proposed localization app is specifically built on an iPhone and is fully functional along with information got in advance of products such as Wi-Fi APs and BLE beacons. This is an extended version of our work [5], in which we want to address the following three main questions: (i) How do we detect the current floor and the feasible area in which the user may belong? (ii) How do we localize and track the user's location at a certain floor area? (iii) How can a floor that currently contains a user be detected between two adjacent floors?
To answer the above questions, a user with a smartphone collects RSS readings when the device is stationary at a specified location. Then, we learn about the predictive relationship between the RSSs of the smartphone and some special points near reference positions to build a regression model with minimum least squares error. When a user enters the AoI, the floor level is determined based on the currently connected Wi-Fi AP/BLE beacon list. Once that floor has been determined, the user's location as he/she moves is updated according to the received RSS signal, a prior light radio map, and AP/BLE knowledge. Smartphones with various inertial measurement unit (IMU) readings are exploited to reduce site survey efforts and record users' trace information along the walking path. Moreover, we establish some simple boundary check rules to adjust the estimated location in order to enable it to be smoother to avoid jumping too far, thus improving the user experience. The remainder of this paper is organized as follows. In Section III, we present our tracking app components and the method used to collect information from BLE beacons and IMU information for localization purposes. In Section V, we present our tracking scheme for online applications, which corresponds to an AoI classification scenario. The experi-Regarding the aforementioned indoor infrastructures, three main sensing techniques for obtaining related location information are described below.

1) Multilateration
At a specific time, the smartphone first measures the RSS from the Wi-Fi AP within its communication range and translates it into a distance according to a specific signal propagation model. Then, the triangulation technique [1] calculates the location of the smartphone using a set of radial distances. This technique is very simple but can only be accurate when there exists a line-of-sight (LoS) between the smartphone and the Wi-Fi AP. Thus, one major disadvantage of this technique is that it suffers from environmental dynamics, which prevents researchers from developing accurate indoor localization systems based on this technique.

2) BLE Proximity
The proximity of a BLE beacon can be obtained using several tools based on the smartphone operation. For example, in the iOS system, CoreBluetooth framework [29] scans nearby BLE beacons and provides the proximity of the smartphone to some nearby BLE beacons in the area. A BLE scanner such as an iPhone can run the BLE scanning function provided by this framework. In general, proximity-based localization selects the strongest RSS from specific BLE beacon and determines the smartphone location to be the region covered by the BLE beacon. Thus, it often provides a rough location estimate but is very easy to implement in a smartphone.

3) Fingerprinting
The fingerprinting technique is often used to obtain the spatial relationship between the RSS and the location. It computes the smartphone location by matching the online RSS readings to the fingerprints collected during the offline phase. Then, the matching process picks the RSS fingerprint, which has the smallest standard deviation to the online one owing to the time-varying nature of the indoor propagation channel, even at the same location. To support tracking, RSS fingerprints are collected during user movements. In particular, when a user enters a building, and his/her smartphone records the RSS fingerprints along his pathway. The finalized fingerprints are then summed along different walking paths.

B. EXISTING LOCALIZATION SYSTEMS
First, in this section, the reference nodes (RNs) refer to nearby Wi-Fi APs, BLE beacons, or a combination of them, where the smartphones can obtain their reference signals within the communication range. With respect to localization within a single floor, because modern smartphones are already equipped with both Wi-Fi and Bluetooth receivers, they can collect the RSS readings from RNs to localize themselves. Several studies have attempted to achieve this goal via Wi-Fi-only [1]- [4], BLE-only [10]- [12], or a combination of them [5], [13]- [16], [24]- [27]. Most of the studies tried to jointly estimate the location of the smartphone based on a radio map of the AoI. The core idea is that using the online RSS reading, the smartphone matches it to the location of sample points whose RSS fingerprints are the closest match to the current smartphone location. The k nearest neighborbased method [22] can be applied to estimate the location of the smartphone. In this way, it has low complexity and can handle the mobility of the user, but the accuracy of such schemes suffers from environmental dynamics, usually producing a location error of 5∼10m. Alternative probabilistic methods such as histograms [30] and kernel-based schemes [32] can be utilized in the RSS database to calculate the user's location.
Recent works [5], [10]- [12], [31] showed that the performance of any hybrid wireless sensing tracking system depends on two factors: the RN deployment strategy and the description of the richness of information extracted from the hybrid signals. Table 1 summarizes some existing hybrid localization systems that have been successfully implemented on smartphones. We note that the localization accuracy of each work depends on several factors, such as the BLE deployment density, a comprehensive survey of the Wi-Fi/BLE fingerprint database, and the characteristics of the AoI. Moreover, there exists a trade-off between accuracy and cost when designing a pervasive indoor tracking system, especially in mobile environments. For example, many tracking algorithms [10]- [12] require that a sufficient number of BLE beacons cover the AoI, and their deployment spacing must remain sufficiently large to avoid interference from nearby Wi-Fi APs and other BLE beacons. Meanwhile, [5] designed a hybrid Wi-Fi/iBeacon indoor tracking system that overcomes the problem of limited public Wi-Fi information on iOS devices.

C. TECHNICAL CHALLENGES AND MOTIVATION
Although there are many systems and solutions for indoor environments that rely on Wi-Fi/BLE/IMU readings, the optimal tracking strategy is still an open problem. In contrast to the aforementioned works [10]- [12], [24]- [28], we identify current technical problems for 3D tracking systems on smartphones, especially in multiple-floor scenarios.
Application programming interface (API) capabilities and integration: The Wi-Fi AP information can be extracted easily on Android smartphones via public API, but it is very difficult on iPhones owing to the secure Apple policy [33], [34]. An iPhone can only extract information from a single currently-connected Wi-Fi AP instead of a list of APs in the area. With this limited information, Wi-Fi usage has become optional for localization purposes. For example, the authors in [24] proposed that RSSs from nearby Wi-Fi APs can be utilized for floor detection by evaluating the principle VOLUME x, 2021 1∼3m in research lab and 2∼5m in empty hall [11] Map-based pinpointing and triangulation Laboratory and office corridor ≤ 3m [12] Hybrid IMU and Wi-Fi/iBeacon fingerprinting with particle filter large-scale area (600m 2 ) ≤ 2m of fingerprinting with a prior knowledge of certain areas. Such a method suffers from heavy database and performance degradation when the Wi-Fi AP density is low. And the most common beacon protocols used in iOS are Apple's iBeacon and Google's URIBeacon. By default, both of them make use of proximity sensing capabilities to estimate a user range as (1) from RSS measurements. However, BLE beacons have a variety of discriminating capabilities to recognize a specific location, subject to the inherent limitations of radio signal propagation. Converting a relevant distance from the RSS requires a practical model that reflects the effects of the deployed BLE locations in the AoI. BLE location deployment: The challenge is to balance the trade-off between deployment cost and power consumption during the offline phase (e.g., AoI survey) and online phase (e.g., power consumed in each BLE scanning, system calibration). The density of BLE beacons must be sufficient for the tracking app to accurately localize a user within a short processing time, while the distance between them must be greater than a safe threshold to avoid interference between them and nearby Wi-Fi APs. Under the assumption that only existing Wi-Fi APs, BLE, and smartphones are used without additional devices, we would like to design a precise tracking app using a certain number of pre-deployed BLE beacons and a smartphone.
Database collection and environment recognition: Any indoor tracking application relies heavily on the map of the AoI, which can illustrate different features such as rooms, corridors, and staircases. The map database generation should extract these features and engage with smartphonebased sensor readings during the user's moving trajectory. Collecting more Wi-Fi/BLE samples at multiple locations improves localization accuracy, but also introduces large errors and affects the user's experience. Intuitively, recording more RSS samples at the same location at different times and averaging RSSs from the same Wi-Fi AP/BLE location as a fingerprint can mitigate random noises and contribute to a robust solution. Owing to the presence of obstacles indoors, it is necessary to involve relative measurement errors from an unpredictable variation of reference RSS readings and motion sensors. From the users' perspective, many fingerprints in the database cause a long query time to determine the area where the user is currently located, thus affecting the overall localization system.
Hybrid localization algorithm: With the above observations, a hybrid location estimation is required in order to accurately estimate user location with a short processing time. Because various measurement errors may lead to inaccurate localization results, online calibration and drift compensation should be adopted according to the geometric constraints.
In our design, we do not aim to provide the most accurate solution for the given indoor infrastructure, but try to uncover the true potential of these tools. Our tracking app takes advantage of the currently-existing Wi-Fi and only uses some BLE beacons to provide extra information, while combining with inertial sensing to monitor mobility levels. Thus, the proposed solution includes a lightweight fingerprint assembly collection module, a robust regression model for RSSdistance conversion, and a hybrid localization algorithm. We demonstrate how to solve the previously mentioned problems in the following section.
• We observe that a good tracking app should not follow any complex smartphone operations. To overcome the Wi-Fi difficulties on iPhones, we applied the proximity method in [5], where a Wi-Fi status bar is converted to a related range. Using this approach, the smartphone can easily determine the proximity of nearby Wi-Fi APs within the network perimeter. Furthermore, instead of using the default settings for the BLE measurement model, we consider several factors, such as the path loss component and attenuation. Considering the randomness, the RSS diminishes with distance according to a certain propagation model. • One of the advantages of the BLE beacon is that it can be placed freely within the AoI and provides good signal geometry. BLE beacons can be installed along with the available Wi-Fi APs in the AoI to improve the localization accuracy. Inspired by [5], we deploy BLE beacons over the AoI in an optimal strategy to reach the currently-existing Wi-Fi coverage and remain clear from the interference of other nearby BLE beacons. Through the training phase, we classified the AoI into three areas that represent three types of environments according to the RSS readings. For each partition, we calculated the signal propagation parameters, such as the path loss exponent and attenuation factor. Thus, when a user comes online, it can predict and control the RSS fluctuations over both time and space by adjusting these parameters.
• For data collection based on Wi-Fi/BLE, we build a sparse 3D database of the geometry captured by several key points. A key point consists of the spatial location and pre-recorded RSS readings. For example, a typical key point is constructed as is the number of orders, and RSS ij is the corresponding RSS record in the database. In terms of smartphonebased inertial sensing, because the PDR relies on the IMU readings, we studied several relevant factors such as step detection and counting, stride length, and heading direction to select robust and reliable estimation models for the user's mobility characteristics. • A hybrid indoor localization algorithm collects Wi-Fi BLE readings with smartphone-based IMU to estimate the user location along a walking path. Moreover, RSS readings can be treated as a random process and its path loss needs to be modeled depending on whether the smartphone is in LoS, partial-none-line-of-sight (p-NLoS), or full NLoS condition. Thus, with a good BLE deployment strategy and suitable path loss modeling, we aim to track a smartphone in indoor environments. To achieve this goal, we use a smartphone-assisted IMU as extra information for mobility tracking in our localization app.

III. PROPOSED LOCALIZATION APP COMPONENTS
As illustrated in Fig. 1, we introduce three major components of our tracking app: (i) An RN collection layer consists of a Wi-Fi/BLE scanner. The scanner runs a scanning function provided by the corresponding RN type and an API library with the smartphone operation. For example, in the iOS system, the proximity function in [5] provides a trustedrange for Wi-Fi, whereas the CoreBluetooth framework [29] scans nearby BLE beacons and estimates the distance of the smartphone to some nearby BLE beacons in the area. The RN profile is subject to a lightweight and lower computational load. (ii) A smartphone-IMU collector enables the user to retrieve mobility data via the CoreMotion framework [35] and to update the user location via CoreLocation [36]. (iii) Location estimation and calibration modules periodically collect data from (i) and (ii), run the tracking system, and display the current user location on the app screen. This app can track the location of the user device independently using the online RSS and IMU readings of the user device. It also helps to identify either stationary or moving to another floor location or inside an intended area.

A. AOI CLASSIFICATION 1) Region Classification Metric
To identify a feasible region of the point of interest, let ϕ be the dissimilarity function between two RSS vectors f and f ′ in R n , which is measured by the Euclidean distance between them as where δ j = |f j − f ′ j | is the dissimilarity between two fingerprints. To retrieve a fingerprint f * in the fingerprint database space F, we find the best match that achieves the highest similarity with respect to f , that is, ( Given a predefined threshold δ, if the dissimilarity δ j satisfies δ j ≥ δ, two fingerprints f j and f ′ j are treated as two different points in the fingerprint space. Otherwise, they are indicated at the same point. The distinguished fingerprint percentage is defined as Alternatively, P df is the probability that two RSS samples are identified as different fingerprints.

2) Floor and Room Detection Based on RSS Profile
For each scan, our localization app ran a feature detection algorithm and identified various key points. By matching key points from the database, we obtain the following information: (i) the current Wi-Fi AP/BLE beacon location to VOLUME x, 2021 which the user may be close, and (ii) predictions on floor level and room level to which the user may belong. Before applying the location methods to the database, we need to define a subset of the associated BLE beacons and Wi-Fi APs, which can easily distinguish RNs. In our tracking app, we generated an RN map according to floor level and floor types, such as is the location of the RN, Feature j = <floor level, room/corridor type> is the RN characteristic, and n F is the total number of RNs defined on the indoor map. For each RN, there is a unique identifier for easy retrieval on a smartphone. For example, it can extract Wi-Fi information, such as the MAC address and service set identifier from the AP. However, a BLE beacon advertising packet consists of three numerical identifiers: UUID, major number, and minor number. Major and minor numbers can be modified according to classification purposes. A lookup table consists of all RN features, so the smartphone easily retrieves related information from the RNs. In summary, we determined the current floor according to the following rules: (i) We select the RN with the strongest RSS signal. This point can be near the Wi-Fi AP or BLE beacon. (ii) In the case of hybrid measurements, if the smartphone recognizes that both the Wi-Fi AP or BLE beacons have the same range, we prioritize the location of that BLE beacon. (iii) If the smartphone detects that it is in a transition zone (e.g., a transition zone between two consecutive floors), the floor detection function is not updated until it receives a clearer signal from the other RNs. The floor detection was then processed according to (i). With respect to room detection, we follow the above rules. However, it is more difficult to distinguish between two consecutive rooms, as shown in the experiment below. Therefore, we need to combine different signals, such as IMU readings, to accurately track the phone.
To test the floor/room detection scheme, we conducted the following two series called floor-to-floor (F2F) and roomto-room (R2R) experiments, which are illustrated in Fig. 2. The BLE beacons (in particular, RedBear iBeacon [37]) were placed on the ceiling based on the instructions in [5], [38]. A smartphone (e.g., iPhone 12) held by a user is under the iBeacon's location with an actual distance of 1m, but the ground distance is 0m. According to the figure, we draw the actual distance in cyan color and the ground distance in blue. For each experiment, the iPhone scans for 10 minutes each time during various times of the day (e.g., morning, noon, and night).
• F2F experiment: The iPhone collects RSS readings from nearby BLE beacons on the same floors at different ground distances (e.g., 0m, 5m, 10m) and BLE beacons from upper and lower floors. To convert a 3D distance d to the ground truth distance d g , we use the following formula:  where h d is the difference between the ceiling height and the user's height. We then check whether the iPhone can correctly detect the current floor on which the user is at an acceptable rate (e.g., 70∼80%). • R2R experiment: We conduct the experiment in two adjacent offices, where each room has a BLE beacon. The iPhone is held by the user receiving the BLE signals at different ground distance locations (e.g., 0m and 3m). From the collected data, we calculate the floor/room detection rate as Detection rate = Number of success detected cases Total number of samples ×100%.
To evaluate the floor and room detection performance, we integrated the results from different experimental areas. As shown in Fig. 3, the average detection rate is about 88.3% for floor detection and more than 80% for room detection.
For the multi-room experiment, each room has a different room detection probability owing to the different number of obstacles in the rooms. From the results, we observe that under an appropriate BLE beacon installation, we achieve accurate detection results with sufficient confidence to be used for future tracking.

3) Small Region Classification
After recognizing the floor and room to which the user may belong, we aim to decide sample locations into a distinguishable area based on signal classification. For a specific location, we observe the RSS inconsistency caused by signal fluctuations and obstacle blockages, and reveal the RSS uncertainty with respect to the physical distance. We consider three types of environments in our tracking system: LoS, p-NLoS, and NLoS. In an LoS environment, the BLE signals received by smartphones from the same or close locations   It can be recognized that the RSS variance is high because the RSSs fluctuate drastically. In addition, to differentiate the p-NLoS area from the NLoS area, the compass patterns from the IMU readings provide clues to distinguish between the two types of areas. In the NLoS area, the variance in the compass reading is much larger than that in the p-NLoS area. By performing several practical experiments in [5], we observe that it usually varies from 4∼10°, as observed from real user traces. This space regionalization method applies to both Wi-Fi and BLE signals. Specifically, we adopt the classifier in [39] to separate a dataset into smaller ones and analyze their statistical features. In the following section, we present specifically BLE signal classification. During the offline phase, the distribution of the RSS readings from each BLE beacon was evaluated. Based on the fact that the probability of RSS measurements in LoS conditions is generally expected to be centralized, given an observation vector x ∈ R S , we calculate the kurtosis as its statistical feature [40].
where µ and σ are the sample mean and standard deviation of the observation vector, respectively. We note that each data trace in our database was labeled with the corresponding scenario for online phase use. When we place a BLE beacon in the AoI, we also associate the probability that a region falls into the three aforementioned types.

4) Transition Region Detection
Previous works [24]- [26] exploited barometer changes to detect a user transfer from one floor to another. A barometer measures the atmospheric pressure value in millibars (mbar), which can be converted to height in meters. In particular, it computes the height h from the barometric pressure, as in [17].
Here, p and p 0 are the measured currently location air pressure and standard sea level pressure in mbar, respectively; T 0 = 1, 013.25mbar is standard sea level pressure, L = 9.8 • C/km is the temperature lapse rate, R = 287.057J/(kg · K) is the universal gas constant of air, g = 9.807m/sec 2 is the Earth's gravitational acceleration, and M is the molar mass of dry air.
By calculating (7), we can determine the height of the current user's location, including the floor level and the transition area between the two floors (e.g., staircase). However, by performing practical experiments, we observed that this method depends on the weather conditions and the given data from a reference floor. Table 3 shows the barometer measurements collected on three office floors during a week. From the experimental results, we realize that the above pressurealtitude conversion method has the following disadvantages. First, the estimated altitude depends on the ambient temperature, which varies under different weather conditions. Thus, it may not be possible to distinguish the altitude between two adjacent floors, leading to inaccurate location calculations. VOLUME x, 2021 Second, to perform the localization on a particular floor, we need to perform data normalization on one floor and then validate the pressure change of the other floors based on this reference floor data.
To overcome the aforementioned problem, we propose a method to detect users entering the transition zone between two floors according to the following signs.
• Sign 1: We frame the transition region in the AoI with a rectangle called the bound rectangle. The rectangle is defined by four given corner points. At a certain time, if the calculated location falls inside this rectangle, we predict that the user can enter the transition region between two adjacent floors. • Sign 2: When the user goes up/down the stairs, the accelerometer value fluctuates significantly from the one in normal walking, and we know that the user has entered the transition zone by the stairs. In this case, the variance of acceleration becomes larger, and the distance between two adjacent acceleration peaks becomes shorter than that of normal walking. If the user walks into the elevator, the radio signals are blocked and the acceleration patterns are mostly straight and long. Because we assume that the user does not spend much time in the transition zone, we do not investigate the characteristics of different functional areas in the zone. • Sign 3: The barometer change provides a clue to differentiate between upstairs and downstairs. Under the practical assumption that the ambient temperature on all floors is the same, the pressure decreases with increasing altitude. By observing this change, we can predict the direction of movement of the user in the region.

B. RSS-DISTANCE CONVERSION FOR RN SIGNALS
In this section, we use the RSS-based ranging technique to map the signal strength to a relevant distance. Because radio signals degrade during propagation, understanding radio attenuation in an AoI helps us to estimate this distance more accurately. Generally, with any RN type (Wi-Fi AP or BLE beacon), the same RSS-to-distance conversion can be applied with a different set of channel parameters (e.g., reference path loss at reference distance, path loss exponent, etc.). In special cases, such as iOS devices, which cannot read the RSS signal in dBm, the proximity conversion table in [5] is applied based on the Wi-Fi status bar. Below, we show how to develop a relationship between the RSS signal and the estimated distance for BLE RN. An intuitive way to overcome the traditional fingerprint problem is to recognize and discard outdated entities before fingerprint matching. We denote L(d) and L(d 0 ) as the RSS values for BLE signals at actual distances d m and d 0 m from the smartphone, respectively. Mathematically, the relationship between the distance and the RSS can be represented by where n is the path loss exponent, and X g is a normal random variable with zero mean and standard deviation σ. The value of σ was empirically determined through practical measurements in the AoI. By collecting a series of reference RSS values versus distance, we can specify the parameters of the model (8) and use them to estimate the RSS-based range. For simplicity, the estimated distance d is calculated for each BLE beacon using the following formula: The relationship between the estimated distance (9) and the ground truth distance can be found in [31]. Under the current indoor conditions, we collected real-time RSS readings of a RedBear beacon measured by an iPhone 12 at a reference distance d 0 = 1m. In order to find the related parameters for each area, we applied the minimum mean square error (MMSE) to the training data. Mathematically, we write where S is the number of samples,d is the distance obtained from (9), and d actual is the actual distance from the dataset. Thus, the model in (8) has two parameters that can be tuned: the path loss exponent n and the standard deviation of Xg. Several experiments were conducted on the 12th floor of Hyungnam Memorial Engineering Building at Soongsil University. The area is approximately 30m×20m, with the floor plan shown in Section VI. The procedure to obtain the parameters n and Xg in (9) during the offline phase is described as follows. First, we place a BLE beacon at a specific location in the AoI. Second, a smartphone measures the RSS values from d actual = 0.5 to 1.5m, where the sampling distance interval is 0.5m. As reported in [38], the reliable range of a RedBear beacon is approximately 2.5∼4m; thus, we only collected the RSS measurements within a ground truth distance of 1.5m. Within this distance, the confidence level for classifying the BLE measurements is more than 95% [5]. Collecting far BLE beacons may not always be efficient because of significant RSS fluctuations. Hence, the best way to deal with signal ambiguity problems among nearby reference ones is to obtain the RSS values within a short distance and to discard the others. With respect to the BLE beacon placement as in Section VI, the results obtained from the measured data on iPhone 12 are given in Table 3. After this stage, the estimated values of n and Xg are given in (9) to obtain an accurate range when converting the RSS reading during the online phase.
Overall, when generating the indoor map for the app, we analyze the relevant RN signal propagation properties and other additional information such as IMU data to regionalize the trace map into different distinct regions and refer to the corresponding functionality of different areas. Coarse regionalization classifies the floor, corridors, rooms, transition areas, and so on, while fine regionalization classifies the selected region into smaller regions based on the probabilistic model. Finally, it yields a map of AoI.

IV. IMU-BASED PDR
In this section, we introduce some basic components of the PDR and the method used to obtain readings from smartphone-based IMU sensors. From the readings, we learn about the relevant parameters to improve the PDR components to avoid accumulated errors from path deviations and external impacts along the walking path.

A. ACTIVITY RECOGNITION
In this section, we describe the three main user activities.
• Idle: Acceleration and barometer readings do not change much. • Normal walking: Acceleration readings stably change with small variance. • Go up/down stairs: In cases involving stairs, the accelerometer signature has large variations on acceleration and barometer readings. Figure 4 gives examples of the acceleration behaviors of such movement states. We observe that the acceleration patterns are unique in each activity. Furthermore, each floor is divided into several small regions based on RN reading and IMU (acceleration and barometer) patterns. Each region corresponds to a potential motion state. For example, considering the path of a person walking from the exit, through the corridor, and into the room, the path can be divided into several parts such as the first part (transition area), the second part (corridor area with normal walking), and the third part (enter the room and connect with the RN in that room).

B. PDR-RELATED COMPONENTS
To retrieve the user's mobility, a typical smartphone-assisted IMU collector reads the corresponding measurements from several sensors such as barometers, accelerometers, gyroscopes, and magnetometers [13]- [16]. With these inputs, the PDR calculates them to track a user along the walking path. Mathematically, the user location p k (x k , y k ) at each step k is calculated as Here, p 0 (x 0 , y 0 ) is the starting location of the tracking path, which may be unknown or given. The parameters λ k and α k are the estimated step length and heading direction angle obtained from the IMU, respectively. Next, we describe the three main functions of a typical PDR-based tracking system.

1) Step Detection and Step Counting
From [41], the main principle for step detection is the recognition of a repetition of accelerometer readings. In particular, depending on the user's walking style, a step is recorded if the corresponding acceleration measurements form a peak followed by a valley in the time domain. Mathematically, given an accelerometer reading a t , we define a step as follows.
In practice, we set a upper = 0.3m/sec 2 and a lower = −0.3m/sec 2 for normal walking, and a upper = 0.7m/sec 2 and a lower = −0.7m/sec 2 for walking on stairs. Moreover, we assume that a user normally takes two steps per second, so the time spacing between two adjacent accelerometer VOLUME x, 2021 peaks/valleys must be greater than one-third of the walking step period. In particular, if the walking step period is 1sec, the time spacing between two adjacent accelerometer peaks/valleys must be greater than 1/3sec. Once a step is recognized, the pedometer adds this step to its counters. Using a smartphone pedometer, it is possible to achieve a step counting accuracy above 95% [12].

2) Stride Length Estimation
The stride length λ 0 is defined as the distance between two adjacent steps. This value depends on the height, walking style, and speed of the user. Using a given accelerometer signal, calculating the step length can be obtained in several ways, such as the regression [42], Weinberg [43], Kim [44], Scarlett [45], and artificial intelligence models [46]. In this work, we use the following regression model to obtain a suitable step length for the PDR.
Here, f is the step frequency that can be learned from experiments [5], [31], Var(a) is the acceleration variance in each step, and π 0 , π 1 , and π 2 are the regression coefficients [5].

3) Heading Direction Estimation
To obtain the direction of the steps as the user walks, we use a smartphone gyroscope and compass in the magnetometer. For each sensor, we have different heading direction information according to its characteristics. The compass-based reading is stable in a long walking path, but can be affected by metal material along the path, while the gyroscope-based reading avoids magnetic fields but suffers from accumulated errors. In our previous works [5], [47], we considered a combination of two sensors in order to achieve a good prediction of the heading direction. In this section, we denote α g as the newest gyroscope and α c as the orientation calculated from the accelerometer/magnetometer. The modified heading direction angle is updated as follows.
where dt is the short time interval from the last gyroscope data until the present. The value of parameter b depends on which data are primarily used. For example, b = 0.98 means that we want to use the gyroscope data as the heading direction for the PDR. Let N num be the number of footsteps that the user has completed along a given route, then the smartphone measures the traveled distance, as in [47].
Note that (15) is usually used to check the user's instantaneous trace with the reference RN range for efficient deviation detection. This procedure is described in section V.

C. SMOOTHING
To provide better IMU data for PDR functioning, low pass filters are common used in mobile devices in some forms of weight smoothing [48] or averaging window [17]. In terms of weight smoothing, a weight smoothing parameter ν can be applied on raw IMU data x i as follows.
Here, the last calculated value is added to the most recently collected one x i according to a weight factor ν. If ν is close to 0, it means the new value does not much change when smoothing. Otherwise, it allows x i to affect the updated value. For example, in CoreMotion [35], the output acceleration values after applying a soft weight smoothing (e.g., ν = 0.005) are identified as raw acceleration readings for motion tracking.
In this section, we applied a method called the simple moving average (SMA) [10] to smooth out data spikes. It works as a rolling average within a given window size. Mathematically, we denote ω as the size of the averaging window, and the SMA does not work until ω values have been collected. Once the collection has been completed, it finds the mean of the most recent ω data values in a stream.
The maximum frequency is usually hardware-dependent (e.g., CoreMotion can use the supported frequency at 100Hz). The selected window size ω should be chosen to be large enough to smooth out the data, while being not too large to cause delay in response time because of longer calculation. In our paper, with a sampling frequency of 20Hz, we selected the window size ω= 3∼5 for PDR process. There are various filter options such as Kalman filters and their variants [46], [49], [50] and particle filters [14], [41], which are computational expensive. In this work, note that we did not focus on optimizing these filters. Depending on the applications, we can choose the appropriate filters depending on the design choices.

V. ONLINE TRACKING PROCEDURE
In this section, we show how our proposed tracking app works in a typical indoor multiple-floor environment. A diagram showing how the application works are shown in Fig. 5. A tracking scheme consists of an indoor map (e.g., RN list and deployment map) and a mobile user holding a smartphone (e.g., iPhone 12). The tracking problem is defined as follows. At the m-th step, the iPhone carried by a mobile user periodically collects online RSS readings from N m near RNs. We denote the RSS reading vector as r m = [r 1 m , · · · , r Nm m ] T , where each component of this vector corresponds to the RSS from N m RNs. Note that the online measurement vector is first pre-filtered to determine the N f m RNs that have the strongest RSS readings. The indoor tracking app uses the vector r m and the corresponding IMU data to detect the current feasible area (floor, room, transition area) and chooses a suitable channel propagation according to this area. It also updates the user location via the PDR, such as the previous user's estimated location p m−1 (x m−1 , y m−1 ), the step length λ m , and the heading direction α m to calculate the current user's location p m (x m , y m ).

1) Initialization
First, we assume that the RN database has been saved on the iPhone; thus, our tracking app can easily access related information of any RN inside the AoI. This information includes their locations, and the signal profiles are built during the offline phase. When the user starts the app, he/she can navigate his/her location by exploring the characteristics of the RN space. In our tracking app, if the RNs are of the same type, we seek the strongest RN as a starting location for the tracking path, i.e., p 0 (x 0 , y 0 ). Otherwise, if there are multiple RNs in the area with the same RSS value, we use a weighted centroid algorithm to determine p 0 (x 0 , y 0 ) as where N b is the number of available RNs {a i , i = 1, · · · , N b } that appear on the iPhone's scanning list. If the RNs are different from each other, we assign priority to the RN that has the shortest calculated distance from its signal to the iPhone, according to Section III.

2) Location Estimation
As the user is moving, the tracking app exploits the PDR method based on smartphone-IMU measurements to perform the localization. In particular, the current location of the smartphone p m (x m , y m ) is calculated as Here, λ m is the estimated stride length. The value α m is the estimated heading direction at point p m (x m , y m ). Both λ and α m were obtained from Section III.

3) Location Correction
At every step, the smartphone uses the tracking app to keep track of its location. For each tracking update, we check whether the location estimate properly follows the desired path. Thus, the aim of the location calibration module is to determine if the user is still within the reliable range of the strongest RN in the scan list. The module generates instructions according to the following two rules: (i) Without loss of generality, we denote the strongest RN location in the scan list as a 1 and its estimated distance from (9) asd 1 . Ifd 1 ≤ d lim (d lim = 5m for Wi-Fi AP and 1.5m for BLE beacon), the tracking app sets a 1 as the corrected location of the current user. (ii) Otherwise, we consider the dissimilarities among the estimated ranges (9) of N f m nearby RNs and the PDR walking distance (15) as To provide correct walking hints at the correct locations, when the dissimilarity veers off the desired path of the thickness ϵ (i.e., φ m ≥ ϵ), the module attempts to match P m (x m , y m ) to the intersection of the circle C(a 1 ,d 1 ) made by a 1 with radiusd 1 and the line segment made by P m−1 (x m−1 , y m−1 ) and P m (x m , y m ) as

4) Boundary Check
Any sub-region in the AoI can be bounded by a rectangle represented by the four corners. As illustrated in Fig. 6 (a), an office room is marked on the map by four red squares. For the corridor case, it becomes simpler by saving the corridor width, the starting point, and the ending point of the corridor. Therefore, only a finite number of markers are stored in the database, making data storage simpler and easier. To present smooth visuals for the user experience, we rely on the following two principles so that the calculated jump distance between two estimated steps is not too large compared to the user step length. (i) The currently estimated step (e.g., p m ) is inside the closed rectangle, and the next estimated step p m+1 indicates that it is out of the rectangle. Then, the correction point is the intersection of the adjacent rectangle edge and the line connecting the two points p m and p m , as shown in Fig. 6 (b) (first image). (ii) In cases where the distance between the current estimated location and the next one is too large, for example, more than 2m, we understand that there is a large fluctuation in the input signals, and the updated point remains at the current location until new RN signals are received, as shown in Fig. 6 (b) (second image).  In summary, we adopted a fusion scheme between the probabilistic approach for RN signals and the smartphonebased PDR system to perform self-localization and tracking. To investigate the potential causes of limited localization accuracy, we performed various practical experiments and revisited the characteristics of the RN localization scheme. First, floor level detection can be improved by employing an RSS profile-based method and mixed data of barometer/acceleration from the smartphone-IMU. Taking advantage of the characteristics of specific regions, we used different signal readings to achieve a precise level for each area detection. Second, RN signals are reliable over short communication ranges, and distant RN locations may lead to large location errors. Biased RSS measurements caused by p-NLoS/NLoS effects can be controlled using a prior probability model during the training phase. Third, the smartphone-IMU extracted user mobility information to reduce tedious site survey efforts, while improving tracking accuracy. In addition, our localization app is more friendly because it does not expect the user to start at a specific location for tracking.

VI. EXPERIMENT RESULTS
We conducted several experiments in a typical office building to demonstrate the effectiveness of our tracking scheme. We built a tracking app on an iPhone 12 with iOS 14.7 and 128 GB storage. Throughout this section, we make the following assumptions.
(i) First, in order to scan nearby Wi-Fi AP/BLE beacons, the iPhone needs to turn on Wi-Fi/Bluetooth function in the setting manner. All Wi-Fi APs and BLE beacons used in the test area were aggregated into an RN list. The ratio of the number of nodes between Wi-Fi and BLE depends on the choice of design. For the readers' convenience, we mark the letter "B" for BLE and "W" for Wi-Fi for simplicity in the RN name. (ii) Second, assuming that we take advantage of the existing Wi-Fi infrastructure in the building, BLE beacons just need to be placed in some locations to support room detection and to corroborate the tracking algorithm. In this case, the number of BLE beacons should be sufficient to cover the AoI and not conflict with the current Wi-Fi communication range. In terms of BLEonly deployment, the AoI is covered by a reasonable BLE beacon density; that is, each BLE beacon only covers a separate area without causing interference and ensuring appropriate coverage for the area between two adjacent beacons. We follow the BLE deployment principles in [5] for planning BLE beacons over the AoI. (iii) Third, we also label the RN list using two categories: "office room" and "office corridor" by using the MAC address for Wi-Fi APs and the UUID, major value, and minor value for BLE beacon. For example, the UUID parameter gives us a unique number that allows the identification of the beacon manufacturer or owner, while the major and minor values can be assigned as a certain floor number and a room number, respectively. During the online phase, only beacons with the same category can join the localization algorithm described in Section V.
The series of our experiments is described as follows. We conducted our experiments on three floors (11th, 12th, and 13th floors) of Hyungnam Memorial Engineering Building at Soongsil University. The size of each floor in this building is approximately 20m×40m. The distance between two consecutive floors is approximately 3.5m. The staircase connecting the two floors consists of two segments, each of which has 11 stairs. On each floor, there are two types of elevators at both ends of the corridor: the single elevator can reach all floors and the double elevators only goes to either odd or even floors. Currently, there are two Alcatel Lucent IAP-305 2x/3x 11ac Wi-Fi APs deployed over each floor. A detailed description of the AP's specifications can be found in [51]. For a hybrid tracking system, we used RedBear beacons [37] to support tracking. All of them were placed in either office or office corridor. The beacons were attached to the ceiling of the floor to avoid disturbances when people passed. The iPhone 12 carried by a user collects both IMU data and RSS readings from detectable Wi-Fi AP/RedBear beacons simultaneously, and it then inputs them to the tracking app. The estimated steps along the tracking path were also recorded on the iPhone storage for further analysis. Because the three floors have the same structure, the number of BLE beacons placed on each floor is the same.
Regarding the localization metric, we defined the accuracy rate (AR) to evaluate the localization performance. Given a localization error bound ϵ, it can be obtained by the percent-  age of the number of estimated points that fall inside the path of thickness ϵ.
Here, N step is the actual number of steps in which the user has finished the desired path P(ϵ) with a thickness ϵ. Before going through the experimental results, we made a few notes about the visual representation of our app. To plot a point in 3D space and update its next point, we must represent the ground truth location on the floor where the user is currently located, and represent the height of the floor. Usually, we only provide indoor floor plans in 2D space, which show specific details of the relationships between rooms and other areas on each floor. Here, it was not easy for us to express smooth 3D tracking results, while satisfying the above conditions. In the following step, we present the calculated user's location on the floor under the 2D map. When the user detects that it enters the transition area, the app plots the location in terms of the vertical direction.
To demonstrate the performance of our tracking app, several experiments were conducted in the building, as shown in Fig. 7. The user carrying the iPhone 12 collects the RSS and IMU measurements at every step, and walks at a normal speed along the path. This figure shows the demo tracking results of the proposed work in two cases: (a) floor detection with RN RSS-based profile and (b) floor detection with barometer readings in the floor transition area. The grid spacing of the map display was 1m. In this figure, we plot the desired path in green. The thickness of this path indicates a given localization error bound (e.g., ϵ = 2m). The RN locations are indicated by a bright yellow circle. The starting and ending points of the actual path are plotted as star and square shapes, respectively. In Track 1, we observe that when the user moves on the corridor of a certain floor, the tracking results are quite good. Then, when the user reaches the transition staircase area, it creates a large jump in the estimation location. This is clearly shown in the transition from the 12th floor to the 13th floor because this area is not covered by any RN signal, the user's location is updated only when the phone connects to the next RN. However, in Track 2, exploiting barometer readings helps the app to track vertically within the transition area. The visual representation of the estimated steps is a refined state along with the user's movements. From the results, we observe that the user would have a better 3D experience if we combine the two schemes on the AoI. In particular, we apply a floor detection scheme with an RN RSS-based profile within corridor/room regions and floor detection with barometer readings in the floor transition area.
In Fig. 8, we consider a practical route when a user walks in a sequence including several complex areas in the building.
• 11th floor (F11) activities: Enter a door on the F11 » VOLUME x, 2021 move along corridor F11 » enter room 1102 » exit room 1102 and continue moving on corridor F11 until the user meets the stairs to go upstairs to the next floor. On this floor, we evaluate the tracking results when the user walks from the office corridor to the office room, and vice versa. • 12th floor (F12) activities: Enter a corridor » enter room 1202 and exit the room » enter room 1203 and out » back on F12 corridor and take the single elevator to go up to the next floor. On this floor, we observe the performance when the user enters two adjacent rooms, and we check whether the current room detection is correct. • 13th floor (F13) activities: Exit the elevator » walk along the F13 corridor to the end.
Note that the user's walking turns are different among office rooms because there are different numbers of obstacles (e.g., tables and bookshelves) and the distribution of furniture is heterogeneous among rooms. All regions on the map were recognized. We noticed that users rarely get close to the walls and corners of an office room. With the strong signals of the RN placed in the middle of the room, the tracking results obtained are more accurate. With respect to the corridor, because the corridor in the AoI is quite straight, the localization performance has less error than in other areas. For the joint area of the corridor and the room, when the current user is in the room and receives a strong RN signal in the corridor, the app automatically updates the user's locations based on the correction function in Section III. For the transition area between two floors, we observe that the calculations of floor height and the direction based on IMU readings are sufficient to identify this area correctly, but the tracking results are not as good as in other regions. This is because the use of IMU data for long travel distances can lead to a common problem of veering off the walking path. The situation is terminated only when the smartphone finds a new RN, so it updates itself according to the RN information. Figure 9 shows a comparison of the average AR versus error bound with different tracking situations: mixed Wi-Fi/BLE scheme with RSS profile floor detection [5], proposed scheme with BLE-only, proposed work with mixed staircase-elevator, and proposed work with staircase-only. For each route, a user walks several times on the same route during a day and evaluates the average AR values of path estimation. During the user's walk, there are people who pass by as well as other obstacles such as bookshelves and metal doors. Although we can utilize smartphone-IMU and a single Wi-Fi AP when the Wi-Fi AP density is low, it is still applicable for tracking with BLE only. Note that when we replace existing Wi-Fi APs with BLE beacons, the current BLE beacon density should be the same as that of Wi-Fi, or slightly denser, so it has a low or comparable deployment cost. In this figure, in the office corridor, the number of deployed BLE beacons is the same as the old Wi-Fi AP density. In this case, the average spacing between two BLE beacons is about 10m in the corridor and 6∼7m in the room. First, we observe that the hybrid scheme in [5] provides good estimated results only when the user moves on a particular floor. When the user exits the floor and enters the transition zone, its location is no longer updated until he/she moves to the next floor and uses the RNs for location correction. It can be seen that this problem has been completely overcome by our proposed solution. For visualization, as the user ascends/descends the stairs, the corresponding IMU readings provide an additional source to localize the user at every step in this region. Second, the proposed mixed Wi-Fi/BLE achieves slightly better accuracy than the one with BLE only. Tracking results in a simple path (staircase-only) are better than those in the complex path (including the mixed staircase-elevator). Overall, the results show the benefits of the assisted smartphone-IMU sensors and demonstrate the practical efficacy of the proposed scheme.

VII. CONCLUSION AND DISCUSSION
In this paper, we present a simple indoor multiple-floor tracking scheme based on hybrid Wi-Fi/BLE for smartphones. We also built an iOS app to capture, visualize, and display user mobility, which is measured by smartphones using the hybrid IMU-RSS signal information in a coordinated manner. In particular, by performing several practical experiments, we aim to obtain a comprehensive understanding of indoor radio maps, while validating the accuracy and effectiveness of the smoothing and adaptation effects. The final tracking system has a lightweight database, is capable of identify user location by region, and selects an appropriate signal-tolocation model. Experimental results show that the proposed tracking system achieves a good performance, while enabling adaptation with/without currently fixed infrastructure. Thus, it is beyond the achievements of previous approaches.
By performing this study, we identify several practical issues that need to be carefully addressed when integrating our tracking scheme with other hybrid systems. First, localization accuracy does not always serve as the sole criterion to prove that a tracking system is effective. In addition, an effective system should be stable over a long time and energy aware without much human effort by using energy more efficiently or collecting a minimal number of measurements for localization purposes. Although the proposed scheme works well inside a typical medium-size building, many experiments need to be carried out in large spaces (e.g., malls, subway stations, and airports). Second, even current smartphones can effectively track user mobility (e.g., detect whether the smartphone is moving or if it is context-aware of the user path), it can still lead to bad estimated results over long travel distances owing to uneven inconsistency among different dimensions of hybrid data (e.g., Wi-Fi/BLE observation and IMU data). To overcome this problem, it should obtain a sufficient number of reference traces and control RSS quality along a path when the user is walking.