Dual Antenna-Based Line Crossing Detection with UHF RFID

,


Introduction
Line crossing detection is to check whether and when people or objects go across a given barrier line, which is quite common and important in our daily life.As shown in Figure 1, in a retail store, line crossing detection is deployed on the electronic article surveillance (EAS) system for detecting pass in and out of customers [1][2][3].If an attacker passes the EAS door with improperly bought items, the system sets off alarms and alerts staff to an attempted theft in progress.In track and field, high-resolution cameras are used to capture images and compute the time when athletes hit the finish line, which determines the winner and ranking of the game.In robotics, the technology of line crossing detection can be applied to create a virtual wall, which is an invisible barrier that robots won't cross.That makes it easy to confine a robot to a particular area or room and prevents it from approaching anything dangerous [4][5][6].Line crossing detection also provides users the ability to do human-machine interaction.
For example, we can use the technique to build a virtual switch that tracks your hand's trajectory for choosing between two distinct states (e.g., turning on/off the TV).
Existing solutions to line crossing detection generally fall into three categories: infrared sensor [7,8], camera [9][10][11], and virtual wall [4][5][6].Infrared sensor detects line crossing by measuring infrared light radiating from objects in its field of view, which is widely used in security alarms.It tracks general movements but does not tell who or what moved.Camera uses image processing algorithm to recognize the movement of people or objects over a given virtual line.It can be used to detect people crossing over the fence or entering some restricted area.In robotics, a robot constructs the virtual wall, which is an invisible barrier that the robot cannot cross in automatic path planning.Although existing solutions to line crossing detection have achieved great advancement, they do not function well in the case of detecting concurrent line crossing, i.e., multiple objects or people cross the line at the same time.
In this paper, we propose a new solution called RF-Line to the problem of line crossing detection by using radio frequency identification (RFID).As a noncontact passive sensing technology, RFID has attracted increasing attention in recent years and has been widely used in various fields, such as object tracking [12][13][14][15][16][17][18][19][20][21][22], warehouse inventory [23][24][25][26][27][28][29][30], library management [31][32][33][34], and others [4-6, 35, 36].Each RFID tag has a unique ID that exclusively indicates every tagged object and brings them item-level intelligence.By tracking tags in real time, we can figure out when the tagged people or objects go across a given barrier line, especially for multitarget scenarios.However, this is not easy.The biggest challenge of RF-Line is that the interrogation zone of an RFID reader is irregular and unpredictable since the reader's signals are susceptible to various factors, e.g., the reader planning, multipath effects, material of tagged objects, surroundings.We cannot roughly take the time when a tag is seen by the reader for the first time as the time when line crossing occurs.Mobile RFID localization is a feasible solution, but it needs complicated system deployment, accurate calibration, or high computation overhead.For example, PinIt and BackPos [15,37] have to perform a set of calibration experiments to eliminate diversity.Tagoram [12] needs to know the antenna's position in advance and is also compute-intensive.
Unlike localization, line crossing detection concerns whether and when people or objects go across a given barrier line, instead of the tag's coordinates at any time.RF-Line breaks down this problem into two parts.First, when the tag moves along the line parallel to the plane of the antenna (e.g, tagged luggage on conveyor belt), we keep collecting RF phases of the tag and form a phase profile with time stamps.By removing the periodicity of the phase profile and using curve fitting of hyperbola, we are able to get an inflection point that indicates the time when line crossing happens.Second, in a more generalized case where the tag's trajectory is uncertain, we deploy two antennas opposite to each other and collect the RF phase profiles of two antennas at the same time.By a series of geometric transformations and mathematical derivations, we find that summing up the two phase profiles will get a new phase curve, in which the inflection point is the time of line crossing.In addition, RF-Line addresses the problem of turning back or long stay on the barrier line by recording the readings in each sliding window and calculating entropy of phase values, which avoid false positives.We implement RF-Line with commercial off-the-shelf (COTS) RFID reader (Impinj R420 [38]) equipped with two antennas (Laird S9028PCR [39]).Extensive experiments show that RF-Line can achieve accurate line crossing detection with a small error of 6.1 cm, with no need for any system calibration or complicated deployment.

