Indoor Position Detection Using Smartwatch and Beacons

Nowadays, the number of elderly and other people living alone is increasing. Although living alone allows more independence, it raises the risk of serious or even fatal accidents. To help assist those who live alone, we propose a monitoring system to detect indoor position by using a smartwatch and beacons, which are effective and low cost, easy to install, convenient, and unobtrusive in daily life. Data mining techniques were applied to classify indoor positioning zones. A noise reduction process combining two data smoothing techniques was incorporated. The best model for indoor positioning was chosen from various algorithms and different window sizes of data to achieve the best usage in a real-time classification. Both the number and positioning of beacons were also considered in this research. Various useful screens with easy-to-understand visualizations are provided for monitoring subject behaviors and time spent in certain areas, giving a summary of indoor positioning. Finally, the system allows users to manage indoor positioning by combining the marked spots as zoning areas. The management of different numbers of beacons and their locations is also provided to users.


Introduction
Currently, the world demographics is changing towards ageing societies. More elderly people are now living alone rather than with their families. The number of people living alone globally rose from 153.5 million in 1996 to 202.6 million in 2006 and is expected to further increase by around 80% by 2026. (1) One-person households account for 28.9% of all households in Western Europe, 26.7% in North America, and 25.7% in Australia. (2) In Japan, the most rapidly ageing society in the world, around 30000 people die alone each year. (3) Living alone could mean having more freedom, but could also mean degeneration into unhealthy habits, which increase the risk of accidents, serious illness, and mortality. The risk of hospitalization could be reduced by 26% and death by 80% if an immediate notification of health problems is given to doctors or caregivers. (4) Recent advances in sensing, networks, devices, and ambient intelligence have resulted in the rapid emergence of smart environments. These technologies have attracted a lot of attention This version has been created for advance publication by formatting the accepted manuscript. Some editorial changes may be made to this version.
for the provision of enhanced healthcare services and user positioning for elderly people living alone. Therefore, the deployment of an automatic, reliable, and cost-effective efficient healthcare service and indoor positioning systems has become a significant research topic during the past decade.
There are various technologies available for indoor positioning, such as Wi-Fi, Zig-Bee, RFID, ultrawideband-radio, and Bluetooth, which are described in Refs. 5 and 6. The specification for the Bluetooth 4.0 technology (7) was released in June 2010, which was named "Bluetooth Low Energy" (BLE) or "Bluetooth Smart", and major benefits of using the BLE technology are low power consumption, cost, complexity, and bandwidth. However, the main advantage of BLE technology is high penetration through obstacles. Indoor positioning is commonly used in medium-size or large areas, such as in shopping malls, hospitals, airports, museums, and other buildings. (8,9) It is mostly used for detection in wide areas such as departments, floors, and rooms. (10,11) Larger areas have to simultaneously use more transmitters to transmit the signal. Most previous researchers used smartphones, which are inconvenient in terms of portability and wearability compared with smartwatches, which are more convenient for use in real life.
Therefore, the approach presented in this paper can detect indoor locations using a combination of beacons and a smartwatch. Furthermore, this proposed approach enables the user to wear a smartwatch that interacts with beacons in a real environment, to adjust the number of beacons and their setup positions, and to utilize our provided easy-to-understand visualization. The first major contribution of this paper is to propose and demonstrate a highaccuracy and cost-effective indoor positioning system that is suitable and unobtrusive for elderly people and others living alone through the integration of a smartwatch and beacons. The second major contribution is to provide an insightful and easy-to-understand visualization of the whereabouts and timeline of the tracked subject. These visualizations allow caregivers to better interact with and give behavior suggestions to the subject. The third major contribution is to investigate and provide an adaptive system setup in terms of the number of beacons and their locations, as well as merging areas into zones.
The proposed system was installed in a real environment with the aim of identifying and tracking a person using the minimum number of devices while being convenient and unobtrusive in daily life. Finally, a real-time prototype system was developed using a smartwatch and beacons as a proof of concept. The system provides an easy-to-understand visualization for monitoring and tracking subject behaviors.

