Human Detection through RSSI Processing with Packet Dropout in Wireless Sensor Network

This paper presents a device-free human detection method for using Received Signal Strength Indicator (RSSI) measurement of Wireless Sensor Network (WSN) with packet dropout based on ZigBee. Packet loss is observed to be a familiar phenomenon with transmissions of WSNs. The packet reception rate (PRR) based on a large number of data packets cannot reflect the realtime link quality accurately. So this paper firstly raises a real-time RSSI link quality evaluation method based on the exponential smoothing method. Then, a device-free human detection method is proposed. Compared to conventional solutions which utilize a complex set of sensors for detection, the proposed approach achieves the same only by RSSI volatility. The intermittent Karman algorithm is used to filter RSSI fluctuation caused by environment and other factors in data packets loss situation, and online learning is adopted to set algorithm parameters considering environmental changes. The experimental measurements are conducted in laboratory. A high-quality network based on ZigBee is obtained, and then, RSSI can be calculated from the receive sensor modules. Experimental results show the uncertainty of RSSI change at the moment of human through the network area and confirm the validity of the detection method.


Introduction
Object detection is a popular area of research. Detection based on WSN processes object information collected by sensors, sends to the control center, and then analyses the data to realize the detection [1]. The sensor signal acquisition is significantly important, and the type of sensors concerns the detection result. At present, pyroelectric infrared [2], voice signal, vibration signal, and magnetic signal sensors are commonly used for detection. However, these detection studies often require external sensors or human body carrying corresponding equipment [3,4].
With the rapid development of Internet of Things (IoT), massive data is delivered through trillions of interconnected smart devices. IEEE 802.15.4 is one of the preferred mechanisms to provide modulation and Media Access Control (MAC) in wireless IoT networks. Sensors and actuators in WSNs are usually deployed in edge environments where wireless channels are subject to burst packet loss due to multipath fading or high bit error rate. Packet loss is an important factor that reduces the robustness of WSNs. The research on correctly implementing reasonable control strategies to improve network performance has attracted wide attention from many scholars. At present, data collection phase is one of the most critical phases in the whole process of communication between device and human. Numerous data collection solutions were proposed in the literature [5][6][7]. There are many methods for evaluating the quality performance of network links, which can be mainly divided into two categories. One is to use the PRR for evaluation [8]. The packet rate can directly reflect the current link quality, but in order to obtain accurate link evaluation, it is necessary to calculate the packet rate through a large number of samples, which wastes a lot of energy and deviates from the low power consumption of wireless sensor networks. The other is by using RSSI and link quality indicator (LQI) [9]. RSSI is one of link quality evaluation indicators and has been widely used in localization [10], distance estimation, and link quality assessment.
Mo et al. [11] believe that RSSI values are an important indicator of network packet loss. When the RSSI value is close to the gray area, the packet loss phenomenon will occur remarkably, and a lightweight adaptive repair and adjustment decision method is proposed. See et al. [12] proposed network link quality can be measured by the vector network analyzer or RSSI received by the receiving node, and the probability distribution of the RSSI value at different packet loss rates is used to study the relationship between the path loss and the packet loss rate.
However, the existed literatures show that RSSI can be affected by many factors, for instance, the performance of WSN nodes, the temperature and humidity of the surroundings [13][14][15]. Each can change RSSI, which cause RSSI to cannot accurately reflect the quality of the network link. Hamida and Guillaum [16] found that people have a great influence on RSSI when walking around in the network area and proposed that RSSI cannot accurately network link quality when there is someone in the daytime.
In this paper, we introduce a real-time link quality estimation method and a human detection method using RSSI volatility. There are already several researches which have shown detection result using RSSI [17]. Hussain et al. [18] investigated the variation of RSSI can be used to detect the mobility of an intruder and tested by a light sensor. Radio Tomographic Imaging (RTI) has been developed to image the attenuation caused by physical objects using RSSI in a wireless network. An Elliptical Weight Model (EWM) was introduced to describe the characteristic of RSSI attenuation and further to track and estimate the position of individuals [19]. A distributed processing of RSSI for indoor surveillance was proposed to detect and localize moving persons, and power consumption is reduced by the intrusion alert algorithm [20]. The shadowing effect between stationary wireless nodes in which the line of sight obstructed by a human body was adopted and RSSI variations were analyzed for human presence detection [21]. This paper describes a WSN for real-time human detection by the fluctuation of RSSI. Different from other previous works, the uncertainty change of RSSI at the moment of human entering or leaving to the detection area is considered. The Intermittent Kalman filter is applied to improve the accuracy of detection by considering the packet loss in WSN and to smooth RSSI volatility caused by the environment or other factors. Furthermore, the real-time RSSI reference value has been sought to reduce the misjudgment of human.
The paper is organized as follows. A real-time link quality estimation method based on the RSSI value and a human detection method in the case of data loss are given in Section 2. The experimental results are presented to confirm the validity of the detection method in Section 3. Finally, we conclude in Section 4.