Problem Definition
An ultra high frequency (UHF) RFID system generally consists of some tags and one or more readers (antennas) (we will alternately use reader or antenna in the rest of this paper).Each tag is attached to an object to exclusively indicate the associated object.By communicating with a tag, the antenna can obtain the attributes of the tagged object or the information of physical-layer signals emitted by the tag.As shown in Figure 2, let the center of an antenna be the origin O.If one antenna is used, the y-axis is on the line perpendicular to plane of the antenna.If two antennas are deployed, the y-axis is the line that goes through the two centers of the antennas.The x-axis is perpendicular to the y-axis.In RF-Line, the problem of line crossing detection is to check whether and when people or objects go across the y-axis.This is quite common and important in our daily life, such as the EAS checkpoint in a retail store or the finish line in track and field.
The difficulty is that the interrogation zone of an RFID antenna is not a line.Instead, its shape is irregular and unpredictable since the antenna's signals are susceptible to various factors, e.g., the antenna planning, multipath effects, the material of tagged objects, surroundings.We cannot roughly take the time when a tag is seen by the antenna for the first time as the time when line crossing occurs.For ease of presentation, we just use a one-tag case to show how RF-Line works in what follows.If multiple tagged targets go across the line at the same time, we can classify the collected As the tagged target moves, the distance between the antenna and the tag keeps changing, which leads to the variance of RF phase that is our vehicle for line crossing detection.The RF phase reflects the offset degree between the received signal and the sent signal of electromagnetic wave, ranging from 0 to 2π (360°), which is a common parameter supported by COTS readers, e.g., Impinj R420 [38].Suppose the distance between the reader antenna and the tag is d.According to the round-trip backscatter communication, the signal travels a total distance of 2d.In addition, the tag's reflection coefficient, the reader's transmission circuit, and the reader's receiver circuits will also cause extra phase rotations, which are denoted as θ TAG , θ TX , and θ RX , respectively.The phase output θ can be expressed as follows: where λ is the wavelength.The term μ is called diversity term, which is determined by hardware characteristics.As shown in Figure 2, when a tagged object moves, the antenna keeps querying tags and collecting a sequence of RF phase values together with the corresponding time stamps, which is a phase profile of the tag, denoted by c θ 1 ; The objective of RF-Line is to use this profile to estimate whether and when the tag crosses the y-axis.

Baseline Solution
In this section, we design a trajectory-based solution for the aforementioned problem.The basic idea is that if we can conduct real-time tracking on each tag, we are able to know when they cross the barrier line as well.To achieve this goal, we deploy two antennas P A and P B in opposite directions.As shown in Figure 3, a tag is initially located at P 1 and moves to the position P 2 .If the distance between P 1 and P 2 is small, the trajectory of the tag can be treated as a line.By measuring the distances of P 1 P A and P 1 P B , we are able to derive the tag's position.Suppose the distance P 1 P A is a, P 1 P B is b, and P A P B is c, the angle ffP 1 P A P B is α.Given the three sides of a triangle, α can be derived with the following equation: Suppose the antenna position P A is the origin point with the coordinate 0; ð 0Þ, the y-axis is the line between P A and P B and the x-axis is perpendicular to the y-axis at P A .In the 2D plane constructed by x-axis and y-axis, the tag position P 1 can be expressed as − ð a sin α; a cos αÞ.As we can see, the tag position is able to be determined by measuring the three distances a, b, and c.Among them, c is a constant since the two antennas are static and we can derive it after the antennas are deployed.Unlike c, a and b are hard to derive since the tag keeps moving.To handle this problem, we aim to take the RF phase as the vehicle to measure them.As shown in Equation (1), the phase value of the tag varies with the distance between the antenna and the tag, which is an ideal metric to do this measurement.
Next, we will introduce how to get the trajectory of the tag with RF phase.Suppose θ i is the i th phase measurement of the tag.According to Equation (1), the relationship between the phase value of the tag and its distance to the antenna is given as follows: where d i refers to the i th distance between the antenna and the tag, and k refers to the mod operation, as shown in Equation (1).With a phase measurement θ i and Equation (3), Δd A,1 Δd B,1