Related Work
There are several available indoor positioning systems using different transmitter and receiver devices. However, these systems or methods require rather sophisticated hardware or infrastructure. This limitation motivated us to overcome their shortcomings. Previous indoor positioning systems were developed with various techniques and transmitters as follows.

Wi-Fi-based technique
This indoor positioning technique uses a Wi-Fi access point (AP) to estimate the possible position of the user. The rapid growth of APs has made it possible to develop this technique, which has become popular for indoor positioning since it was first used in 2002. Many researchers have used Wi-Fi-based methods. For instance, Maneerat and Kaemarungsi (12) presented a robust floor determination algorithm called Robust Mean of Sum-RSS (RMoS) using mobile objects to identify the location assuming either a fault-free scenario or reference node (RN) failure. Qiyue et al. (13) proposed a Wi-Fi indoor location method based on the collaboration of fingerprint and assistant nodes of the receiver signal strength indicator (RSSI) to improve the positioning accuracy. Li et al. (14) developed an indoor mobile locator based on important APs by selecting the highest RSSI and using their proposed important AP fingerprint (IAP-FP) to identify the location in a classroom. Ji et al. (15) analyzed a practical path loss model of the BLE signal compared with Wi-Fi signals for indoor positioning in line-of-sight (LOS) communication. They used four beacons and two APs for comparison. Gu et al. (16) presented a reduced fingerprint using APs and a smartphone. Their algorithm combined both sparsity regularized singular value decomposition (SRSVD) and the k-nearest neighbor (KNN) (k = 4) algorithm with 10 locations. Razavi et al. (17) proposed a k-means-based method for floor estimation via the fingerprint clustering of Wi-Fi. Seitz et al. (18) proposed a system that utilizes a hidden Markov model that combines Wi-Fi positioning and dead reckoning for pedestrian navigation optimized for smart mobile platforms. Liu et al. (19) proposed a technique and system for surveying wireless indoor positioning.
Wi-Fi is suitable for longer distances (about 50 m), although it is difficult to set up. Wi-Fi devices consume a large amount of energy and are relatively large, which makes them impractical.

RFID-based techniques
RFID is a simple technology using radio frequency readers and tags that became popular for indoor positioning in 2009. This technique has a high detection rate. However, RFID is an expensive technology and obtrusive to the subject. Moreover, the effective communication range of RFID is very short (about 1 m).
Huang et al. (20) proposed a real-time RFID indoor position system with the Kalman filter and Heron-bilateration to filter noise for location estimation. Kung et al. (21) presented an indoor location-aware application using the received signal strength indicator value of RFID for identifying tag positions in a room and provided a calibration algorithm with a backpropagation neural network (BPNN). Zou et al. (22) proposed cost-efficient RFID using cheaper active RFID tags, sensors, and readers. Two location algorithms, namely, weighted path loss (WPL) and extreme learning machine (ELM), have been proposed. Xiong et al. (23) designed and evaluated a hybrid indoor positioning service that combined WSN and RFID technologies into a generalpurpose IoT environment. Ruiz et al. (24) presented a new method to accurately locate people indoors using inertial navigation system (INS) techniques and active RFID technology.

