Design and Implementation of a Wireless System to Locate a User in Indoor Environments

Indoor positioning, Localization, positioning, RSS, Wireless, Wi-Fi. The technology of indoor positioning has pulled in the consideration of researchers the expanding capability of smartphones and the advancement of sensor innovation, alongside the increase the time people spend working inside the building or being indoors. Sensor innovation, which is one of the most generally utilized information hotspots for indoor setting, has a favorable position that sensors can receive information from a cell phone without introducing any additional device. The idea of the proposed system is to use the Wi-Fi access points, inside the building, together with a Smartphone Wi-Fi sensor which lets the building administrator locate those carrying smartphones, wherever they exist inside the building. The proposed system consists of two-stage the testing stage (or preparation phase) and, the second stage is the training stage (or positioning phase). The data is collected and selected for accurate readings; a router is used, which is the Mikrotik access point type from which we can read the RSS value. The RSS value represents the Wi-Fi signal strength of the target device. The proposed IPS detection system is independent and can work in unconstrained environments. The database used to measure the performance of the proposed IPS detection system is collected from 14 locations (different in size). The number of readings obtained from the collected database is 1199 readings consist of received signal strength value from five access points. The proposed IPS accuracy is 96.8595% and the mean error is about 1.2 meters are achieved when using, KNearest Neighbor (K-NN), used the classifier to make a decision in the last stage of IPS. The K-NN classifier was built by FPGA Model using Xilinx system generator and implemented on Spartan-3A 700 A Kit. How to cite this article A. A. Kareem, W. H. Ali, and M. H. Jasim, “Design and Implementation of a Wireless System to Locate a User in Indoor Environments,” Engineering and Technology Journal, Vol. 38, Part A, No. 1, pp. 1-7, 2020. DOI: https://doi.org/10.30684/etj.v38i11A.1592 Engineering and Technology Journal Vol. 38, Part A (2020), No. 11, Pages 1640-1651 1641


INTRODUCTION
In recent years, Internet networks have been speedily developed where many alternative extended services have shown up. Furthermore, the widespread deployment of mobile devices networks has led to increased demand for indoor positioning systems that have been prevailing all around the world; they do not rely only on communication but also provide assistance and facilities in many daily tasks [1]. In general, one is able to divide the positioning technologies into outdoor positioning and indoor positioning systems. In outdoor environments, they have been widely used for navigation Global Navigation Satellite System (GNSS), (e.g. Global Positioning System (GPS)). However, in indoor environments, the wireless system has been widely used (e.g. Wi-Fi Positioning System) for navigation. Due to that, Wi-Fi is operated to be used for indoor navigation because nowadays it is being used everywhere to provide access to the Internet [2]. Indoor positioning services have seen significant growth in the past decade, with the proliferation use of mobile phones and the Internet. A recent survey by Pew Research Center's Internet Project found that 74% of adult smartphone owners, aged 18 and older, use their phone to get directions or other information based on their current location [3]. IPS technology, for user and device, has wide-scale applications in the health sector, building management, industry; police the investigation, disaster management, and a variety of assorted different sectors, as shown in Figure 1. It can also benefit several novel systems, like the Internet of Things (IoT) [4], and smart architectures. In general, many different types of signals are used for indoor positioning. Indoor positioning technologies often use Wi-Fi, Bluetooth Low Energy (BLE), RFID, ZigBee, and Image. Some of these technologies are not widely used due to the main disadvantage of these methods which is the demand for special equipment to obtain the location, such as ZigBee Sensor Node and RFID Tag and other less accessible equipment; because it is more expensive [1]. For many of these applications, time response and accuracy are key necessities, and because of the presence of refractive surfaces, and interfering technologies, achieving the specified levels of performance may be difficult in an indoor environment. The problem with these environments needs to be studied and furthermore, to allow the same development of position-based applications as has already occurred for outdoor environments [5]. Indoor positioning services have widely used Wi-Fi, many companies and customers have begun to pay attention to their related applications [6]. Wi-Fi-based indoor positioning environments, there are many measuring approaches in which the parameter is positioning dependent, such as, received signal strength (RSS) which can be obtained from the Wi-Fi access points, being the most commonly used approach in the positioning-based parameter. They are usually reported as a number in (dB and dBm) by wireless device drivers. RSS measures the typical signal power at the receiver and depends on the transmission power at the sender and also the attenuation within the channel [7], [8]. Thus, the high detection positioning accuracy of the indoor position is the major focus of this work. This accuracy can be accomplished by building an integrated work mechanism.
The scope of this paper is limited to Wi-Fi localization technology and its application in an indoor location-based service. Explains the implementation of the IPS Detection system in hardware and experimental results using the Xilinx Spartan-3A DSP 3400A FPGA kit.