Wireless Communications and Mobile Computing
it is still hard to derive d i because the parameters k and μ are unknown.To handle this problem, we leverage the difference between the adjacent two phase measurements to remove k and μ.Since the sampling rate of RFID readers is generally greater than 30 Hz, the time difference between two samplings is about 0.03 s.Therefore, the distance difference Δd between the two samplings is less than 0.03 v.The communication frequency of UHF RFID systems that we use is 920 MHz, so the wavelength λ ¼ c=f is about 0.32 m.Therefore, the moving distance of the object between two samplings needs to be less than half of the wavelength, which is about 0.16 m.In other words, Δd ¼ 0:03v <0:16.This holds when the speed is less than 5 m/s, which meets most indoor applications.As shown in Figure 3, the tag's displacement Δd A; i during two adjacent reads θ A; i and θ A; iþ1 for antenna P A is: Since the above formula takes a phase difference for antenna P A , the antenna-dependent diversity term μ and the term 2kπ has been naturally eliminated.Obviously, the formula for antenna P B is similar to antenna P A .Then, we can recover the trajectory of the tag with the displacement.We give an example, as shown in Figure 3, where a tag moves from P 1 to P 2 .In a short period of time, the tag trajectory can be regarded as a straight line.The phase values of the tag at these two positions for antennas P A and P B are, respectively, θ A; 1 , θ A; 2 and θ B; 1 , θ B; 2 .According to Equation (4), we can derive Δd A; 1 and Δd B; 1 .Let P v be the intersect point between P 1 P A and its perpendicular line P 2 P v .Because the interval between two samplings is extremely short, the value of ffP 1 AP 2 (denoted as β in short) is extremely small.So, Δd B; 1 is the same.Let P 2 P v be the perpendicular line of P 1 P A and P 2 P v2 be the perpendicular line of P 1 P B , the intersect points are P v and P v2 , respectively.The position of P 2 can be derived according to the position of P 1 , P v , and P v2 .Similarly, using this method can deduce the positions of P 3 and P 4 , as shown in Figure 3, which can form a complete trajectory chain for line crossing detection.
In conclusion, this method can localize the tag location with only two antennas by using the phase changes to infer the movement trajectory of the object.However, this method needs the initial position of a tag together with careful system calibrations (for reader antennas), which is inapplicable in some practical applications.In the next section, we propose a new method called RF-Line, which can do line crossing detection without this limitation.The details are given below.

RF-Line
4.1.Basic Idea.We first consider a basic case that the tag moves along the x-axis at a constant speed, which is shown in Figure 2.This can be used in some applications such as conveyor belt in the airport for baggage check or delivery of cargo from storage.In this case, we use one antenna and keep collecting signals from the tag and label each of the corresponding phase value with the time stamps.The labeled RF phase is denoted by c θ 1 ; n t 1Þ; …; c θ n ; t nÞg , which forms a phase profile.In this profile, the x-coordinate is the time stamp and the y-coordinate is the phase value.In this paper, we find that the phase value looks symmetrical due to the tag's movement.As the tag moves, the displacement between the antenna and the tag first decreases and then increases after reaching a minimum when crossing the barrier line, resulting in a symmetrical phase pattern in the phase profile.We draw a typical pattern, as shown in Figure 4.As we can see, the phase value repeatedly reduces from 2π to 0 until the tag reaches the nearest place to the antenna.After that, the phase value starts to increase from 0 to 2π periodically and results in an inflection point in this pattern.The inflection point happens when the tag passes the antenna.Through its time stamp, we can easily know when the tag crosses the line (i.e., the y-axis of the coordinate).To find the zero-crossing of the derivative, we use a threshold test, the phase value whose first derivative is equal to zero will be chosen as the inflection point and its y-coordinate indicates when the tag crosses the line.