BLE-based techniques
Basically, a beacon is used for transmitting data over short distances (about 10 m) and transmits small advertising packages. This latest technology became popular as an indoor positioning approach in 2014. The BLE beacon technology has several practical advantages over other indoor positioning approaches, because the beacons have long battery lives and are known for their low energy consumption and cost. The battery energy does not degrade usage for proximity detection and provides indoor positioning throughout an entire indoor environment. Previous researchers' use of BLE can be grouped into three different categories as follows.
First, floor and room type: Wang et al. (25) proposed a novel positioning method called IWKNN (isomap-based weighted KNN) to measure the distance of RSSI vectors from beacons. Liu and Liu (26) implemented a distributed system for collecting radio fingerprints by a mobile device using iBeacon and WiFi APs to identify the location. Alletto et al. (27) proposed an indoor location-aware system for an IoT-based smart museum using BLE signal strength and combined it with image recognition to provide contents related to the observed artwork. Similarly, Mainetti et al. (28) used the same devices and provided a tool for the implementation of location awareness, and Budina et al. (29) used a heat map to measure and locate different rooms. Thakkar et al. (30) developed an indoor position tracking system using a beacon and smartphone to identify the beacon with the minimum distance for five different rooms. Similarly, Yang et al. (31) proposed an intelligent in-room presence detection system to identify the location of the user (inside or outside of the room) from different positions of the user's smartphone. Yang et al. (32) presented an iBeacon-based indoor system for hospitals. The system was designed with a three-layer architecture, and the Floyd algorithm was used to recommend the nearest department in a hospital.
Second, zoning area type: Fard et al. (33) developed the indoor positioning of mobile devices with an agile iBeacon to identify the minimum distance among nine beacons for 18 locations on the second floor of a building. Lin et al. (34) proposed a localization method to estimate a patient's location using RSSI from 12 beacons and using two filters to select the nearest beacon. Ji et al. (15) developed an indoor location system using iBeacons with 18 zones, and the KNN (k = 2) algorithm and a decision tree were used for evaluation. Li et al. (35) applied the iBeacon model to identify the location of newborns in a hospital, where five beacons were used in comparing the performance between the cumulative distribution function (CDF) and the distance measure error (DME). Lee et al. (36) developed an indoor navigation system for automatic guided vehicles based on relative distance estimation. Frontoni et al. (37) proposed an analysis of human movement based on active beacons and AVM digital footprints. Posdorfer and Maalej (38) developed a context-aware system to identify the locations in a room with four levels (i.e., immediate, near, far, and unknown).
Third, distance and pedestrian type: Faragher and Harle (39) developed location fingerprinting with BLE beacons to compare six Wi-Fi fingerprinting and 19 BLE beacons. In another study using BLE, Rida et al. (40) designed and implemented an indoor location system based on Bluetooth signal strength. The beacons were placed every 6 m and used to identify the three nearest nodes with 12 locations. Liang and Krause (41) proposed a real-time indoor location tracking system to identify a patient's real-time location in a home environment, where the Kalman filter was used for noise reduction. Chen et al. (42) proposed an indoor location system that combined a smartphone and iBeacon to detect pedestrian steps and locations using a fusion algorithm.
The proposed method belongs to the third category. Moreover, it can handle a larger coverage area than the other methods of this type with a smaller number of beacons. In addition, the proposed method has a higher precision as it can pinpoint a position within an area of 1 × 1 m 2 (with three beacons), while previous methods could only identify a position within an area of 2 × 2 m 2 (with four beacons). Most of the previous researchers used a smartphone as a receiver, which could be obtrusive and inconvenient for the subject, for example, when taking a shower or sleeping.
For these reasons, we used a smartwatch as a receiver instead of a smartphone, and beacons were used as transmitters. Furthermore, we also investigated the potential minimum number of beacons. In addition, the potential locations of the beacons were compared. Finally, a proposed indoor positioning management function allowed the combination of the marked spots to define zoning areas as they were more informative.

System architecture
In this section, the requirements and functions of the system for indoor position detection are introduced, and user subject feedback is provided with several easy-to-understand visualizations.
An overview of the indoor positioning system is shown in Fig. 1. The smartwatch obtains RSSI data from three beacons and sends the data to the server via Wi-Fi to classify indoor positions. The system provides three key functions. First, an indoor positioning system and an algorithm used for indoor location detection are proposed. Second, easy-to-understand visualizations are proposed to illustrate subject positioning. Finally, a positioning management function lets the user position the beacons as desired. The Android Wear smartwatch application was developed to collect the RSSI signal strength levels from three beacons, and they were placed on the first-floor ceiling of a home. Machine learning techniques were used to create the indoor positioning model and classify positions in real time. The system provided summary reports to track users' behaviors, such as which areas they frequently spent time and for how long. Moreover, the system provided the users with many interface screens to manage the areas or zones such as the living room, kitchen, and bedroom.

