## 5 RF Switch Model  
Theoretically, all antennas within an array should sample the signal at the same time at each antenna port. However, this would require each antenna to have its own RF front-end, which includes components such as analog-to-digital converters, filters, mixers, and low-noise amplifiers. Unfortunately, incorporating such analog components for each antenna would lead to increased power consumption, physical size, and higher costs for constrained embedded IoT devices. To address these challenges, it is more appropriate for the array to have a single RF front-end and an RF switch, enabling each antenna to utilize the RF front-end at different times. The Bluetooth protocol considers this radio architecture for its direction-finding capability, and in this research, we opted to utilize the switching protocol outlined in the Bluetooth 5.1 specification [4] with an L-shaped array. Bluetooth utilizes Gaussian Frequency-Shift Keying (GFSK) where 0s and 1s are modulated into different frequency shifts [26]. The two frequencies are equal to the central frequency (\(f_{c}\)) in addition to a frequency deviation (\(\pm f_{\Delta}\)). To comply with the theoretical assumption, the signal should be stationary, that is, a signal with a constant time-frequency is desirable. Thus, the transmitter (signal source) sends a Constant Tone Extension (CTE), composed of a continuous series of digital ones, so the frequency remains the same during the IQ sampling. Notably, if the signal were non-stationary, DOA methods would be more complex [27]. During the CTE, the first 4 \(\upmu\)s is the guard period. The reference period, which takes 8 \(\upmu\)s, is the beginning of the IQ sampling operation but only one antenna of the receiver (anchor node) carries out the sampling operation. Only one single IQ sample is performed per 1 \(\upmu\)s, totaling eight IQ samples. Afterward, a series of sampling and switching operations begin, which is referred to switch-sample period. The switch and sample slot last 1 \(\upmu\)s or 2 \(\upmu\)s; in this research we consider 1 \(\upmu\)s time slot. For every switch slot, the RF switch device switches from one antenna to another, so that another antenna can acquire a single IQ sample during the next sample slot. Since this research considers a 1 \(\upmu\)s time slot, there are 74 sample slots in the switch-sample period. Figure 4 depicts all operations during the CTE. Bluetooth low energy signals can be considered narrowband when using 1 MHz bandwidth in indoor scenarios where the typical delay spread is between 20 ns and 60 ns [28]. Therefore, BLE satisfies the narrowband premise in Section 3, if we take into account all the cited assumptions as well, the mathematical model is the same as Equations (2) and (3) in addition to the phase shift due to the RF switch. Without AWGN, the phase shift between two consecutive samples in the reference period was reported to be about 80\({}^{\circ}\)-100\({}^{\circ}\)[29]. These numbers double for two consecutive samples in the switch-sample period. As a result, it is imperative to develop a phase compensation to make the DOA method work properly. As previously mentioned, the transmitter sends a continuous signal representing digital ones which is the CTE where its carrier frequency \(f_{c}\) is between 2402 MHz and 2480 MHz depending on the used channel. The narrowband incoming signal can be expressed in a complex format in Equation (27) [18],  
\[u(t)=\text{Re}(s(t)e^{j2\pi f_{c}t})=I(t)\cos 2\pi f_{c}t-Q(t)\sin 2\pi f_{c}t \tag{27}\]  
where \(t\) is the time, and \(s(t)=I(t)+jQ(t)\) is called the complex envelope. However, that frequency in order of gigahertz is too high for the ADC, so the receiver RF front-end performs complex downconversion also known as quadrature demodulation. That operation outputs the in-phase and quadrature (IQ) components of \(u(t)\) in the baseband in such a way that the central frequency (\(f_{c}\)) corresponds to a DC [29].