Line Crossing Detection with Time
Warping.In this subsection, we consider a more generalized case that the object moves at a nonuniform speed.In this case, the curve of RF phase will be compressed or stretched as the speed of the tag changes.
ð jÞ, where i represents the i th coordinate in M and j represents the j th coordinate in N. The warping path W must begin with w 1 ¼ 1; ð 1Þ and end with w K ¼ M; ð NÞ for ensuring that every coordinate in M and N appears in W. In addition, i and j of w i; ð jÞ in W must be monotonically increased, which means: The result warping path is the one with the shortest distance D given as follows: where Dist i; ð jÞ ¼ x i − k y j k, x i and y j are the i th and j th elements of phase X and phase Y.The aim of the algorithm is to find out the final warping path w that minimizes D M; ð NÞ by using dynamic programming.
Figures 5 and 6 show the results of DTW algorithm.As shown in the figure, the curve of the measured phase profile and the theoretical phase profile matches well.DTW algorithm uses global matching to get the best matching point.The point in the measured phase curve which corresponds to the inflection point of the theoretical phase curve after DTW is considered as the time when the tag passes y-axis.4.3.Generalized Cases.In this subsection, we discuss three more generalized situations.First, we assume that the tag moves along a straight line which is not parallel to x-axis at a constant speed.The point closest to the antenna is not on the line perpendicular to plane of the antenna, which means the x-coordinate of the inflection point of the phase profile does not correspond to the time when the tag passes the y-axis.To handle this problem, we deploy one more antenna and try to find the inflection point by jointly considering both of their phase values.As shown in Figure 7, two antennas are on the y-axis, opposite to each other.The inflection points happen when the tag is located at p 1 and p 2 .Let t 1 , t 2 , and t be the time when the tag passes p 1 , p 2 , and the y-axis, respectively.Time t can be given by the following formula: where a 1 and a 2 means the distance from p 1 to A and that of p 2 to B. According to Section 4.1, t 1 and t 2 can be calculated.
If the value of a 1 and a 2 can be obtained, then we can get the time t as desired.To do so, we can deal with a 1 and a 2 individually.Hence, the problem is reduced to one-antenna case.As shown in Figure 2, the antenna is at the origin and ð bÞ.When the tag moves at a constant speed of v along the x-axis, the location of the tag is a − ð vt; bÞ at the time t.Hence, the distance d at the time t is given as follows: Substituting Equation (8) in Equation ( 1) and remove the periodical pattern of the phase profile, we get the phase value: Deforming the formula, we have: where a, b, and v are considered as constants and θ and t are variables.This formula shows that the curve of the phase profile is actually half of a hyperbola.Hence, we can get the estimates of b by using one of the existing curve-fitting algorithms of hyperbola.Then, we can use this method to calculate a 1 and a 2 in Equation ( 7) and finally calculate the desired time t.However, when the tag does not move at a constant speed, the above method does not work.As a result, we propose a new method by jointly considering the phase measurements from the two antennas.As shown in Figure 8, when the object moves, we assume the distances from the tag to the two antennas are d 1 and d 2 and the distance between two antennas is d.Obviously, d 1 þ d 2 ≥ d because the sum of the two sides of a triangle is greater than the third.The value of d 1 þ d 2 reaches the minimum when the object passes the y-axis.Assume that the phase values of the object read by the two antennas are θ 1 and θ 2 , respectively, then we can get the formula according to Equation (1): As aforementioned, the sum of the two phases also first repeatedly reduces from 2π to 0, and then suddenly changes to 2π.When the object passes the y-axis, the sum reaches a local minimum and then starts to increase from 0 to 2π.So, the figure of θ 1 þ θ 2 also has an inflection point with x-coordinate corresponding to the time when the object passes the y-axis, which is similar to the method we introduced in Section 4.1.We also determine this by calculating the first-order derivative and the point whose first-order derivative is equal to 0 is just the inflection point and its x-coordinate is just the line crossing time that we want to get.
Note that the method we introduced above also works when the tag does not move linearly, as shown in Figure 9.In this case, the minimum of the sum of the two phases also holds if and only if the tag crosses the y-axis.Therefore, the same method can be used to infer the time when the tag's trajectory is a curve.Imagine the following situation, the tag turns back before passing the y-axis.As shown in Figure 10, in this case, the phase value also has an inflection point, which shall be treated as a line crossing event by mistake.To handle this problem, we change the deployment of the two antennas by rotating each of them a certain angle, which is shown in Figure 11.The basic idea is intuitive; if the tag turns back in the interrogation zone, its first read and last read will be collected by the same antenna.Otherwise, if line crossing happens, the two reads are expected to be collected by different antennas for sure.Besides, if the turning back event happens, one antenna shall read the tag longer than the other antenna, which the feature shall also be used to determine a cross event.The two features form the basis of our method.Suppose the antenna A collects n reads from the tag and the set of the correspond time stamps is denoted as T A ¼ t A; 1 ; t A; 2 ; …; t A; n t i ≤ j t j j 0<i<j ≤ ð nÞ.The antenna B collects m reads from the tag and the set of the correspond time stamps is T B ¼ t Define a feature vector F for each antenna with the length of ω.If there is a time stamp falling in the time slot X i , then the intermediate time x i of the time slot is added to the time stamp feature vector F: For each antenna, we calculate the mean of the elements in the first half and second half time stamp feature vectors given as follows: In general, in the case of an inflection point occurs, the following two cases show that the tag passes the line: Next, we consider the case when the object keeps still for a long time.Since our methods determine a line crossing with the local minimum value of the phase (the first-order derivative is equal to 0).However, as shown in Figure 12, the phase value in this case doesn't change when the tag keeps still and the long flat stage in the curve may be treated as the inflection point by mistake.To remove the impact of the long flat area in the curve, we construct a sliding window and calculate the entropy of the entire dataset.If the phase value in the window doesn't change, its entropy is small and data in this window will not be treated as the inflection point.Then, the method for calculating the entropy is given below: where E is for entropy, M represents the number of phase values in the sliding window, and p i represents the frequency of each phase value.If E is over a threshold γ, it is considered Wireless Communications and Mobile Computing that the phase changes significantly within this sliding window.Otherwise, the inflection point is not in this window.
Then, the sliding window will move forward and repeat the calculation.The threshold γ can be determined through empirical study.We can measure entropies from some tags and calculate the mean value e m of these entropies.After that, we can let γ equal to 3e m and use it to pick out likely clone tags.
4.5.Enhancement with Kalman Filter.RF-Line leverages phase measurements obtained from two antennas to estimate the target's position.However, environmental factors and ambient motion are likely to affect phase measurements sometimes, lowering localization accuracy.To alleviate this problem, a Kalman filter can be applied to refine the estimates and reduce the influence of outliers.The Kalman filter consists of two main steps: the prediction step and the correction step.In the context of RFID-based localization, the prediction step predicts the target's new position based on its previous state and known dynamics.The correction step then adjusts this prediction based on the incoming phase measurements.
As shown in Figure 4, the phase curve can be approximatively treated as a straight in a small time window; RF-Line uses a linear function to predict the phase measurement, which can be written as follows: where F represents the state transition matrix and x k is the phase estimate at time k.The corresponding error covariance can be written as follows: where P k is the error covariance matrix and Q is the process noise covariance matrix.
In the correction step, we estimate the phase value by the phase measurement and x hat k ; the progress consists of follow steps, which can be written as follows: where z k is the measured phase, H is the measurement matrix, and R is the covariance matrix of measurement noise.
The term x k is the output of Kalman filter, which can be used to remove the impact of ambient motion.This approach enhances the reliability of RF-Line, making it more robust to outliers and improving the overall performance of line crossing detection.
4.6.Frequency Hopping.In RF-Line, we need to collect the phase profile under a fixed channel, which is fine if a reader is allowed to communicate with the tag at a fixed frequency.For example, Impinj R420 is allowed to communicate with tags with a fixed frequency in China.However, in some countries such as USA, FCC compliant RFID readers need to use frequency hopping, where time is divided into small time windows (e.g., 0.2 s in R420) and a random frequency is used in each window to collect information from tags.To generalize our solution, discuss how can we make the algorithm FCC compliable.The frequency hopping introduces additional phase offset, which can affect the performance of RF-Line.To address this issue, we need to remove the phase offset and merge the phase measurements obtained from different time windows (frequencies).Let θ 1 and θ 2 denote the phase values measured at the frequency f 1 and the frequency f 2 , respectively.The distance between the reader and the tag is represented as d.The phase offset can be expressed as follows: where c is the speed of light.In this equation, c, f 1 , and f 2 are known, and the problem is to compute d.Since the time window is short, we approximatively consider the distance d as a static value within a small time window.Let θ i be the first phase value measured in time window i, and θ i−1 0 be the last phase measured in the preceding time window θ i−1 0 .Since the sampling rate of a commodity RFID reader is high, the two phase values are measured adjacently and can be regarded as measured from the same position.Thus, we can derive Δθ as θ i − θ i−1 0 .By substituting Δθ into Equation ( 22), we can compute the distance d i and use it to normalize all data measured in the ith time window.It is worth noting that the hopped frequencies are randomly determined in a common frequency hopping system.However, in a commercial RFID system, the frequencies can vary randomly or in a predefined order (e.g., from the lowest one to the highest one).The difference is that the RFID reader can obtain frequency information in each tag inventory.

