# ANTSpin: Efficient Absolute Localization Method of RFID Tags via Spinning Antenna
## 5 Materials and Methods
### Data Processing  
The collected data are dirty due to the effects of multipath effects and the like. Figure 7 shows the Phase and Doppler Frequency data that were collected. It is obvious that the data are messy and it is impossible to mine effective information. Figure 8 shows the collected RSSI data and one color represents a tag. RSSI of four tags in the same column changes, as: (a), the closer the tag is to the antenna, the stronger the signal; four tags in the same row change as (b), and the tags sequentially collect the RSSI data during the rotation of the antenna. The graphics level is relatively clear, so RSSI data is used to further mine effective information.  
Figure 9a shows the RSSI data of a tag collected. Obviously, there are interference data on the left and right. Reflection generates most of them. The middle peak is valid data. The timestamp between the interference data and valid data is mostly discontinuous. According to this characteristic, the obvious interference data is first eliminated, and the valid data of the middle large block is extracted, as shown in Figure 9b. We need to extract the maximum value of the peak, and the data below the peak is also useless, so further intercept the data according to the rotation time on both sides of the maximum value, such as intercepting the data within the 5 s interval around the timestamp of the maximum value, as shown in Figure 9c.  
The obtained RSSI data are one-dimensionally discrete, and also present fluctuations. Therefore, we use a filtering algorithm to process. The commonly used filtering algorithms are Butterworth low-pass filtering, median filtering, Gaussian filtering, wavelet transform, Kalman filtering, and so on. After the experiment, the one-dimensional discrete wavelet transform is the most ideal. The wavelet is a small-area wave. It is a special waveform with limited length and an average value of 0. It retains the trend of the original data and reduces data fluctuations, as shown in Figure 10.  
Figure 8: RSSI data changes. (**a**) In one row; and, (**b**) in one column.  
Figure 7: Data of Phase and Doppler Frequency.  
If we take the maximum value directly to the data sequence, it will definitely cause a large error, so we first use the quadratic function to fit the data. In formula (5), \(\mathrm{P_{t}}\) is the fitted value, and the least squares method is used to minimize the deviation \(Q\). For the unknown parameter, \(y\) is the actual value in Equation (6). According to the extreme value theorem, to minimize \(Q\), the partial derivative must be 0, and then formula (7) can be generated.  
\[\mathrm{P_{t}}=at^{2}+bt+c \tag{5}\]  
\[Q=\sum\left[y-(at^{2}+bt+c)\right]^{2} \tag{6}\]  
\[\left\{\begin{array}{l}\frac{\sigma Q}{d}=-2\sum\left(p-at^{2}-bt-c\right)t^{ 2}=0\\ \frac{\sigma Q}{b}=-2\sum\left(p-at^{2}-bt-c\right)t=0\\ \frac{\sigma Q}{c}=-2\sum\left(p-at^{2}-bt-c\right)=0\end{array}\right. \tag{7}\]  
Through the fitting curve equation, the RSSI maximum value and its corresponding timestamp can be obtained more accurately. Figure 11 shows the fitting effect.  
Figure 10: Wavelet filtering.  
Figure 9: Data segmentation and interception. (**a**) Raw data; (**b**) After segmentation; and, (**c**) After interception.