# An Accurate Direction Finding Scheme Using Virtual Antenna Array via Smartphones
## 4 Design
### Leveraging Gyroscope of the Smartphone  
Our system is based on the hypothesis that users hold the smartphone still and rotate their body for \(360^{\circ}\) in a constant speed. However, in practice, the moving velocity of the smartphone is always changing, which causes the VUCA to become a nonuniform circular array. Hence, we need to reduce the impact of changing velocity of the smartphone to our system.  
In order to reduce the impact of the inconstant velocity of body rotation, we need to calculate the rotated angle in each of the sampling points during the sampling process. For correcting the error caused by the nonuniform array, we decide to leverage the gyroscope of our smartphones to select the proper sampling point to construct the virtual uniform circular array. The gyroscopes are the common inner sensors of most smartphones. The gyroscope is available to measure the rotational velocities of the smartphone itself in three-dimensions. This means that we can detect the rotated angle of the moving smartphone in real-time by leveraging the gyroscope of the smartphone. In Figure 4, we assume that a user holds the smartphone still and rotates his body for \(360^{\circ}\) at an arbitrary velocity. During the sampling period, the smartphone moves horizontally. According to the outputs of the gyroscope, we calculate the opening angle from the \(y\)-axis in the user's phone coordinate system (UCS) to the one in a world coordinate system (WCS) by using the transform function from UCS to WCS. Hence, we let the sampling points uniformly distribute on the moving trajectory through setting a constant angle interval. In other words, we partition the samples by the constant angle interval instead of the time interval. Now, we represent the array elements by \(\gamma_{n}\):  
\[\gamma_{n}=n\gamma(n=1,2,3...m;\gamma_{n}\leq 360^{\circ}). \tag{35}\]  
Figure 4: User’s phone coordinate system (UCS) to world coordinate system (WCS) when the phone is horizontal.  
Here, \(m\) is the number of sampling points and \(\gamma\) is the sampling interval that we set. Notice that the \(\gamma_{n}\) here represents the position of VUCA's array element, and it is independent of the azimuth angles of the target signals. However, the leveraging gyroscope of the smartphone during every sampling process will increase the calculation amount of our system. For optimizing system efficiency, we only leverage the VUCA-gyroscope system for direction finding under some particular circumstances. First, during the whole sampling period, we calculate the standard deviation of the shifty angular velocity of the body rotation by the outputs of the gyroscope. Then, according to the extensive experiments, we figure out the threshold of the standard deviation to distinguish whether the user is moving the smartphone at an approximate constant velocity or variable velocity. Finally, we use the VUCA-gyroscope system when the standard deviation of the angular velocity exceeds the threshold value. Otherwise, we use the common VUCA system. We will describe how to set the threshold in Section 5.6.