Implementation and Evaluation
In this section, we implement a prototype of RF-Line with commodity RFID devices.The performance is compared with the state-of-the-art RFID localization method and the baseline solution we mentioned before in terms of accuracy.
To ensure the result is general, we run each setting 100 times and show the results on average.The details are given below.
5.1.Implementation.As shown in Figure 13, we build a prototype of RF-Line in our lab.The system mainly consists of two parts: an RFID module and a robot module.The RFID module consists of an RFID reader, two antennas, and several commodity RFID tags.The reader model is Impinj Speedway R420 [38] whose working frequency is ranging from 920 to 924 MHz.The antenna model is Laird S9028PCL [39] with 8 dBm signal gain.The two RFID antennas are deployed in opposite directions and both of them are connected to the same reader through a cable line.The tag model is Impinj H47 [38].The valid data acquired by the reader will be forwarded to a backend server through Wi-Fi.We use the Robot Operating System (ROS) to synchronize the clock of the reader and the backend server.The robot module consists of a robot and several RFID tags.We stick tags to the robot, which is used to perform line crossing.The robot model is TurtleBot2 [40].
Its moving trajectory can be controlled through programming.The ground truth is recorded through a camera.The development software of RF-Line is Java, which adopts the Low-Level Reader Protocol (LLRP), specified by EPCglobal in its EPC Gen2 standard, to communicate.The host computer is a laptop with an Intel Core i5-8250U 1.8 GHz CPU and 8 GB RAM.