Methodology
2.1. Real-Time Link Quality Estimation Method. The realtime wireless link considered in this paper is dynamic and time-varying. If the PRR is calculated according to the success rate of each data reception, the error is large and cannot estimate the link quality. This paper uses an exponential smoothing method [22], which is a common sequence data processing method. It takes into account the role of past data and uses the concept of weight to consider the degree of data impact. Window sliding average processing is now performed on the observed data.
The observation data sequence moves on the window that can hold 100 data, and the observation data corresponding to the window center is updated for the window moving on data series, which named window sliding average. In the T time, the number of transmitted data packets is N = 100, and the number of successfully received data is m, which is obtained by the exponential smoothing method: where PRRðnTÞ is the current PRR prediction, PRRððn − 1Þ TÞ is the last prediction, Y ðnTÞ reflects the PRR measurement of the n-th window time, which is m/N, N = 100, so Y ðnTÞ is a fraction less than 1, and also a is a number of ½0 , 1. We can see from the model, the bigger a is, the more weight is given to the last prediction PRRððn − 1ÞTÞ. On the contrary, the lower a is, the more weight is given to the most recent observation Y ðnTÞ.
Since the PRR is a number less than 1, we take the third digit after the decimal point to improve the accuracy and simplify the calculation. Let PðnTÞ = 1000PRRðnTÞ, Equation (1) can be changed to According to Equation (2), the value of the smoothing constant a is the key to obtaining the PRR. Now, we use the RSSI value received by the receiving node to determine the value of a. The RSSI value can reflect the link quality under certain circumstances. For example, the RSSI is generally stable at around -60 dBm in an unmanned laboratory environment, and in this case, the PRR tends to be relatively high and stable. When a human was moving into the network area, the RSSI will fluctuate greatly and the attenuation can reach -85 dBm; the PRR tends to decrease and be unstable.
So the value of a can be recalculated as a′, which is expressed as where r is the influence of the RSSI value on a; σ 2 ðnTÞ is the variance of RSSI for the n-th window time; σ 2 0 is the variance of the measured RSSI values in unmanned environment, the average of RSSI for the n-th window time is RSSI avg ðnTÞ, and RSSI avg is the average RSSI value in the unmanned environment; and RSSIof f set is found empirically by sending a large amount of packets in the unmanned environment.
When using Equation (2), the initial value PðTÞ should be determined and obtained. Through a large number of statistical 2 Journal of Sensors data analysis, RSSI avg , the variance σ 2 0 and PðTÞ are set. The RSSI value is above the threshold and fluctuates at RSSI avg in a small range in the unmanned environment. The network link quality is relatively stable. a can be obtained through a large number of statistical data in the unmanned environment and by calculating the average and variance of RSSI values over the window time; and the value is very close to 1. a ′ is obtained from packets in the case of interference, and the value is close to 0.