LITERATURE REVIEW
No particular way exists that can be considered as a global guide to indoor positioning. Several studies have been conducted in the field of indoor positioning. Some of these studies, in this section, will only be those that researchers have focused on and that have reasonable accuracy. Thomas V., 2017 [2] developed the Indoor Positioning System (IPS) based on a novel execution utilizing a modified (WKNN) algorithm with prior Spearman's Rank Correlation Coefficient (SRCC) calculation. The proposed situating calculation likewise considers the number of signs being overlooked during restriction. Along these lines, untrustworthy outcomes smaller affect the final result. The proposed system consists of two parts: an Android smartphone application and a web server provided with the proposed algorithm written in Erlang. The proposed IPS achieves an exceptional accuracy with an average positioning error of approximately 80 cm. Ahed A., Tat Ch., 2012 [9] proposed an indoor positioning algorithm, WBI based on Wi-Fi (RSS) technology in conjugation with trilateration techniques, corrects for non-line-of-sight propagation effects on positioning errors using Kalman filtering. The proposed algorithm achieves 2.62m of accuracy as the mean error of estimation for seven APs, which is good compared to the LSE-DLE and the LSE. The 6th and 7th floor in the school of Computer Sciences building in University Sains Malaysia (USM) was used. Yungeun K., et al, 2012 [10] proposed an internal pedestrian tracking system based on the smartphone; it also investigated a different aspect of the RSS variation problem when using smartphones. The proposed system is accurate but has a low incidence problem. They have compensated by integrating the system with the PDR. The test environment was an office building, which was 50 m by 50 m and had 19 APs marked with circles. To evaluate the performance of the proposed system (PWF+PDR), the system was compared with three different systems: (KNN+PDR), (KNN-MC+PDR), and (HLF + PDR). PDR provided good results compared with other algorithms. The average error distance of PWF+PDR is 2.4 m. Lina Ch., et al, 2013 [11]. A proposed new algorithm based on a double-peak Gaussian distribution. The Kurtosis testing is used to determine if this new distribution, or the normal Gaussian distribution, should be applied. The test area was a forty-five square meter office room. The conventional KWNN was used to estimate the position of the TPs. The average error distance was 1.36m. Manikanta K., et al, 2015 [12] presented the design and implementation of SpotFi, an accurate indoor localization system that can be deployed on commodity Wi-Fi infrastructure. This system was used in an indoor office environment with an area of roughly 15 × 10 sq.m and deployed six APs to span the area. The SpotFi achieves a median accuracy of 40 cm and is robust to indoor hindrances, such as obstacles and multipath. Han Z., et al, 2015 [13] suggested an algorithm for indoor positioning relies on an online sequential extreme learning machine (OS-ELM). The testbed is the IoT Laboratory of School of Electrical and Electronic Engineering, Nanyang Technological University. The size of the test-bed is approximately 400 m2 (20 m × 20 m) and deployed four APs. The proposed localization algorithm achieves an accuracy of 1.794m. Bianca B., Marian A., 2015 [14] proposed an application that describes the Wi-Fi trilateration method for indoor positioning using Android-based mobile devices. The results were taken in the K Building, Transylvania University of Brasov, Electronics and Computers Department. Three Wi-Fi Access Points were used. The accuracy in the positioning of Wi-Fi indoor positioning using the trilateration method is around 2-2.5 m. Xuyu W. et al, 2016 [15] examined several aspects of location fingerprinting based indoor positioning that affects positioning accuracy. The impacts of human behavior on RSSI distribution are explored and analyzed. The experiments were performed on the third floor of the School of Engineering, Eastern International University, Vietnam. An area of 7m by 10m was used for the experiment Overall, the positioning accuracy achieved is 2.0 to 2.5 meters. Yohanes E. and Suyoto, P.,2018 [16] proposed a system combined RSS fingerprint method with KNN method, to get maximum result in the process of location recognition that the mobilebased (CAPTURE) wireless positioning system can recognize the indoors location properly by using the wireless 802.11b/g technology.

