Scientific Research

An Academic Publisher

**An Application of Kalman Filtering and Artificial Neural Network with K-NN Position Detection Technique** ()

Share and Cite:

*Wireless Sensor Network*,

**9**, 239-249. doi: 10.4236/wsn.2017.98013.

1. Introduction

In recent years, researchers have used RFID technology in location detection. This technology consists of wireless sensor nodes (WSN). Object locations are determined by employing EM signal strengths to/from WSNs in both indoors and outdoors. RFID systems have a rich data capacity, non-contact features, repetitive ability and durability. There are many active RFID systems discussed in the literature [1] [2] to determine the object locations. Two major methods are generally deployed in localization. One uses the mathematical modelling of the wireless channel [3] . The other one uses the fingerprinting method [4] .

In the first one, various EM signal parameters are measured such as angle of arrival (AOA), time of arrival (TOA) and time difference of arrival (TDOA). A propagation channel is generated based on these parameters and the object position is determined [5] [6] .

In the second one, signal characteristics are different at different locations across the region of interest. Hence a different signal signature or fingerprint is generated at each location [7] . This recorded fingerprint is stored in a fingerprint database. Elements of the database are compared with the object fingerprint by using pattern matching algorithms to provide an estimate of object location.

These two approaches have several problems such as multipath propagation, fading and variations in signal profile over time [8] . These approaches generate errors in object’s location. In this study, Kalman filtering [9] [10] is employed to reduce the initial RSS variations which are introduced due to environmental effects. A more stable and less object coordinate variation will be obtained with Kalman Filtering and the positioning errors will be reduced to give more accurate localization.

Initially, object positions are determined by using KNN algorithm with measured RSS values. In second stage, ANN technique is deployed to calculate object coordinates [11] [12] . ANN will be trained with received RSS values at known fingerprint locations. Unknown object locations will be determined by using their measured RSS values and trained multilayer perceptron neural network model (MLP). MLP utilizes a supervised learning technique called back propagation for training the neural network.

In third stage, Kalman Filtering is employed to filter out the calculated object coordinate variations due to initial RSS fluctuations. Comparisons are carried out between object coordinates calculated with KNN, ANN and Kalman filtered ANN.

The paper is organized as follows. In Section 2, a description of Fingerprint localization system is presented. Sections 3 and 4 give a comprehensive view about Kalman filtering. Implementation of Neural Network technique is discussed in Section 5. Results and discussions are presented in Sections 6 and conclusions are given in Section 7.

2. Fingerprint System

Fingerprint localization technique is proposed in this study. Object location is estimated by employing KNN algorithm in a WLAN indoor environment. There are 2 phases in the technique. The first phase is the data collection and measurement offline phase while the second phase is the location estimation online phase [13] . A block diagram of the localization system is presented in Figure 1.

Data collection offline phase is conducted in a rectangular shape indoor area with dimensions 12 m × 20 m. WSN transmitters [14] , at the corners of the area are taken as the application points, (AP). A WSN receiver collects RSS values from transmitters at every grid points and sends them to a PC to be stored in a database of RSS values against grid positions. This data base is identified as fingerprint map of the indoor area.

In the online phase, real time sample of RSS measurements are collected from a WSN receiver on the object at unknown locations across the fingerprint map. Sample RSS values are compared to those stored in the database. The theory of minimization of Euclidean distances [15] , is deployed in this comparison.

Euclidean distance, d, is the signal amplitude distance between RSS values at a fingerprint point and RSS values at unknown object location. Nearest grid locations from the fingerprint database to the actual object RSS measurements can be detected by minimizing the Euclidean distance d, Equation (1), between them.

${d}_{i}^{}=\sqrt{{\displaystyle \underset{j=1}{\overset{4}{\sum}}{\displaystyle \underset{i=1}{\overset{N}{\sum}}{\left(RS{S}_{j}^{i}-RS{S}_{j}^{o}\right)}^{2}}}}$ (1)