Accuracy.
In this subsection, we set up the real scenarios and compare the accuracy of RF-Line with a state-of-the-art localization method called Tagoram [12] and the baseline solution we mentioned before in the same scenarios.We use the exact passing line time obtained by the camera as ground truth.Tagoram is a localization work, which can also be used to detect passing line time obviously.We study the impact of different parameter settings on distance error and compare the performance of our method and Tagoram under different scenarios.We keep collecting phase values from the tag while the tag on the robot is moving in three different trajectories: straight line, slanted line, and curved line, respectively, denoted as case 1, case 2, and case 3.Then, we observe the distance errors of RF-Line, baseline solution, and Tagoram.As shown in Figure 14, the distance errors of Tagoram, baseline solution, and RF-Line are 7.90, 6.68, and 4.47 cm, respectively, in straight line scenario.The distance errors of Tagoram, baseline solution, and RF-Line are 9.01, 7.85, and 6.23 cm, respectively, in slanted line scenario.The distance errors of Tagoram, baseline solution, and RF-Line are 11.33, 9.94, and 7.48 cm, respectively, in curved line scenario.Wireless Communications and Mobile Computing Among the three scenarios, RF-Line can achieve the best distance error with the straight line, and the worst distance error with the curved line.Figure 15 shows the cumulative distribution function (CDF) of the localization errors.The similar conclusion can also be drawn: RF-Line performs the best, baseline follows, and Tagoram is with the biggest error.
Next, we discuss some factors that may affect accuracy, i.e., the speed of object movement, the number of tags, and the angle of antenna rotation.