MAIN PARTS OF THE PROPOSED SYSTEM
The fundamental basic piece of the indoor situating framework is the situating task which is the way toward finding the target at a specific spot inside the building. Before completely talking about and investigating the proposed framework instrument, an outline of the entire frame structure and the necessary parts are first exhibited. Figure 2, shows the principle segments that take an interest in the general framework structure.

THE PROPOSED INDOOR POSITIONING SYSTEM
The mechanism of this work illustrated in Figure 3. This figure describes the proposed system consists of two phases: the testing phase and the training phase.

I.
Testing stage The proposed framework utilizes Wi-Fi fingerprinting procedure for finding the target position, in this work used the third floor as the experiment area. This procedure requires making a database that contains RSS of identified Wi-Fi APs at each position on the third floor. The project is carried out at the University of Technology in the Electric and Electronic Engineering building in Baghdad. In particular, only the third floor will be used, and to make sure the prototype will work in a relatively small area. The data and software being used will be dependent on the target area. The steps below describe the functionality of the testing phase: a) The first stage of the system design is a distribution of routers in the required places from the Experimental Area, five MikroTik Access Points (AP) are distributed on the third floor of Electrical and Electronic Engineering buildings, as illustrated in Figure 4. Because the area of the Third floor of electrical and electronic engineering buildings is not so large, it is about 138m × 20m, therefore the density of equipped access points here is considered to be good for our experiments. c) The administrator based on smartphone passes through the whole third floor regions as illustrated in Figure 5, the wireless signal strength is measured from the Access Points. Each Access Point has a distinct MAC address and features only one wireless ID. The fundamental factors for processing data include SSID name, MAC address, RSSI value, record the MAC addresses of the building access point, and except all the access points that are recognized and do not behold to the building.  Covering a single router is about 36 meters, but when we deploy the router, we assume that the router covers only 25 meters to ensure that all the experiment area is detected, and signals are better covered. Figure 6, illustrates the coverage of all routers and places where the coverage is in the best case where the coverage progresses to the worse as we move away from the router and increase the area; the blue color shows the best coverage, with either green is good and brown is OK and so on until the signal fades.
f) All the datasets are taken at the real environments without any specific factors and the presence of students and staff in the halls and corridors and during the closure of the door they took at different times of the day in the morning time from 9 am to 3 pm.
g) The period of data collection is from 12/2/2019 to 12/3/2019 and collected the data 3 or 4 days in a week. Thus the total number of collected days is 16.  Table I.

II.
Training Phase This is the most important stage in which the system is the last stage is positioning the person (Classification) which is used to locate the person based on RSS extracted from the previous stage. Various classification algorithms are suggested KNN classifier is chosen. The KNN algorithm is an easy-to-use machine learning algorithm and is widely applied in indoor positioning systems because of its simplicity and high performance. The algorithm calculates the position based on the distance between the reference fingerprint and the fingerprints in the database. Various formulas can be used for distance calculation, e.g.: Manhattan distance or Euclidean Distance. It finds the K best matching fingerprints based on their mutual distance and calculates the position as the average of the positions of these K fingerprints as shown in Figure 7. Eq. (1) can be given for the Euclidean distance calculation method [17].