where j is the number of APs and
$RS{S}_{j}^{i}$ is the RSS value from j^{th} AP at i^{th} grid location.
$RS{S}_{j}^{o}$ is the object RSS measurement from j^{th} AP at o^{th} unknown object location.
$i={i}_{1},{i}_{2},\cdots ,N$ , where N is the maximum number of grid points.

Hence the unknown object, “o”, location coordinates can be calculated by deploying weighted centroid localization algorithm expressed by Equation (2).

$\left(\stackrel{^}{x},\stackrel{^}{y}\right)=\frac{{\displaystyle \underset{k=1}{\overset{K}{\sum}}\frac{1}{{d}_{k}}{\left(x,y\right)}_{k}}}{{\displaystyle \underset{k=1}{\overset{K}{\sum}}\frac{1}{{d}_{k}}}}$ (2)

where
${\left(x,y\right)}_{k}$ is the coordinates of k^{th} number of nearest fingerprint points. Similarly
${d}_{k}$ is the k^{th} number of minimum Euclidean distance.

Figure 1. Block diagram of localization system.

3. Kalman Filtering

Kalman Filtering (KF) is applied to reduce the localization errors [16] . The object moves with a constant velocity across the test area. Kalman filter iteratively estimates the position of the object by using its previous position data and updates these estimates with new measurements. Mathematically, Kalman filter estimates the states of a linear system and it minimizes the variance of estimated error.

Let the initial state of a system be X_{0} and initial error in estimation during process be P_{0}. State equation of the system can be defined as

${X}_{{k}_{p}}=A{X}_{k-1}+B{u}_{k}+{\omega}_{k}$ (3)

where X_{k} is the state matrix and contains position and velocity coordinates
$\left(x,y\right)$ and
$\left(\stackrel{\xaf}{x},\stackrel{\xaf}{y}\right)$ .
${\omega}_{k}$ is noise and it is assumed zero. u is control matrix. A and B are unity matrices, k is the time index. Process covariance matrix is defined as

${P}_{{k}_{P}}=A{P}_{k-1}{A}^{\text{T}}+{Q}_{k}$ (4)

where Q_{k} is the process noise.

The system behaves according to the state equation and there is a need for an estimator which gives an accurate estimate of the true state even if it cannot be measured directly. Mathematically, there is a need for a state estimate that varies from the true state as little as possible. Difference between true state and estimated state is defined by a quantity called Kalman Gain. This Kalman gain (K) is given as

$K=\frac{{P}_{{k}_{p}}{H}^{\text{T}}}{H{P}_{{k}_{p}}{H}^{\text{T}}+R}$ (5)

where R is sensor noise and H is unity matrices. Updated state with new measurement input Y_{k} and Kalman gain can be defined as:

${X}_{k}={X}_{{k}_{p}}+K\left({Y}_{k}-H{X}_{{k}_{p}}\right)$ (6)

where ${Y}_{k}=C{X}_{{k}_{m}}+{Z}_{m}$ with C is unity matrix and Z is measurement noise. Error estimate during process becomes

${P}_{k}=\left(I-kH\right){P}_{{k}_{p}}$ (7)

Finally output of updated state becomes X_{k} and P_{k.} An operational model of Kalman filtering is given in Figure 2.

4. State Equation

In this study, localization model of Kalman filter is obtained from the linear motion of a person walking with a constant velocity. Object position in the model is $\left(x,\text{}y\right)$ and velocity is $\left(x,\text{}y\right)$ . Matrices in state Equation (1) can be defined as

$A=\left[\begin{array}{cccc}1& 0& \Delta T& 0\\ 0& 1& 0& \Delta T\\ 0& 0& 1& 0\\ 0& 0& 0& 1\end{array}\right],B=\left[\begin{array}{cc}\frac{1}{2}\Delta {T}^{2}& 0\\ 0& \frac{1}{2}\Delta {T}^{2}\\ \Delta T& 0\\ 0& \Delta T\end{array}\right],{u}_{k}=\left[\begin{array}{c}{a}_{x}\\ {a}_{y}\end{array}\right]$

Figure 2. Operational model of Kalman filter.

Therefore, the state equation X_{k} becomes;

