The STM32WB09 and STM32WB05 MCUs support the Bluetooth® LE Direction Finding Angle of Arrival (AoA) and Angle of Departure (AoD) features. This document provides the key concepts related to the Bluetooth LE Direction Finding, and some information about how these features can be supported by STM32WB09 and STM32WB05 MCUs.
1. Introduction
Bluetooth® Core Specification v5.1 introduced Direction Finding feature, enabling the Bluetooth technology to support high accuracy location services and several new applications. There are some advantages compared to other technologies::
- It is a less expensive solution compared to Ultra Wide Band (UWB)
- It does not need the locator to be within 20 cm of the tag, as required for the NFC
- Thanks to its battery-operated nature and its low power consumption feature, it is advantageous when compared to the Wi-Fi® tracking.
Possible use cases are:
- Point of interest information (proximity solution)
- Item finding (proximity solution)
- Asset tracking (real-time locating system)
- Wayfinding (indoor positioning system)
1.1. Direction finding fundamentals
Direction finding is based on sampling of In-Phase and Quadrature (IQ) components of the received signal on a given antenna. The sampled data are then provided to the host through the host controller interface (HCI).
Each sample can be represented as a point in cartesian coordinates. The application can transform this point using polar coordinates in order to extract its phase. Given the geometry of the antenna array, the phase difference of the signal related to two different antennas is used to calculate the direction of the signal. The algorithms used to calculate the angle of the incident wave are not defined by Bluetooth Core specification: the application needs to implement its own algorithm.
IQ data |
---|
Radio Signal on Antennas |
---|
1.2. Constant tone extension (CTE)
The direction-finding feature is based on the CTE introduction at the end of the link layer packets: this field provides constant frequency signal, against which IQ sampling can be performed in line with Bluetooth Core specification v5.1.
Within the CTE field, only a series of unwhitened 1s are sent, which generates a sine wave with a frequency deviation of:
- +250 kHz @ LE_1M
- +500 kHz @ LE_2M
- Not supported on LE coded
The CTE field has a configurable length, which can vary between 16 and 160 µs.
2. AoA/AoD
The Bluetooth direction finding feature supports two methods for determining the direction of a Bluetooth signal, both are based on the use of an antenna array.
2.1. AoA (Angle of Arrival)
In the Angle of Arrival method, the transmitter uses a single antenna.
The receiver has an antenna array and takes IQ samples while switching between antennas during the reception of the CTE, so that it can calculate the direction of the received signal.
The IQ samples are taken during the sample slots, which can have a duration of 1 or 2 µs. The switching of the antenna is done during the CTE.
Common use cases are:
- RTLS (real-time locating system)
- Asset tracking, ID location
- Item finding
In this case the transmitter is very simple, and all the complexity is on the receiver's side.
2.2. AoD (Angle of Departure)
In the Angle of Departure method, the antenna array is on the transmitter's side. During the CTE, it switches between antennas.
The receiver has a single antenna and it takes IQ samples at regular instants inside the switch slots. By knowing the parameters of the antenna array, it can calculate the direction of the received.
Common use cases are:
- Indoor positioning system
- Wayfinding (airport, hospitals)
- Point of interest information
2.3. Connectionless or connection-oriented
AoA and AoD can be used in connectionless or connection-oriented communications.
- Connectionless method makes use of periodic advertising and CTE field present in existing AUX_SYNC_IND and AUX_CHAIN_IND PDUs.
- Connection-oriented direction finding needs a new PDU, the LL_CTE_RSP, which is sent in response to an LL_CTE_REQ.
3. Antenna arrays
Theoretically, for angle estimation, at least two antennas are needed. In practice, more antennas are required for an acceptable accuracy. The number of antennas not only affects the accuracy of the estimation, but also the computational time of the algorithm. The array types can be uniform or non-uniform. Among the uniform antenna arrays, three types are the most used and present in technical literature:
- Uniform linear array (ULA)
- Uniform rectangular array (URA)
- Uniform circular array (UCA)
ULA antenna array is compatible with all direction of arrival (DOA) algorithms. Some DOA algorithms can operate on every type of array, while others can be used only for a specific type, such as on ULAs. Moreover, ULA arrays allow to estimate the direction of the incoming signal only in a bidimensional space. Estimation in a three-dimensional space, needs URAs or UCAs.
The number of antennas not only affects the accuracy of the estimation but also the computational time of the algorithm.
Number of antenna versus accuracy versus computational time |
---|
3.1. Antenna arrays comparison: pros and cons
- ULA runs simpler algorithms.
- ULA estimates azimuth, URA and UCA estimate elevation too.
- ULA is better than URA and UCA near the broadside; it is worse along end-fire directions.
- UCA and URA symmetry: ability to scan azimuthally with little change in resolution.
- URA is better then UCA in resolution.
- ULA and URA: MUSIC spectrum has ambiguities along two directions.
- UCA: more complexity for DOA algorithms.
4. Direction finding algorithms
Direction of arrival (DOA) methods are used to extract information of the direction from IQ samples.
The IQ samples taken by the radio contain all the information needed by the application to estimate the direction of the received signal. The information about the direction can be taken by multiple locators to obtain the position of the source of the signal. Several studies have been undertaken in past decades to find good algorithms for direction estimation. Different methods can be found in technical literature, they are not in the scope of the Bluetooth LE specification, which only defines the framework for generating the IQ samples.
Some of these methods, each with its complexity and accuracy, are listed below:
- Least squares
- Maximum likelihood (ML)
- Beamscan
- Averaged periodograms (such as Bartlett’s method)
- Minimum variance distortion less response (MVDR)
- Multiple signal classification (MUSIC)
- Iterative sparse asymptotic minimum variance (SAMV)
- Estimation of signal parameters via rotational invariant techniques (ESPRIT)
Each manufacturer can choose the best algorithm for his purpose and implement its own solution. In the section sections, the MUSIC and Bartlett algorithms are described in their fundamental features.
4.1. MUSIC (Multiple Signal Classification) algorithm
This is the most used method for direction estimation, since it has a good accuracy with not too much complexity, compared to other types of DOA methods. The algorithm is based on the singular value decomposition of a correlation matrix, and on the calculation of a pseudo-spectrum function. Despite its high-resolution capability, the main disadvantage of this method is the inability to resolve coherent sources, which can be easily present in an indoor environment, where several reflections of the same signal are possible.
4.2. Bartlett algorithm
Bartlett (conventional beamforming method) algorithm scans across the angular region of interest to find the direction that produces the largest output power. Compared to MUSIC it is a more recent method, with less computational complexity, but also less resolution. This means that it cannot resolve two different sources close to each other. Unlike MUSIC, Bartlett’s method is not sensitive to coherent sources.
4.3. MUSIC vs. Bartlett
MUSIC algorithm main features:
- The most used method for direction estimation.
- Good accuracy.
- Medium complexity.
- High resolution.
- Bad with coherent sources (reflections).
Bartlett algorithm main features:
- Lower computational complexity.
- Lower resolution compared to MUSIC.
- Not sensitive to coherent sources.
5. STM32WB0 series and direction-finding support
STM32WB09 and STM32WB05 devices support the Angle of Arrival (AoA) and Angle of Departure (AoD) feature by:
- appending a new field called Constant Tone Extension to the Link Layer packets
- managing the antenna switching mechanism for both AoA and AoD, by using a control signal called ANTENNA_ID. This signal is handled in real-time by the internal sequencer. A 7-bit antenna identifier indicates the antenna number to use during a certain time slot.
The ST Bluetooth stack v4.x available for STM32WB09 and STM32WB05 devices manages the antenna switching and automatically provides the IQ samples to the application through the standard HCI interface. All these samples are provided to the selected algorithm to perform the required calculations and get the direction information. As said before, the algorithm is outside the Bluetooth LE specification.
The ANTENNA_ID signal, which is able to automatically control the antenna switch, is mapped on PB[0:6] GPIOs of STM32WB09 and STM32WB05 devices.
The aci_hal_set_antenna_switch_parameters() function allows to configure the GPIOs to output ANTENNA_ID signal (to PB[0:6]).
The command prototype with related parameters is shown below:
tBleStatus aci_hal_set_antenna_switch_parameters(
uint8_t Antenna_IDs,
uint8_t Antenna_ID_Shift,
uint8_t Default_Antenna_ID,
uint8_t RF_Activity_Enable);
Antenna_IDs
: ANTENNA_ID pins to be enabled. Each bit in the mask enables the corresponding bit of the ANTENNA_ID signal, which is output on PB[0:6].Antenna_ID_Shift
: This parameter can be set to a value different from 0 to shift the ANTENNA_ID signal by the given number of bits.Default_Antenna_ID
: The ID of antenna that the controller selects for regular communication.RF_Activity_Enable
: Enable or disable the RF Activity signal. This signal can be used to enable the antenna switch when needed.
6. STM32WB0 Bluetooth LE stack v4.x ACI commands/events for direction finding
A specific set of commands are used to setup Connectionless or Connection-oriented modes.
6.1. Connectionless mode
6.2. Connection-oriented mode
7. AoA connectionless scenario: example of a tag implementation
An AoA tag is a simple Bluetooth LE device configured as an AoA transmitter. The STM32WB0 sets a periodic advertising framework with specific advertising data. It also calls the hci_le_set_connectionless_cte_transmit_parameters() command to set the type, length, and antenna switching pattern for the transmission of CTEs in any periodic advertising on the advertising set identified by the Advertising_Handle parameter.
The example is provided in STM32CubeWB0 SW package[1]: BLE_Beacon_AoA_Tag application. The beacon tag application sends periodic advertising events with CTE field.
This is the configuration used by the tag:
- Periodic advertising interval: 300 ms.
- CTE length: 160 μs (the maximum allowed by the Bluetooth standard).
- In each periodic advertising event, the beacon tag sends four packets with CTE (one AUX_SYNC_IND PDU followed by three AUX_CHAIN_IND PDUs).
Having more packets in the same periodic event lets the locator receive more samples and estimate the direction of arrival with more accuracy, compared to a single packet per advertising event.
AoA Tag advertising configuration example |
---|
8. AoA connectionless scenario: an example of a possible locator/anchor implementation
The locator, having an antenna array, is synchronized to the tag’s periodic advertising events. This section describes the main components related to a possible locator application framework implementation.
The IQ samples processing and algorithm implementation requires specific computational capabilities. It is suitable for a powerful external MCU or even a PC connected to the STM32WB09/STM32WB05 devices (USB or other possible channels if supported). Usually, STM32WB09 and STM32WB05 devices are not capable of running locator algorithms.
In this example, we assume that a PC application is used for the implementation of the DOA algorithms.
Connection between anchors and PC |
To estimate the position of the tag in a 2D environment, at least two locators must be connected to the PC. Having more locators helps to improve the accuracy and the reliability of the estimation. When using three locators, they should be placed on the ceiling, face down, so that the tag is always in line of sight. Preferably, they should be set at equal distance from each other, along the perimeter of the area where the tag is present.
Optimal anchor placement |
---|
In a AoA locator implementation, the following HW components must be used:
- an antenna array (at least 8 antennas are recommended)
- an antenna switch
A specific mapping between the ANTENNA_ID signal from STM32WB09/STM32WB05 devices and the antenna switch is needed.
While the CTE length is decided on the AoA tag, the locator needs to chose the other parameters:
- the slot duration, which determines the sampling frequency. It can be 1 or 2 μs, to produce IQ samples every, respectively, 2 or 4 μs.
- the switching pattern to follow during reception of the CTE.
Once synchronized with the tag, the locators should send the IQ samples to the PC application, which estimates the direction of the tag. By combining the direction calculated from the samples received from each locator, the application is able to estimate the position of the tag.
8.1. AoA locator application description
This section describes (with the help of a Python-like pseudo code) the possible steps to be performed within the AoA locator application to collect the IQ samples from a locator board, and estimate the direction of the simple transmitter tag.
8.1.1. AoA locator initialization steps
8.1.2. AoA locator tag discovery
8.1.3. AoA locator synchronization with transmitter tag
8.1.4. Collecting IQ samples: get direction information
During the first 8 µs of the CTE, eight I/Q samples are generated from the reference antenna. These samples are used to calculate the frequency offset of the signal for phase correction (freq_offset_estimation_avg()
function)
After defining the frequency offset of the signal, the locator performs the following steps:
- Extract I and Q values from IQ reports
- Create a list of complex values
- Correct phase of the samples
- Collect X number of packets
- Call direction finding algorithm
doa_algorithm()
with IQ samples and number of antenna as input parameters, and get the azimuth and elevation values.
9. References