1) Positioning System Based on K -Nearest Neighbor (KNN) Classifier
In this work, the KNN classifier used to detect target location in fourteen positions based on the received signal strength that was taken from five routers. In this work, k=1 is chosen this mean KNN classifier to choose one minimum distance to make a decision. The highest detection rate was achieved when using the K-NN classifier. The overall success rate of the indoor detection system using K-NN into fourteen-class classification is 96.86% and the mean error is about 1.2 meters.

2) IPS Hardware Implementation
K-NN classifier is easy to be implemented in hardware that requires only a simple digital logic circuit and memory. This Chapter presents the FPGA implementation of IPS to identify a person's location using a K-NN classifier. The K-NN classifier is built as subsystems using the Xilinx block set from the System Generator in Matlab Simulink. This tool can provide a high-level abstraction, which is compiled automatically into a hardware device within MATLAB Simulink. Additionally, System Generator simulation is faster than the traditional VHDL simulator. The essential features of the DSP System Generator are molding and hardware simulation. In the DSP modeling, building and debugging a high-performance system using the Xilinx block set in the Matlab Simulink, which involves many functions for arithmetic, error corrections, memories, and digital logic, in addition to creating the simulation target (e.g., FPGA in a loop). The system supports JTAG and Ethernet connection between Matlab Simulink and the hardware platform. In this paper, a Spartan-3A DSP 3400A is used to implement the Indoor positioning system. One of the most challenging in the hardware-implemented of the IPS is a large amount of data due to it require a higher hardware platform implementation. To make the system can work with a large number of the input data as a vector. Each input vector will be divided into three and two features and stored them separately in the ROM memories.

3) Hardware Design of the Proposed System Using K-NN Classifier
This classifier can be implemented on the Spartan-3A DSP 3400A kit which is needed an only a simple arithmetic operation to compute the Manhattan distance between the test vector and all the features vector in the training set and memory(ROM) to store a training features. However, the problem in the implementation of the K-NN classifier is that it requires a large memory size to store all the training features. To overcome this problem, two ROMs will be used in the designing of the proposed system because of the training set containing 594 feature vector and each feature vector contain five readings. These readings represent the RSS value at this point in each router. The indoor positioning K-NN classifier is implemented using a Xilinx block set of the DSP System Generator in the MATLAB Simulink as shown in Figure9.

Figure 9: Xilinx System Generator Implementation of K-NN classifier
The proposed system read the input vector, which consisting of five features from the MATLAB workspace (F). In this work, 9 bits with a 0 bit binary fixed-point unsigned numbers are used to represent each feature by using Xilinx Gateway in the block. After that, the features of the tested vector are presented at the input of the two subsystems (subsystem I, subsystem II,) as shown in Figure9. All of these subsystems consist of ROM memory to subsystem I store first three training features while subsystem II store the remaining two vectors with 594 vector locations and simple arithmetic operations for each one to compute the distance between these features of the unknown tested vector all these features of the stored training vectors, the ROM with size 594×27 is supplied by an address from In4 port which is connected to counter as shown in Figure 9. This counter is used to provide the address of all stored features sequentially in order to calculate the Manhattan distance of the input vector with the stored training vectors the distance has been computed between the nine features of the input vector and all stored feature vectors of the training set by summing the output for each subsystem. The values of the calculated distances that produce from (AddSub1) block are compared with the initial larger value that it is stored in a Register block to evaluate the minimum distance using Xilinx arithmetic relational operator (Relational) block. A second register (Register1) block is used for storing the location of the training vector, which has the smallest distance to be assigned to its class since the class number of each training vector is stored in the ROM memory block as shown in Figure 9.
The arithmetic Relational (Relational 1) block is used as the enable to the address of the ROM memory to assign the class of the input vector if and only if all of the 594 training vectors are entirely compared with a target. Figure 10, described the whole simulation behavior of the proposed indoor positioning system.