${X}_{k}={\left[\begin{array}{c}x\\ y\\ \stackrel{\xaf}{x}\\ \stackrel{\xaf}{y}\end{array}\right]}_{k}=\left[\begin{array}{c}{x}_{k-1}+{\stackrel{\xaf}{x}}_{k-1}\Delta T+{a}_{x}\frac{1}{2}\Delta T\\ {y}_{k-1}+{\stackrel{\xaf}{y}}_{k-1}\Delta T+{a}_{y}\frac{1}{2}\Delta {T}^{2}\\ {\stackrel{\xaf}{x}}_{k-1}+{a}_{x}\Delta T\\ {y}_{k-1}+{a}_{y}\Delta T\end{array}\right]$ (8)

The Kalman gain can be calculated by Equation (5) where H is unity matrix and R is observation error matrix. They are shown as Figure 2.

Where
$\Delta T$ is the sampling time step. a_{x} and a_{y} are the acceleration along x and y axis and equal to zero.

The error estimate during the process which is also termed as state process covariance matrix is defined in Equation (9).

${P}_{K-1}=\left[\begin{array}{cccc}{\sigma}_{X}^{2}& {\sigma}_{X}{\sigma}_{Y}& {\sigma}_{X}{\sigma}_{{V}_{X}}& {\sigma}_{X}{\sigma}_{{V}_{Y}}\\ {\sigma}_{Y}{\sigma}_{X}& {\sigma}_{Y}^{2}& {\sigma}_{Y}{\sigma}_{{V}_{X}}& {\sigma}_{Y}{\sigma}_{{V}_{Y}}\\ {\sigma}_{X}{\sigma}_{{V}_{X}}& {\sigma}_{Y}{\sigma}_{{V}_{X}}& {\sigma}_{{V}_{X}}^{2}& {\sigma}_{{V}_{X}}{\sigma}_{{V}_{Y}}\\ {\sigma}_{X}{\sigma}_{{V}_{Y}}& {\sigma}_{Y}{\sigma}_{{V}_{Y}}& {\sigma}_{{V}_{X}}{\sigma}_{{V}_{Y}}& {\sigma}_{{V}_{Y}}^{2}\end{array}\right]$ (9)

where ${\sigma}_{x}$ and ${\sigma}_{y}$ are the process variations. ${\sigma}_{{v}_{x}}$ and ${\sigma}_{{v}_{y}}$ are the velocity variations of the process which are considered as zero. Measurement input is defined as:

${Y}_{k}=C{X}_{{k}_{m}}+{z}_{m}$ (10)

It updates the system with new measurements. The model characterizing the measurement input equation is given by

$\left[\begin{array}{c}{Y}_{x}\\ {Y}_{y}\end{array}\right]=\left[\begin{array}{cccc}1& 0& 0& 0\\ 0& 1& 0& 0\end{array}\right]\left[\begin{array}{c}x\\ y\\ \stackrel{\xaf}{x}\\ \stackrel{\xaf}{y}\end{array}\right]+\left[\begin{array}{c}{z}_{{m}_{X}}\\ {z}_{{m}_{Y}}\end{array}\right]$ (11)

where z_{m} is the electronic noise and assumed zero.

$H=\left[\begin{array}{cccc}1& 0& 0& 0\\ 0& 1& 0& 0\\ 0& 0& 1& 0\\ 0& 0& 0& 1\end{array}\right],R=\left[\begin{array}{cccc}\Delta {x}^{2}& 0& 0& 0\\ 0& \Delta {y}^{2}& 0& 0\\ 0& 0& \Delta {V}_{X}^{2}& 0\\ 0& 0& 0& \Delta {V}_{Y}^{2}\end{array}\right]$

New adjusted state, in another word, new predicted state X_{k} will be calculated with Equation (6). Process covariance matrix is updated with Equation (7) by using unity matrices I and H with Kalman gain. The new predicted state X_{k} and new updated covariance matrix P_{k} represent previous k-1 state in second round and the whole iteration is repeated once again.

The outputs are the updated state values which are presented in Figure 2.

5. Artificial Neural Networks