Impact of Moving Speed.
In the experiment, we vary the speed v of the robot from 20 to 45 cm/s, which covers most of the situations in practice.As shown in Figure 16, the results show that RF-Line performs best at all testing speeds.The distance errors are 4.47, 5.01, 5.48, 5.55, 5.82, and 7.39 cm when the speed is 20,25,30,35,40, and 45 cm/s.Besides, it's worth noting that the detection error increases as the speed of robot increases.This is because a higher speed will affect the channel condition, which shall result in some error in the phase values used in our method.5.2.2.Impact of Number of Tags.Sometimes, the system may be used to detect multiple line crossing events at the same time.However, more tags will decrease the sampling rate of the reader for each tag, which shall have a bad effect on the detection accuracy.To study this impact, we vary the number of tags used in the system and test the corresponding accuracy.In all experiments, the robot moves along a straight line at a constant speed of 20 cm/s.As shown in Figure 17, the distance error is 5.69 cm when the number of tags is 200, which is 1.24 cm bigger than noninterference condition.Clearly, the error is not large as well.The results illustrate that the number of tags have very small impact on our method.5.2.3.Impact of Antenna Placement.Next, we collect the data when the two antennas use different rotation angles.We rotate the angle of two antennas from 5°to 30°, and observe the detection accuracy.The results are shown in Figure 18.
As we can see, the distance error increases as the rotation angle increases.This is because the rotation of the antenna will result in some errors in its phase measurements.A larger angle causes a lower detection accuracy.However, a higher angle is help to detect the turning back event, and it will be discussed in next subsection.5.2.4.Impact of Ambient Motion.Next, we test the impact of ambient motion on the estimation accuracy.We test RF-Line in three different rooms and compare the results with the condition without ambient motion.The results are shown in Figure 19.As we can see, the accuracy is close to the scenarios without ambient motion.The distance error is 6.7, 6.5, and 7.0 cm, which can meet the requirement of most applications.This positive result is in part because we leverage the Kalman filter to alleviate effects of the noise caused by ambient motion.In addition, ambient motion usually happens    Wireless Communications and Mobile Computing occasionally and will not last for a long time, which means that the outliers are only a small subset of the entire phase profile, which lowers the negative impact on the accuracy.
5.2.5.Impact of Tag Orientation.Next, we test the impact of tag orientation on phase measurement.As shown in Figure 20, we rotate the angle of tag 0°to 360°and observe the phase measurement.The results are shown in Figure 21.
As we can see, the phase value nearly unchanged with the rotation of the tag (the tag model is H47, a circularly polarized tag produced by Impinj Inc.).The maximum phase difference is 0.83 rad, which is much smaller than the impact of tag movement.These results demonstrate that RF-Line is robust against tag orientation changes, ensuring consistent and accurate line crossing detection regardless of the tag's orientation.

Detection Accuracy of Turning Back.
In this subsection, we discuss whether the object can be detected correctly when it turns back while moving.In order to determine detection accuracy, we set two types of experiment: passing the barrier line and turning back without passing the barrier line.We rotate the angle of two antennas from 5°to 30°.The detection accuracy increases as the degree increases; however, the distance error also increases as the rotation angle increases as we mentioned before.Jointly considering the two factors, we choose to set the antenna rotation angle to 20°and test the detection accuracy in the three trajectories.As shown in Figure 22, when the angle is set to 20°, precision and recall reach around 95% in all three trajectories, while the distance error is less than 5.77 cm.

Related Work
Existing solutions to line crossing detection generally fall into three categories: infrared sensor-based systems [7,8], camera-based systems [9][10][11], and virtual wall [4][5][6].Infrared sensor detects line crossing by measuring infrared light radiating from objects.It can detect a line crossing when the object is closed to sensors, which is widely used in an access control system.Camera-based system recognizes object moving through image processing.By observing the pixels of the object, the line crossing event can be detected as well.