Detection Algorithm.
Packet loss is observed to be a familiar phenomenon with transmissions of WSNs. Frequent undesired packet loss seriously degrades the network performance. The real-time link quality estimation method mentioned in Section 2.1 can be used to observe the PRR of each window time. The detection result is set to be invalid when the PRR at one time is low. So data dropout in transmission should be considered. In this paper, the Intermittent Kalman filter algorithm [23] is used to estimate the lost RSSI values and further to realize detection.
Owing to the existence of measurement error, the measured RSSI value ZðkÞ, ðk = 0, 1, ⋯, mÞ fluctuates randomly within a narrow range near the actual RSSI value XðkÞ, namely, ZðkÞ − λ/2 ≤ XðkÞ ≤ ZðkÞ + λ/2, and the measurement precision is determined by constant λ. Gaussian random noise is considered in this experiment and filtered by the Intermittent Kalman algorithm to obtain the real RSSI value [24]. The system of RSSI equations can be described as where XðkÞ is the estimated value of RSSI at time k; ZðkÞ is the measured RSSI value; Wðk − 1Þ is Gaussian random noise of system; Wðk − 1Þ ∼ Nð0, QÞ, where Q is the variance; VðkÞ is Gaussian random noise of measurement; and V ðkÞ ∼ Nð0, RÞ, where R is the variance. Q and R should be known, and the values have direct influence on the algorithm. The values need to reset with the changes of the environment. In this paper, online learning is used to set the value of Q and R, which are the learning abilities. The values of RSSI are adopted as the training inputs enabling the algorithm to automatically and timely adapt to the environmental dynamics. Assume there are N arbitrary distinct training samples ðx i , y i Þ, i = 1, 2, ⋯, N, where X are the training inputs and Y are the training targets; we consider a loss function lðy,ŷ Þ = ðy∧ − yÞ 2 that measures the cost of predictingŷ when the actual answer is y. The ultimate goal is to minimize the cumulative loss suffered along its run. And there is a correlation between the past and present when environment changes.
We consider this problem as a discrete time system; the uncertainty arises mainly because of packets dropout in the network, which leads to the randomness of receiving observations. Data loss can be described by a random variable which obeyed Bernoulli distribution [25]. Firstly, a random binary variable γ t is used to describe the observation at time t, γ t = 1 expresses the packet at time t received, and γ t = 0 expresses the packet at time t lost; the probability p γt ð1Þ = λ t , λ t ð0 ≤ λ t ≤ 1Þ is the arrival rate. γ t at time t is mutually independent with γ t at time s. The measured noise V t can be defined as follows: when γ t is equal to 1, the variance of V t is R; when γ t is 0, the variance of V t is σ 2 I, and the value of σ 2 is arbitrary. In reality, the corresponding observation value cannot be obtained when the packet loss happens, so σ → ∞. Now, we use a virtual observation to replace the actual value that has been lost with the given variance σ 2 , and let σ → ∞. Then, the Kalman filter equation can be calculated as follows: whereX t|t is the estimate value of RSSI, A is a unit matrix, and H is a unit matrix. If σ → ∞, then, (8) and (9) are equivalent to the following two equations: where K t+1 = P t+1|t H T ðHP t+1|t H T + RÞ −1 is the Kalman gain, which is the same as the traditional Kalman algorithm. Calculating KðtÞ, t = 1, 2, ⋯, Pð0 | 0Þ should be known firstly. Pð0 | 0Þ = Ef½Xð0Þ −Xð0 | 0Þ½Xð0Þ − X∧ð0 | 0Þ T g. Actually, λ t = 1 is a kind of ideal state. When λ t = 0, Equation (8) degrades into the traditional Kalman algorithm. Data loss means we cannot obtain the current RSSI value; for example, the average RSSI value is about -60 dBm in nobody environment in the laboratory. The RSSI value will be extracted as 0 dBm if data loss happened at that time. Therefore, the intermittent Kalman filter algorithm is adopted to avoid the error caused by packet loss.
The effect of Intermittent Kalman filtering when packet loss happens during transit is shown in Figure 1. There are some data losses in 250 packets sent by the transmitting node, and the RSSI value is extracted as 0 dBm. However, RSSI curve becomes smooth after being filtered. We also find that the fluctuation can reach 15 dBm from real data, which may neutralize the effect of human body and further impact the experiment results. But after being filtered, the maximum RSSI fluctuation 3 Journal of Sensors of every moment is less than 1 dBm compared with the previous moment. So Intermittent Kalman can in some degree filter fluctuation caused by environmental changes, the performance of sensor nodes, indoor obstacles, and measurement errors.
Recent research has shown that variations of RSSI in indoor environments where sensor nodes have been deployed can reveal movements of persons [26]. The detection method proposed is mainly based on the human body interfering with RSSI by causing fading and shadowing effects.
In our earlier works, we compute the average RSSI value in nobody environment; however, we find that average RSSI value laboratory may change by many factors, the performance of WSN nodes, the temperature, humidity of the surroundings, and so on. And when lab students work over their office desk, the values can be obviously different with the value in nobody  #define RSSI_offset The threshold value set var value; The last RSSI value received var value_new; The current value obtained 11 |value_new-value|<RSSI_of f set return value; else return value_new; Algorithm 1: RSSI preprocessing algorithm.  Journal of Sensors context, regardless of those persons sitting in or out of the detection area. Especially, while the experiment is ongoing, some persons come in or go out of the lab even out of the detection area which may cause the average RSSI value in nobody environment meaningless. So, we take the change of the lab environment into account in this detection experiment.
Owning to the existence of multipath effect, scattering, reflection, obstacle, and other interference factors in the lab, a real-time RSSI reference should be set as shown in Algorithm 1. RSSI fluctuates within a narrow range in an unmanned environment, and RSSI offset can be found empirically by sending a large amount of packets. When the current RSSI value is obtained, we compare it with the last RSSI value. If the difference is greater than the RSSI offset, we set the current RSSI as reference. Otherwise, the last value is still the RSSI reference.
We can see from Figure 2 that a person enters into the network area at the beginning, and the RSSI value obviously decreases about high to 8 dBm. The person leaves at about the 30th data number, and the RSSI value is up to -65 dBm at the moment but reaches a stable level of -68 dBm. A human comes in the area near the 50th number; however, there is a sharp increase rather than a decrease of the RSSI value. Until the person keeps quiet in the detection area, the RSSI value generally remained at -73 dBm, which manifests that a human body can cause RSSI attenuation. The phenomenon can also happen near the 180th and 235th numbers. So, we conclude that at the moment when the human was moving or leaving the network area, the RSSI is unstable and we cannot be sure that the RSSI is reducing. However, there is an exact attenuation when the person stays quietly in the area. Anyway, either the RSSI value increases or decreases, we can observe the moving person by the increasing variance.
The whole process of the human detection method is mainly shown in Algorithm 2. RSSI values are filtered by the Intermittent Kalman algorithm at the beginning, and then, the value of RSSI offset can be obtained from the quantities of the experiment. We get the current RSSI and process it by the RSSI preprocessing algorithm and calculate the variances of processed RSSI values. Then, we can judge whether the human appears or not by the calculated variance.