The second method introduced in this study to determine the mobile object’s location is the Artificial Neural Network approach [17] .

The approach is a nonlinear mapping from a set of input RSS values onto a set of two output variables representing the mobile object position coordinates (x, y). ANN based structure is constructed by using Multi-Layer Perception (MLP). This network deploys the back propagation training of estimated errors. Errors propagate backwards from the output nodes to the inner nodes. Back propagation method is a supervised learning method and its model is given in Figure 3.

ANN approach has two operational phases separately. They are training (learning) phase and real time estimation phase.

In this study, there is a set of 4 RSS inputs applied to the input of the ANN during the training phase. In this phase, weights are iteratively adjusted to minimize the network performance function. During the real time estimation phase, RSS measurement at a specific object location is applied to the inputs of ANN. The outputs of the ANN are the estimated values of object location coordinates.

Figure 3. Back-propagation model.

Feed forward architecture is employed with ANN. Network model with the back propagation method has the following characteristics in Table 1.

6. Results and Discussions

This study is undertaken to compare the effects of Artificial Neural Network and Kalman Filtering with k-NN localization. Unknown object locations are determined with KNN and ANN techniques and an initial comparison is made between them. ANN technique has shown a higher positioning accuracy compared to KNN technique. Hence, the object coordinates which are calculated with ANN technique are subjected to a further stage of Kalman filtering to improve the positioning accuracy.

Experimental test area has 240 fingerprint points with a spatial separation of 1 m. 4 WSN transmitters are placed at the 4 corners of the test area. A mobile person with a WSN receiver has moved along a trajectory track along the edges of the test area during the measurements. This trajectory track is formed by 57 locations with 1 m distance between two adjacent locations. Position of the mobile person is calculated at each location and recorded as the unknown object location.

During the offline phase, a fingerprint database is constructed. This database consists of $\left(x,y\right)$ grid coordinates against RSS values from 4 transmitters. During the online phase, RSS measurements at trajectory points are recorded. KNN algorithm is deployed and k number of nearest Euclidean distances and their corresponding fingerprint points are selected. Location of the person is estimated by employing the weighted centroid localization technique. As a result, a series of estimated location coordinates are obtained along the edges of the test area. These coordinates are displayed graphically in Figure 4.

Location of the mobile person is also determined by deploying Artificial Neural Network. Fingerprint database, generated during offline phase, is used as the input and output training data for the MLP network structure. Sigmoid activation function is used between input and output layers. Inputs are the RSS values received from transmitters at every fingerprint point. $\left(x,y\right)$ coordinates of the fingerprint points are the related output $\left(x,y\right)$ coordinates for the ANN. The network is trained with these known RSS values and their known $\left(x,y\right)$ coordinates. Number of training iterations is taken as 3000.

Table 1. ANN model characteristics.

Figure 4. Plots of mobile person’s walking trajectory with KNN, ANN and ANN + KF methods.

MATLAB neural network toolbox is employed during calculations. Feed forward architecture is employed by using function “newff”. Activation function “tansig” for the hidden layers and “purelin” linear function is used for output layer. Training function is defined by the function “trainrp”. Once the training phase is completed, RSS measurements at unknown tracking trajectory points are applied as inputs to trained network inputs and the output $\left(x,y\right)$ coordinates are determined as the unknown locations of the mobile person along the trajectory. These output coordinates are presented in Figure 4.

Location mean error, mean value of distance between the actual and estimated location, with KNN method is 0.98 m and with ANN method is 0.84 m. Similarly location median error, median value of distances between the actual and estimated locations, with KNN method is 0.91 m while with ANN method is 0.78 m. Finally, standard deviation of error distances (SDE) with KNN is 0.32 m while with ANN is 0.23 m. These are presented as a bar chart in Figure 5. In conclusion; dynamic localization along a trajectory path with ANN method is more accurate than with KNN method.

Because the results show that unknown coordinates of the mobile person are calculated closer to actual coordinates with ANN method compare to KNN method. Furthermore estimated position variations are reduced with ANN method.