Experimental setup
A two-story home was used for the indoor positioning experiment. The floor area was approximately 3.5 × 10.6 m 2 . The middle area was split into three partitions, each with a size of 1.17 × 3.5 m 2 in order to place the beacons. In our experiment, all beacons were placed on the first floor only. The first beacon was placed at the end of the first partition, the second beacon at the end of the second partition, and the last one on the opposite side in the middle of the second partition. All beacons were placed on the ceiling as shown in Fig. 2.  Grids were drawn on both floors with one cell equivalent to 1 × 1 m 2 as shown in Fig. 3. There were 30 marked spots for the first floor and 33 for the second floor. The different numbers of marked spots are due to the different areas of the floors (first floor: 10.5 × 3.5 m 2 and second floor: 12 × 3.5 m 2 ). The total number of marked spots in our experiment was 63.
A smartwatch was used to receive the BLE signal strength from the three beacons, and it was placed on the user's wrist, either on the left or right side, as shown in Fig. 4. The specifications of the smartwatch were as follows: brand name: Moto 360 Gen 1; processor: TI OMAP™ 3; memory: 4 GB internal storage + 512 MB RAM; connectivity: Bluetooth 4.0 Low Energy; operating system: Android Wear™. (43)

Process model
In this section, an integrative model for detecting an indoor position is described. The system is divided into five phases consisting of data collection, data preprocessing, data transformation, model evaluation, and indoor positioning classification, as shown in Fig. 5.

Data collection
BLE signal strength was obtained from the smartwatch for the entire area of the two-story home with 63 marked spots. The smartwatch was used as a receiver to collect the BLE signal strength, known as RSSI, from the three beacons installed on the first floor. The data was continually collected for 50 data points at each marked spot, which was repeated 10 times to create the classifier model. A total of 63 × 50 × 10 = 31500 data points were used for training and 63 × 50 × 3 = 9450 data points were used for testing, and the data underwent a normal data mining process. It was cleaned because of a few occurrences of missing data, which were caused by signal dropping and preprocessing before feature extraction. WEKA (44) software was used to train the data with four chosen algorithms, including decision tree (J48), random forest, naïve Bayes, and KNN (k = 3, 5, and 7) using 10-fold cross-validation. Subsequently, the performance characteristics of all classifiers were compared among these four algorithms, and the best one was selected for the real-time classification phase.

Data preprocessing
In data mining, the phase of preprocessing plays a crucial role, and the first concern is to check for outlier data, which was carried out. This second phase in Fig. 5 is important when dealing with different data scales. In this paper, the standard min-max normalization technique (45) was selected to convert raw BLE signal strength data into the range of [0, 1].

Data transformation
There is a relationship between the BLE signal strength and the distance from the receiver to the transmitter station: the shorter the distance, the stronger the signal. Moreover, the RSSI of the transmitter is always fluctuating because of environmental effects, resulting in an error in the obtained distance.
In this study, the noise from the beacons needed to be eliminated to make the data as smooth as possible. For the data smoothing technique, the basic techniques of three median values and their moving average values were combined. The three median values were obtained by arranging the set of data values in ascending and selecting the three middle values as shown in Fig. 6.
Here, D i is the data in the ith period and n is the number of periods in the moving average, which is set to 3 in our experiment. Noise reduction techniques were compared among four approaches: raw data, moving average, median, and hybrid noise reduction (combining three-median and moving average approaches). In Fig. 7, it is shown that the three-median method (hybrid approach) is the most robust and can eliminate the noise, making the data smoother than for the other three approaches.
Four algorithms were used for testing and evaluating the model: decision tree (J48), random forest, KNN (k = 3, 5, and 7) and naïve Bayes. Each of the four algorithms plus two more options of KNN has 10 models, making a total of 60 models.
Every model was trained with 31500 data points, as shown in Table 1, using 10-fold crossvalidation to select the best classifier model to use in real time. Moreover, the best classifier was tested with 9450 additional unseen data points to compare accuracy, precision, and recall among the model-evaluating methods.

