# Localization of a BLE Device Based on Single-Device RSSI and DOA Measurements
## 5 Single Scanner-Based DoA Estimation
### Space-Time Data Processing and Fusion Method  
The RSS data collected over varying heading directions with the measurement configuration shown in Figure 2 typically show large random variations, which are the result of small-scale fading effects in multipath radio propagation environments. Similar to the idea of removing the small-scale fading effects through local averaging as presented in [26],  
Figure 2: A smartphone is used as a scanner to take simultaneous measurements of the RSS of the BLE beacon signals and the heading direction of the phone. in this paper, we propose a systematic space-time data processing and fusion method to combine the RSS and heading measurements collected at multiple locations to derive reliable DOA estimation from BLE beacon signals. The basic idea of the proposed data processing and fusion method is illustrated in Figure 3. With the proposed method, at location P\({}_{1}\) shown in Figure 3, a user uses a scanner device to take simultaneous measurements of RSS and heading direction, as illustrated in Figure 2. Then, the user steps aside to a nearby location P\({}_{2}\) to take another set of measurements of RSS and heading direction. As defined in Equation (1), each measurement data sample consists of three parameters, including a timestamp, RSS, and heading, which are captured concurrently. The two locations can be one or two steps apart (i.e., approximately one to two feet apart). There are no strict requirements or constraints on the relative positioning of the two locations, except that the distance between the two scanner measurement locations \(d_{\text{ss}}\) is much smaller than the distance between the target BLE beacon device and the scanner measurement locations \(d_{\text{ts}}\). Additionally, there is no need to know the exact values of distances \(d_{\text{ss}}\) and \(d_{\text{ts}}\). The block diagram of the proposed space-time data processing and fusion method is illustrated in Figure 4. With this method, the measurement data collected from each location are first processed through two functional blocks for data binding and denoising over the time axis. In the temporal data binding operation, for each location, the time axis of measurement data is segmented into a total of \(N_{t}\) consecutive bins of an equal time duration \(\delta_{t}\). Then, the data within each time bin are combined using the median, i.e.,  
\[P_{r}[n] =\text{med}\{P_{r}(t)\mid t\in[\tau_{n},\,\tau_{n+1})\}, \tag{2}\] \[\theta[n] =\text{med}\{\theta(t)\mid t\in[\tau_{n},\,\tau_{n+1})\}, \tag{3}\]  
for \(0\leq n<N_{t}\), where \(\tau_{n}\) and \(\tau_{n+1}\) are the boundaries of the \(n\)th time bin. Here we use the median instead of the average to combine multiple measurements within each time bin for noise reduction because it is well known that the median is more statistically robust to outliers than average while outliers are often observed in RSS measurements [26]. Due to the variable delays in the networking protocol stack, the timestamps of measurement data are irregularly spaced. Thus, another benefit of data binding over the time bins of equal width is that after binding, the data samples are in the form of an equally-spaced discrete time sequence, which is well suited to further processing with discrete time-signal processing algorithms. The denoising over time axis is obtained using the well-known exponentially weighted moving average (EWMA) filter [32], i.e.,  
\[\hat{P}_{r}[n] =w_{p}P_{r}[n]+(1-w_{p})\hat{P}_{r}[n-1], \tag{4}\] \[\hat{\theta}[n] =w_{\theta}\theta[n]+(1-w_{\theta})\hat{\theta}[n-1], \tag{5}\]  
for \(0<n<N_{t}\), where the weighting parameters are set to values between 0 and 1; that is,  
Figure 3: Measurements of the RSS profile over heading direction are taken at two locations that are a small distance \(d_{\text{ss}}\) apart. \(0<w_{p}<1\) and \(0<w_{\theta}<1\). The boundary sample at \(n=0\) is set without weighting, i.e., \(\hat{P}_{r}[0]=P_{r}[0]\) and \(\hat{\theta}[0]=\theta[0]\).