Monitoring Human Movement in Building Using Bluetooth Low Energy

In recent years, smartphones have become more popular. Along with the increasing number of smartphone users, more features are requested by the users which can be used to solve their daily life problems. One of the most popular applications is related to location-based detection. Almost all smartphones have a feature of Global Positioning System (GPS). It can help users to go from one place to another place without getting lost by connecting to Google Map. However, there are some limitations to the GPS. When the GPS is used inside a building, it is difficult to search where the users are located, on which floor or room they are, and how to access the room inside the building. It is because GPS cannot show the user which level or room location the users are currently at. One of the possible solutions is using an Indoor Positioning System (IPS) which can detect an object or person inside a building by producing some signals that can be received by smartphones. This research aims to develop an application to monitor the movement of humans inside a building with low cost and low energy by using Android smartphones as the medium. It can get the coordinate of location by using Bluetooth Low Energy (BLE) beacon inside the building. It can also be used to detect multiple users in the same room.

Abstract-In recent years, smartphones have become more popular. Along with the increasing number of smartphone users, more features are requested by the users which can be used to solve their daily life problems. One of the most popular applications is related to location-based detection. Almost all smartphones have a feature of Global Positioning System (GPS). It can help users to go from one place to another place without getting lost by connecting to Google Map. However, there are some limitations to the GPS. When the GPS is used inside a building, it is difficult to search where the users are located, on which floor or room they are, and how to access the room inside the building. It is because GPS cannot show the user which level or room location the users are currently at. One of the possible solutions is using an Indoor Positioning System (IPS) which can detect an object or person inside a building by producing some signals that can be received by smartphones. This research aims to develop an application to monitor the movement of humans inside a building with low cost and low energy by using Android smartphones as the medium. It can get the coordinate of location by using Bluetooth Low Energy (BLE) beacon inside the building. It can also be used to detect multiple users in the same room.

I. INTRODUCTION
I NDOOR Positioning System (IPS) is one of the techniques to calculate the position of a person or an object inside a building. As a replacement of satellites, it uses nearby nodes to provide location information for the device to sense [1,2]. There are several options of IPS techniques used such as Bluetooth Low Energy (BLE), Infrared (IR), WIFI-based Positioning System (WPS), Radio Frequency Identification (RFID), and Ultra Wide Band (UWB) [3,4]. However, there are some challenges of using IPS which can obstruct the spreading of signals. For example, those are walls, floors, motions of people, and objects inside the room. Received Those can cause several paths in getting signals [5]. This research focuses on BLE.
To estimate and track locations, the researchers can use the Received Signal Strength Indicator (RSSI) for getting a periodic broadcasted signal emitted by the BLE beacon. When the signal transmitted is known, RSSI can be measured to estimate the path loss and get the estimated distance between sender and receiver [6,7]. When deploying the technology of IPS, some factors need to be considered such as the placement of the transmitters, RSSI analysis, and receivers [8,9].
To achieve the accurate data, the placement of the beacon should be in the specific location. The location can be categorized as immediate, near, and far. In the immediate location, the range is approximately not less than 3 meters. Near location is between 3 to 6 meters. The far location is more than 6 meters. When placing the beacon, the height of the beacon is between 1.2 meters and 2 meters above the floor for getting an accurate estimation signal. To estimate the location of the message that has been received, there are methods such as trilateral and triangular. In this research, the trilateral method is used. The techniques are used by getting minimal three nodes of different signal circle meeting points. Those have the specific distance in each outer circle of meeting points [10][11][12]. By getting the signal of RSSI sent by the beacon, the researchers calculate it by using trilateral to improve the estimated location and combining it with the Kalman filter for more accurate calculation of the distance between the receiver and the beacon [13,14]. Kalman filter is a filter method to estimate and increase the accuracy of an output sensor although there is some noises which can disturb/obstruct the signals. Kalman filter is also used to smoothen the noise data variable and estimate unknown variables. With the estimation of existing coordinate, they can reduce errors from a real distance and the estimated distance by using trilateral methods.
There are several studies related to IPS. According  to Ref. [15], in the location with noise, there is no application filtering in the noise reduction to improve the data accuracy. Reference [16] got more accurate data by applying the Kalman filtering method. In this research, there is no output for tracking the users' move from one coordinate to another coordinate. It means that the coordinate has been specified in one place and calculated by using the Kalman filter. According to Ref. [17], the accuracy of movement tracking from one coordinate to another coordinate is already good. However, there is no application of filtering methods in this research to improve the estimation accuracy. From this case, the research to improve the efficiency of the distance estimation by combining the method triangulation or trilateral with several methods of filtering is needed. However, there is no research to give the visual not only for the user but also for the admin in using the IPS. Almost all researchers focus on the users and how the users move from one coordinate to another. The example of developing of IPS application is it can be used in a shopping mall to retrace the movement of missing child.
Another example is when a company traces the annual activities of its employees. Then, the data obtained can consider the employees' productivity and the adherence to the rules. This research combines the technique of trilateral and Kalman filter method in creating an application to give the admin visual monitoring when users are using the application inside a building.