Figure 10: Simulation behavior of the proposed system
When the features are received at the input, the signal (clock) will be high. The K-NN classifier performs the indoor positioning in the 594 clocks and sets the class to indoor positioning output. The output signal is fed into the Display block to show the value of the location of the target output, as illustrated in Table II.  The MATLAB used Hardware Co-simulation of the system generator to incorporate the proposed system design in the FPGA immediately into the Simulink simulation. When the simulation is running, the hardware Co-simulation will be loaded into Xilinx block set's system design in the SPARTAN-3A DSP 3400A platform to configure it. Figure 11, shows the configuration device via Ethernet cable. The synthesis tool of Xilinx System Generator is used to estimate Xilinx device utilization and performance is XST. This tool also provides a report on the power and timing consumption of the proposed IPS design as illustrated in a table III.

TABLE III:
Device utilization summary of the proposed IPS detection system based on the K-NN classifier Table 3 shows the device utilization summary of the proposed system based on the K-NN classifier. The proposed system takes only 35 from available occupied slice Flip Flops which is less than 1% of Spartan-3A 700A, where the number of input/output pins is 51 that represent only 10% of the available input/output pins, as well as only 281 of 4 input Lock-Up-Tables (LUTs) used which represent less than 1% of the hardware platform. The maximum frequency allowed for K-NN is 46.013MHz. Furthermore, the minimum periodic time for each clock is 21.733 ns, making the requiring time for the K-NN classifier to complete the classification process of the positioning detection successfully from a target location is 12.9094 µs to finish classification of one input feature vector.

COMPARISON OF THE PROPOSED INDOOR POSITIONING SYSTEM PERFORMANCE WITH PREVIOUS APPROACHES
It is very difficult to make a reliable comparison with other systems when these measurements are not done in exactly the same circumstances. Although based on published results from research papers, an approach of the accuracy comparison can be made. Table 4, shows this overview, displaying the mean error for the algorithm and Probability of correct classification (Pcc). Their experiment involves localization at 14 unknown locations. The proposed IPS detection is an improvement in accuracy under a naturalistic environment. The features are used as the input of the different classifiers to identify the position of the person or device. The highest recognition rate of the position was obtained when the indoor positioning is identified using the K-NN classifier. Compared to the performance of the IPS using K-NN classifier with other positioning systems investigated by other researchers is shown in Table II. Therefore; the comparison will be based on the overall performance of the positioning system. The specific parameters used in this comparison are the number of the access points, number of RSS used at the adopted database by each approach, size of the locations, type of the classifier, and the number of classified positions classes as demonstrated in Table IV. The proposed classifier in this work has a higher success rate than other classifiers in previous research. Knowing that the number of training and testing sets used in the suggested IPS systems are greater than other data sets used by previous approaches. Moreover, the proposed indoor positioning system is less complex and easy to implement in hardware.

CONCLUSIONS
Automatic identification of indoor positioning for persons is growing quickly with it is applications. In this study, fourteen locations are considered and the experiment is selected according to the important locations. The proposed system detects the target location for all the experimental area (fourteen locations) based on analyzing the Wi-Fi fingerprinting signals efficiently. To evaluate the proposed system performance, a new database is collected from 14 locations with different areas of space including five routers. These routers are distributed in places where people are frequently present (Laboratories, classrooms, the presidency of branches and attachments, department head and attachments, and corridor.). With this distribution, almost all the area of the experiment was covered to be utilized in the indoor positioning system. Simple hardware requirements for implementing the proposed classifier that has a perfect performance (KNN) on the FPGA platform are represented, using the Spartan-3A DSP 3400A kit. This classifier requires only memory to store the training samples and some combinational logic circuits for the arithmetic operation to calculate the Manhattan distances. The experimental hardware result shows that the IPS detection system has an impressive performance; therefore, this result is the same as simulation results and the mean error is about 1.2 meters.