To increase the localization accuracy of the mobile person Kalman filtering is applied on the
$\left(x,y\right)$ position coordinates of the mobile person calculated with ANN method in time domain. The sampling time is set to
$\Delta T$ = 1 s. Process variations
${\sigma}_{x}$ and
${\sigma}_{y}$ are considered as (2.5)^{2} and the velocity variations of the process,
${\sigma}_{{v}_{x}}$ and
${\sigma}_{{v}_{y}}$ , are equal to zero due to the mobile person’s constant walking speed.

Figure 5. Bar charts of errors.

$\left(x,y\right)$ coordinates of 57 locations which are obtained with ANN method along the mobile person’s trajectory are Kalman filtered. Filtered coordinates are also plotted in Figure 4. It can be seen from Figure 4 that estimated locations of the mobile person are closer to true locations with ANN + KF method. Estimated location coordinates with KNN have the maximum variations. Error distance between estimated and true position of the mobile person can be calculated with Equation (12):

$err=\sqrt{{\left({x}_{est}-{x}_{true}\right)}^{2}+{\left({y}_{est}-{y}_{true}\right)}^{2}}$ (12)

Location mean error with ANN + KF is 0.53 m, median error is 0.51 m and standard mean error is 0.12 m. These errors are also presented in Figure 5. It can be seen that error distances are reduced further and the estimated object coordinates approach towards the true positions. It can be concluded that the ANN method decreases the localization error distance by 14% while ANN + KF method decreases the localization error distance by 46%.

7. Conclusions

In this study, a dynamic localization technique is introduced along a trajectory in a closed indoor area. A mobile person has walked along a trajectory and RSS values were recorded. A fingerprint map and its database are constructed and unknown locations on the trajectory are estimated with well-known KNN method. ANN algorithm is also deployed along the trajectory and unknown locations are once more estimated. Kalman filtering is applied on the results of ANN algorithm and the accuracies of the mobile person’s positions are improved. It can be concluded that Fingerprint mapping based on ANN algorithm combined with Kalman filtering produces excellent localization accuracies of around half a grid space indoors.

In future studies, localization of moving persons in indoors will be researched by applying other artificial neural network techniques such as General Regression Neural Network (GRNN), Convolutional Neural Network (CNN), and Deep Neural Network (DNN). Additionally, object coordinates obtained with these techniques will be subjected to Kalman filtering to improve the positioning accuracies a stage further.

Conflicts of Interest

The authors declare no conflicts of interest.

[1] | Bohn, J. (2008) Prototypical Implementation of Location Aware Services Based on a Middleware Architecture for Super-Distributed RFID Tag Infrastructures. Personal and Ubiquitous Computing, 12, 155-166. https://doi.org/10.1007/s00779-006-0107-2 |

[2] | Zhang, T., Ouyang, Y.X., Li, C. and Xiong, Z. (2007) A Scalable RFID-Based System for Location-Aware Services. Proceedings of 2007 International Conference on Wireless Communications, Networking and Mobile Computing, Shanghai, 21-25 September 2007, 2116-2123. https://doi.org/10.1109/WICOM.2007.529 |

[3] |
Baloch, R.A., Awan, I. and Min, G. (2010) A Mathematical Model for Wireless Channel Allocation and Handoff Schemes. Telecommunication Systems, 45, 275-287.
https://doi.org/10.1007/s11235-009-9267-5 |

[4] | Sheu, S.T., Hsu, Y.M. and Chen, H.Y. (2014) Indoor Estimation Using Smart Antenna System with Virtual Fingerprint Construction Scheme. The Eighth International Conference on Mobile Ubiquitous Computing, Systems, Services and Technologies, Rome, 2014, 281-286. |

[5] | Medina, C., Segura, J.C. and Torre, A.D. (2013) Ultrasound Indoor Positioning System Based on Low-Power Wireless Sensor Network Providing Sub-Centimeter Accuracy. Sensors, 13, 3501-3526. https://doi.org/10.3390/s130303501 |

[6] | Peng, R. and Sichitiu, M.L. (2006) Angle of Arrival Localization for Wireless Sensor Networks. 2006 3rd Annual IEEE Communications Society on Sensor and Ad Hoc Communications and Networks, Reston, VA, 2006, 2-7. |