A. Analyzing the Characteristics of Beacon
In this step, how the beacon measures the estimated distance in real miles is studied. Beacon's characteristics are obtained by using the comparison between actual distances among beacons. The characteristics are used for the analysis for measuring the results of the designed scenario. Information from the beacon can be seen in Table I and the characteristics of the beacon are  presented in Table II. From Table I, the major is used for numbering, and the minor is grouping. Universally Unique Identifier (UUID) is the factory product beacon code. Table II indicates the calculation of estimated distances by using the known RSSI values. The estimation is calculated by where T x is a constant power of beacon, RSSI is a signal beacon, N is a continual path losing environment: the proximity of '1' means immediate; '2' means near, and '3' means far. Then, a constant path losing environment can be obtained from the static table in  Table III.

B. Server Preparation for the Location-Based Handler
In this research, a database of MSSQL Server 2012 is used to store the value of distance calculation. It contains the table and fields of:   The server side uses socketing for the handler. It can maintain two or more applications in the communication repeatedly by using a TCP connection in a network environment. Preview of the snippet code of the server is presented in Fig. 1.
The code in Fig. 1 is used for handling the server backside. It is for handling the update Graphical User Interface (GUI) application by sending a flag of updateGUIAdmin() to the application for running update of GUI admin.
Then, updateDatabaseValue() and getDatabseValue() are used for handling the setter and getter from database. Next, checkOpenSession() and checkCloseSession() are used for handling the flag of connection which is connected to the server

C. Coordinate and Location Mapping
There are two locations used for the mapping. The first location is the empty room with a size of 4.0 m × 4.5 m. The second location is a one-floor position having several rooms with a size of 20.0 m × 30.0 m.

D. Determining the Beacon Placement on the Specific Coordinate
The beacon placement is specified in the location. For acquiring the excellent accuracy, the researchers use the research by Ref. [8] regarding the coordinate location of beacon placement in Fig. 2 . The position of the beacon has been tested. The signal inside the room is wholly covered to give an exact calculation of the estimated location. The detail coordinate in Fig. 2 is presented in Table IV for beacon coordinate  and Table V for smartphone coordinate. Moreover, the     information such as RSSI, beacon coordinate, and pinpoints from the mobile device. Those are used to determine the locations of the three closest beacons. After the mobile device receives the necessary information, the information is submitted to the trilateral calculation method. Then, this information is recalculated to get actual mobile device coordinates. After getting the calculation results from the mobile device, the results of the calculation will be given to the Kalman filter to filter the process and get better results for the existing coordination. The results of the Kalman filtering value are in the form of x, y, and Kalman Gain. Those will be sent to the server section.
The server section will continuously request value from the users' mobile device to continue the value transfer to the admin of GUI and database sections. After getting the value from the Kalman filter, the amount will be directly submitted to the database and GUI asynchronously. It changes depending on where the value is sent. In the database section, the database will update the value in each column. Meanwhile, the GUI will change the appearance of the canvas by redrawing the position in the GUI display.
The Kalman filter will calculate the method. The method will ask for the available Kalman Gain value. When the process tries to request this value, the process will work to access the server whether the data value is possible or not. If the value does not exist, the server will retrieve the last value of Kalman Gain from the database and return it to the Kalman filter. If the database does not have Kalman Gain value, the Kalman filter will recalculate the amount of the Kalman Gain value.

A. Test Results of the Application
Data are taken continuously when the mobile device is turned on. In this research, data are processed in a closed room when the user is circling the room from the standing position.
The retrieval of the distance data is performed ten times from each beacon. After the successful data collection, the average distance is made to obtain a more accurate distance result. Because the data retrieval from RSSI will continuously change even the users have moved or not, this will cause blinking in the application of GUI display. The observation of pattern movements in each floor plan is presented in Figs. 5 and 6. The output sample from the GUI user and admin describes how the user login works. It can be seen in Fig. 7. Figure 8 shows the example of the output from the calculation of the movement. It is in a 4.0 m × 4.5 m room carried out by the movement according to the predetermined flow.