Model evaluation
In this study, the indoor positioning detection was carried out in an offline phase. Moreover, every marked spot had an equal number of data points. Hence, accuracy, precision, and recall were used to evaluate each model to find the best classifier as shown in Eqs. (2)-(4). To evaluate the performance of a classifier model, it is necessary to select suitable metrics to measure the performance of the model. Researchers typically use a common set of metrics in the literature including i) accuracy, ii) precision, recall, and accuracy, iii) accuracy, specificity, and sensitivity, and iv) sensitivity and specificity. The results of a classifier are commonly stored in an array known as a confusion matrix. This allows the learning algorithm's performance to be visualized in a specific table, and the model's performance is evaluated using Eqs. (2)-(4). An example of a confusion matrix is depicted in Table 2.
The accuracy of the system is the most extensively used performance indicator in classification problems. It is defined as

TP TN accuracy TP FN FP TN
The recall or sensitivity, or true positive rate, is the ratio of the number of correctly classified positive instances to the total number of positive instances.
The precision or positive predicted value is the ratio of the number of correctly classified positive instances to the total number of instances classified as positives.  We not only evaluated the entire area but also compared the results for the first and second floors of the home. The number of beacons was considered when comparing arrangements of two beacons and three beacons. Moreover, for the arrangements of two beacons, the differences among the possible arrangements of the two beacons were compared as shown in Fig. 8.
The data were compared using various window sizes, and the results are shown in Table 3. These results show that the random forest model with a window size equal to 15 was the best model for indoor positioning testing in the entire home.
The same data set was separated between the first and second floors to ensure that the best model would be used to detect the indoor positioning in real time. Both floors were tested among the four algorithms plus two more options of KNN (a total of 60 models) and the same eight window sizes as before, and the results are shown in Table 4 for the first floor and in Table  5 for the second floor. The results show that the first floor achieved a slightly higher accuracy than the second floor, with the ten random forest models having the best result for each window size.
Among the four algorithms trained with 10-fold cross-validation, the best model is the random forest. It gave the best accuracy of indoor positioning detection with 95.37% [standard deviation (S.D.) = 0.045] for the entire home, 96.17% (S.D. = 0.063) for the first floor, and 95.24% (S.D. = 0.062) for the second floor.
In summary, the random forest model clearly had the highest accuracy for the entire house, first floor, and second floor. Consequently, it was used to build our model for classifying the indoor position in real time, as shown in phase 5 of Fig. 5.

Testing data collection
Three BLE signal strength data sets were collected from the three beacons with 63 marked spots in the same experimental environment as for training. The smartwatch was used as a receiver. At each marked spot, 50 data points were continuously collected, and this was carried out three times for the three beacons, providing a total of 63 × 50 × 3 = 9450 data points.