Wireless Communications and Mobile Computing
In robotics, a robot constructs the virtual wall, which is an invisible barrier that the robot cannot cross.When the robot is close to the virtual wall, its navigation system will give immediately change its moving trajectory.These line crossing systems have already been widely used but they still do not run well in many practical cases, i.e., multiple objects or people cross the line at the same time.
RFID, as a noncontact passive sensing technology, can solve this problem.There is no straightforward solution to line-crossing detection.RFID localization initially appears to be a potential solution, which can be categorized into two types: received signal strength indicator (RSSI)-based methods and RF phase-based methods.RSSI-based methods [15,41] usually appear in some early works.These methods commonly need to deploy a large number of reference tags whose positions are known.Due to the low resolution of RSSI and the restrictions of deployment, it is not a very good choice for localization.In recent years, the research starts to shift to using RF phase for RFID localization.The competitive advantage of RF phase is that it provides us with a high-resolution measurement of the signals when the tag-reader communication distance varies.Many advanced phase-based methods have been proposed for dealing with different scenarios, especially for mobile localization.
Tagoram [12] tracks moving objects, which achieves a very high accuracy when the trajectory and speed of the object are known in advance.D-watch [42] implements a device-free localization, which does not require any device attached to the target.The basic idea of D-watch is that the signal power will experience a drop when a target blocks the signal's propagation path.See-through-walls [43] can track moving objects through walls by deploying reader, antenna, and tag array on the other side of the wall of the room to be inspected.It measures the phase of the tag array when in the absence of anyone in the room in advance and compares it with the situation when someone enters the room.RF scanner [31] mainly focuses on the localization of the books in library.It moves the antenna to determine the order of books along the moving direction.When the antenna passes through the tag in a straight line at a constant speed, the phase image is the above half of the north-south opening hyperbola.Direction of arrival [44] can estimate the direction of tag by using linear phased array, which is widely used in electromagnetic and acoustic fields.However, the distance between two antennas needs to be kept below λ=2 (about 16 cm).In spite of these advancement, the localization-based solutions need complicated system deployment, accurate calibration, or high computation overhead.
The most related work is localization of RFID tags moving on a conveyor belt.The work [45] uses the reader antenna's radiation pattern together with the RSSI threshold to determine the order of tagged tires on the conveyor belt.It, however, cannot figure out when the tagged tires go across a given line and also suffer from environmental affects.The work [46] jointly uses synthetic-array radar principles, knowledge-based processing, and the reader-tag communication signal to track tagged items moving along a conveyor belt.The above solutions, however, are tailored to the applications of conveyor belt, which require to know the trajectory and speed of the object.

Conclusion
Line crossing detection is quite common in our daily life.In this paper, we propose a lightweight method called RF-Line that deploys two antennas opposite to each other to track the objects crossing a given barrier line, without any complicated system deployment or calibration.By concurrently collecting the RF phase and jointly estimating an inflection point by two antennas, RF-Line is able to know whether and when a tagged object crosses the line connecting the center of the two antennas.We implement a prototype of RF-Line with a commodity RFID system.Extensive experiments show that RF-Line can achieve a high tracking accuracy with a small error of 6.1 cm.

FIGURE 3 :FIGURE 2 :
FIGURE 3: Derive the trajectory chain according to the phase change.

FIGURE 8 :FIGURE 9 :
FIGURE 8: Calculate the phase sum of two antennas.

FIGURE 12 :
FIGURE 12: Use sliding window to calculate entropy.

FIGURE 17 :
FIGURE 17: Impact of number of tags.
Divide I into ω slots with the length of δ, we have ω ¼ dt end − t start =δe.Then, the i th slot interval is: B; 1 ; È t B; 2 ; …; t B; m t i ≤ t j 0<i<j ≤ m ð Þ g .The minimum time stamp correspond to the start point is t start ¼ min t A; 1 ; À t B; 1 Þ, and the maximum time stamp is t end ¼ max t A; n ; À t B; m Þ; they form the interval I ¼ t start ; ½ t end .