B. Systematic Application Work
There are several steps of the systematic application works.
1) User and admin login. Figure 9 indicates that when the application starts running, the application will ask the user and admin to enter the username and password so that they can continue to the next application page.  of the coordinates and the GUI display will be user and admin. Figure 10 shows the GUI user and admin workflow. Then, Fig. 11 illustrates when the user has successfully logged in and entered the primary menu display. The app will track the three nearest RSSI and display the first coordinate point after calculating the trilateral. Through the Kalman filter, the application will draw the coordinate points on the application canvas and show it on the application. At the same time, the application will inform the server that there is a change in the display. It will call the method on the server to check whether the change has occurred or not. If there is a change, the server will pull the data changes from the application to the server and update  Figure 12 indicates the data retrieval from the beacon to the application. The change to the admin view is similar to previous steps. The difference is that the first testing room is an empty room. The second testing room is one floor with obstacles.
Cite this article as: J. Hoa and B. Soewito, "Monitoring Human Movement in Building Using Bluetooth Low Energy", CommIT (Communication & Information Technology) Journal 12(2), 125-133, 2018.  The distance of the coordinates on one-floor using six beacons has already been assigned. Because the mapping of the room is rather extensive, it uses more beacons than the first test. If the distance from one beacon to another beacon is more than 3-5 m, the accuracy of the analysis will decrease. In this test, the user will stand at the location   the users can see the coordinates of the beacon distance from themselves. Then, it can be accessed via the menu settings. In this menu, three types of captured beacons by mobile devices can be seen. In the display, several fields indicate the description of the beacon. For example, Beacon Cx is a unique beacon name for each detected beacon which the x constant value of C x are 1, 2, . . .. Moreover, power is a static unit of measure caught by a mobile device thrown from a beacon. Minor is grouping number, and major is beacon number. Then, RSSI is the signal captured depending on

C. Analytical Results
The results of the calculation in the room of 4.0 m× 4.5 m is presented in Table VII. Based on Table VII, the experiments using the Kalman filter produce better accuracy than the measurement results from the trilateral. In the second and third experiments at the equal smartphone-equal It shows that 'i' is a coordinate estimation of x and y. Then, d is distance calculated from RSSI estimate. Moreover, x 1 , x 2 , x 3 are the coordinate of real x beacon, and y 1 , y 2 , y 3 is the coordinate of real y beacon. The distance of the beacon is obtained from the average calculation RSSI distance by counting the data ten times from each beacon to get more accurate distance data.
The formula calculation of the Kalman filter for getting the result is in Eqs. (3)- (7). It can be seen as follows:   where, x − t , x t−1 are previous coordinate calculations; p − t , p t−1 are the calculation of coordinate which contains noise, p t is the new calculation of noise, and k t is the optimal Kalman Gain.
This formula can calculate the accurate distance by following Fig. 16. The D (real distance) is the value from x, y, and D ′ (estimate distance) is the value from x ′ , y ′ . Then, the accuracy distance can be calculated by Eq. (8).
The results of the calculation of how many times the user moves are presented in Table VIII.
It can be concluded that the slower the user goes, the more accurate it will be. However, the used speed to move cannot be too slow. So, the reasonable pace is on the fourth and fifth experiments to get optimal results.
Based on Table IX, it can be concluded that the measurement results are the same as the measurements that occur in a floor mapping. It has a certain speed not to lose the calculation on a trip at a particular rate.
IV. CONCLUSION There are conclusions based on the results. First, when a user performs an activity, sometimes the user will experience a calculation error of the movement. At that time, when redrawing the GUI, the user will look like a blink (flashing). If the user is moving too fast, it will cause miscalculating in the coordinate. If it is too slow, there will be double calculating of coordinate (duplication).
Second, the placement of beacons in a room must not be more than 3-5 m from the distance of the previous beacon. If it exceeds the specified range, the RSSI captured from the device will be an error. It results in a messy or unclear coordinate calculation of the distance obtained from the beacon.
Third, the experiment uses five people. The system application can detect the people in the experiment accurately. The application detection is based on the mapping room. Thus, the application can only detect the multiple users in the same room when the application starts running.