[7] | Liu, X., Lu, B., Niu, J., Shu, L. and Chen, Y. (2016) HMF: Heatmap and WiFi Fingerprint-Based Indoor Localization with Building Layout Consideration. 2016 IEEE 22nd International Conference on Parallel and Distributed Systems (ICPADS), Wuhan, 13-16 December 2016, 324-331. https://doi.org/10.1109/ICPADS.2016.0051 |

[8] |
Chen, Z., Liu, Y., Li, S. and Wang, G. (2016) Study on the Multipath Propagation Characteristics of UWB Signal for Indoor Lab Environments. 2016 IEEE International Conference on Ubiquitous Wireless Broadband (ICUWB), Nanjing, 16-19 October 2016, 1-4. https://doi.org/10.1109/ICUWB.2016.7790604 |

[9] |
Abusara, A. and Hassan, M. (2015) Error Reduction in Distance Estimation of RSS Propagation Models Using Kalman Filters. 2015 6th International Conference on Modelling, Simulation, and Applied Optimization (ICMSAO), Istanbul, 27-29 May 2015, 1-5. https://doi.org/10.1109/ICMSAO.2015.7152239 |

[10] |
Nabaee, M., Pooyafard, A. and Olfat, A. (2008) Enhanced Object Tracking with Received Signal Strength Using Kalman Filter in Sensor Networks. 2008 International Symposium on Telecommunications, Tehran, 27-28 August 2008, 318-323.
https://doi.org/10.1109/ISTEL.2008.4651321 |

[11] | Ferreira, G.P., Matos, L.J. and Silva, J.M. (2016) Improvement of Outdoor Signal Strength Prediction in UHF Band by Artificial Neural Network. IEEE Transactions on Antennas and Propagation, 64, 5404-5410. https://doi.org/10.1109/TAP.2016.2617379 |

[12] | Ibrahim, A., Rahim, S.K. and Mohamad, H. (2015) Performance Evaluation of RSS-Based WSN Indoor Localization Scheme Using Artificial Neural Network Schemes, Communications (MICC). 2015 IEEE 12th Malaysia International Conference, Kuching, 23-25 November 2015, 300-305. |

[13] |
Le Dortz, N., Gain, F. and Zetterberg, P. (2012) WiFi Fingerprint Indoor Positioning System Using Probability Distribution Comparison. Acoustics, Speech and Signal Processing (ICASSP), 2012 IEEE International Conference, Kyoto, 25-30 March 2012, 2301-2304. https://doi.org/10.1109/ICASSP.2012.6288374 |

[14] | Zhao, Y., Dong, L., Wang, J., Hu, B. and Fu, Y. (2008) Implementing Indoor Positioning System via ZigBee Devices. Signals, Systems and Computers, 2008 42nd Asilomar Conference, Pacific Grove, 26-29 October 2008, 1867-1871. https://doi.org/10.1109/ACSSC.2008.5074752 |

[15] | Teuber, A. and Eissfeller, B. (2006) WLAN Indoor Positioning Based on Euclidean Distances and Fuzzy Logic. Proceedings of the 3rd Workshop on Positioning, Navigation and Communication, Hannover, 16 March 2006, 159-168. |

[16] |
Sanda, B., Abdel-Qader, I. and Akanmu, A. (2014) Kalman Filters for Reducing Error in RFID Real-Time Localization Systems. 2014 IEEE International Conference on Electro/Information Technology (EIT), Milwaukee, 5-7 June 2014, 324-329.
https://doi.org/10.1109/EIT.2014.6871785 |

[17] | Otarawanna, P. and Charoensuk, W. (2014) RSSI-Based Positioning for Health Care Service Using Artificial Neural Network Approach. 7th Biomedical Engineering International Conference, Fukuoka, 26-28 November 2014, 1-4. https://doi.org/10.1109/BMEiCON.2014.7017419 |

Copyright © 2020 by authors and Scientific Research Publishing Inc.

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.