Experimental Results
This section presents the experimental results obtained with the method described in the previous parts.
WSN consists of a large number of small sensor nodes with sensing, processing, and communicating abilities. Sensor nodes communicate with the coordinator directly in a typical WSN network. The communication speed of WSN nodes is 2.4 Kbps, and 2.4GHz is used to do tests. There are about 24 bytes being sent every second, and the transmit power is set as 0 dBm. Figure 3 shows the photos of the WSN coordinator (a) and sensor node (b).
The testing area is 3 m * 3 m and layouts of nodes as shown in Figure 4. In order to highlight the human body affection, we do the following work before the start of the experiment. The validation of the network real-time link quality evaluation method is verified through an experiment. 1000 packets are used, and each 100 packets are divided into a group. The statistical parameters of each group are shown in Table 1. Compared with RSSI avg and σ 2 0 , the value of a is  (3), and then, the PRR is calculated for each window according to Equation (2).
We can see from Table 1 that the obtained PRRðnTÞ of each window is dynamic and very different from each window. When the human body is existing, the network is shown to be unstable and PRR tends to decrease. Then, the weight of real-time measured values should be increased in the estimation method which shows the real-time performance. The PRR of group 6 and group 8 are 43.73% and 65.9%, respectively, which means a substantial amount of dropped packets. If a person object goes into the network area during this time, it cannot be detected. So real-time monitoring link quality can effectively guarantee the accuracy of human detection.
This method can monitor network link quality in real time, and its validity and feasibility are proved by an experiment. Real-time estimation of link quality is very important in a human body detection experiment. If the PRR is too low in a certain period of time, the RSSI value cannot be obtained because of packet loss, which directly affects the accuracy of the detection experiment. PRR can be calculated by this method in real time and used for detection.
The test scenario is the following: no humans are present in the lab at first; therefore, no detection is reported. Once a human subject enters the network area, he goes through for 7 times. We can see seven relatively large fluctuations in Figure 5. During the test, 250 packets have been received by sensor nodes.   Journal of Sensors Figure 6 shows the result of one detection test; when a human goes into the network area, the RSSI experiences a rapid change. And there are separately seven parts with variance greater than 0 in Figure 6, and each part indicates there is someone entering into or getting out of the detection area. So the detection method proposed in Section 2 can detect a moving human effectively and accurately. Mainly because of the human body's absorption and reflection effects, the variations of RSSI are quite satisfactory for accurate human presence detection.
The second experiment is performed to obtain the detection accuracy. We firstly do tests for 100 times by changing the location of the transmit and receive nodes, and the detection accuracy of the proposed method is around 95%, in total. Then, a number of sensor nodes are changed, and we do tests for 50 times; the accuracy is around 92%, in total. The detection accuracy is high; human presence can be detected no matter how close to the sending or receiving node. And each pair of nodes has their own detectable area. The solution to improve the accuracy in a larger detectable area is to install l additional node.

Conclusions
In this paper, a device-free human body detection method by RSSI is present. In view of the common phenomenon of packet loss in transmission of WSN, a real-time network link quality estimation method is proposed, which can not only overcome the delay caused by statistical PRR but also consider RSSI vulnerability to environmental impact. And the Intermittent Kalman filter algorithm is adopted to filter RSSI data, which improves the accuracy of detection. Compared with other conventional detection methods, the human body does not need to carry any equipment, and sensor nodes do not need to add external sensors. So this method is easy to implement and low cost. Of course, some flaws still exist during our experiment process. Such experiments mentioned above were operated in a spacious and obstacle-free room; the experiment results reflect just one idealized application environment.
For more practical consideration, we should conduct experiments in heavily obstructed environments. The attenuation of the radio signal is usually strong. This decreases the   Journal of Sensors transmitting range of the nodes and the packet delivery ratio. A future work will try to find solutions to improve the detection accuracy of the system by further improving the detection algorithm. Multiple sensor nodes will be adapted to realize accurately and tract the movements of a person in a monitored area. In a critical three-dimensional indoor environment, more than a single person should be detected inside the monitored area of the system correctly.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
The authors declare that they have no conflicts of interest.