Location detection evaluation
The indoor positioning data of the 63 marked spots from the two-story home was collected, and then cleaned, preprocessed, and evaluated using the best model from the random forest algorithm, with the noise reduced by different window sizes. Each marked spot (L01-L63) was evaluated with three beacons, and an accuracy of 94.87% was obtained. In addition, with the best model from the random forest algorithm, our method achieved both sensitivity and specificity of about 0.95.
The marked spots on the first floor, second floor, and entire home (both floors) were comparatively evaluated with the same arrangement of the three beacons. The results are shown in Table 6. The first floor, where the three beacons were placed, had the highest accuracy of classification using the best model from the random forest algorithm with various window sizes, although the other accuracies were not significantly different.
To reduce the number of beacons, one beacon was removed, and the accuracies of only two beacons were compared for three different arrangements: stations B1 and B2, stations B1 and B3, and stations B2 and B3, as shown in Fig. 9.
The results of our experiment showed that the different arrangements of the two beacons were not significantly different in terms of accuracy as shown in Table 7, although the accuracy of any two-beacon arrangement was about 20% less than that of the three-beacon arrangement.
Our final comparison experiment was a comparison of indoor positioning detection accuracy between the marked spots and the zoning areas. In real life, the caregiver would want to know the whereabouts of the human subject in terms of zones such as the living room, bathroom, kitchen, or bedroom. Therefore, in our experiment, the home environment was separated into seven areas. The The results showed that, with the raw data (window size of 1) and the window size of 3, there was a large difference in accuracy between marked spot detection and zoning area detection; however, for window sizes of more than 3, the accuracy gap decreases and is less than 1% when the window size is 15 as shown in Table 8 and Fig. 10. There have been several indoor localization methods proposed with applications and services using beacon devices. Our experiment was compared with other works in terms of the number of beacons, the transmitting device, the type of detection, and the accuracy as shown in Table 9.
The noise reduction techniques with a window size of 15 used in the proposed method achieved high accuracies (94.87% for the marked spots and 96.58% for the zoning areas) while using only three beacons. Moreover, a data mining technique was applied with four algorithms to test the classifiers and select the best model. On the other hand, none of the previous similar works applied different window sizes or noise reduction techniques to remove data fluctuations to improve accuracy.

Indoor positioning visualization
In the proposed system, real-time indoor positioning feedback and easy-to-understand summary visualization are provided as shown in Figs. [11][12][13]. Historical data of the indoor positioning is also provided. The system works by counting the amount of time (in minutes) of each indoor position to monitor the frequencies and positions of the user at home. The system allows the user to easily manage the zoning areas. For example, the user might want to combine the marked spots L01-L10 as the living room, L11-L20 as the dining room, and L21-L25 as the kitchen.
The number of beacons used and their locations can be adjusted, depending on the user's needs. The system provides a screen for monitoring the user's behaviors and times spent in certain areas with various display options, such as minute, hour, day, week, and month as shown in Fig. 12. Table 9 Comparison between the proposed system and similar systems presented in the literature. Ref.

Receiver
Transmitter    Furthermore, the system provides a screen for the user to manage the number of beacons and group the locations into zoning areas to reduce cost and improve personalization. For example, the user might want to use two beacons, e.g., B1 and B2, B1 and B3, or B2 and B3. The system maps the classifier model with the user's requirements for classification in real-time use.

Conclusion and Future Work
In this paper, a practical and affordable indoor positioning system is proposed by combining beacons and a smartwatch, which provides a convenient and unobtrusive service for users. Data mining techniques were applied to build the model and examine the indoor positioning of the smartwatch's wearer. Different numbers of beacons and window sizes of the data were compared in terms of accuracy to reduce the number of beacons required and thus reduce the cost of the system. The system was evaluated for an entire home, the first floor only, and the second floor only with the same number and positions of beacons. Moreover, the system was developed with real-time visualizations to track indoor positions, monitor subject behaviors, and issue a summary report. Finally, several visualizations were introduced showing an informative timeline of the user's locations and behaviors at home. The achieved accuracy rate of the indoor positioning was 94.87% and the recall and precision were 0.95.
We plan to use this monitoring system for elderly people or others who may live alone to monitor their behaviors and movement areas while at home so that we can learn more about them. Furthermore, the system could be extended for use in hospitals, nursing homes, and healthcare centers. The obtained information is useful for caregivers such as family members, healthcare professionals, and doctors, especially in an aging society.