Main Content

Parameterize Bluetooth LE Direction Finding Features

The Bluetooth® Core Specification 5.1 [2] provided by the Bluetooth Special Interest Group (SIG) added direction finding features in Bluetooth low energy (LE) technology. The Bluetooth direction-finding capabilities, angle of arrival (AoA) and angle of departure (AoD), are introduced in the Bluetooth Core Specification 5.1 [2]. For more information about Bluetooth LE direction finding, see the Bluetooth Location and Direction Finding topic and Bluetooth LE Positioning by Using Direction Finding and Bluetooth LE Direction Finding for Tracking Node Position examples.

The Bluetooth Toolbox enables you to configure and simulate these Bluetooth LE direction finding capabilities.

Set Simulation Parameters for Bluetooth LE Location and Direction Finding

Specify the number of Bluetooth LE locators and the dimensions in which the Bluetooth LE node position is to be determined. To estimate the 2-D or 3-D position of a Bluetooth LE node, specify at least two or three locators, respectively.

numDimensions = 2;
numLocators = 3;

Specify the bit energy-to-noise density ratio (Eb/No) range (in dB) and the number of iterations to simulate each Eb/No point.

EbNo = 6:2:16;
numIterations = 200;

Specify the direction finding method, the direction finding packet type, and the physical layer (PHY) transmission mode. The PHY transmission mode must be LE1M or LE2M for a connection-oriented constant tone extension (CTE) and LE1M for a connectionless CTE.

dfMethod = "AoA";
dfPacketType = "ConnectionCTE";
phyMode = "LE1M";

Specify the antenna array parameters. The antenna array size must be a scalar or vector for 2-D or 3-D positioning, respectively. The scalar or vector array size represents a uniform linear array (ULA) or uniform rectangular array (URA), respectively. Specify the normalized element spacing between the antenna elements with respect to the wavelength. Specify the antenna switching pattern as a 1-by-M row vector, where M is in the range [2, 74slotDuration+1].

arraySize = 16;
elementSpacing = 0.5;
switchingPattern = 1:prod(arraySize);

Specify the Bluetooth LE waveform generation parameters. The length of the CTE must be in microseconds, in the range [16, 160], with a step size of 8 microseconds.

slotDuration = 2;          % Slot duration in microseconds
cteLength = 160;
sps = 8;
chanIndex = 17;
crcInit = '555551';
accAddress = '01234567';
payloadLength = 1;         % Payload length in bytes

Create Bluetooth LE Angle Estimation Configuration Object

Create a default Bluetooth LE angle estimation configuration object by using the bleAngleEstimateConfig object. This object enables you to configure different parameters for Bluetooth LE angle estimation.

cfgAngle = bleAngleEstimateConfig
cfgAngle = 
  bleAngleEstimateConfig with properties:

           ArraySize: 4
      ElementSpacing: 0.5000
        SlotDuration: 2
    SwitchingPattern: [1 2 3 4]

Specify a URA antenna design by setting the antenna array size of the configuration object to [4 4]. Set the row element spacing and column element spacing to 0.4 and 0.3, respectively. Specify the value of the antenna switching pattern.

cfgAngle.ArraySize = [4 4];
cfgAngle.ElementSpacing = [0.4 0.3];
cfgAngle.SwitchingPattern = 1:16
cfgAngle = 
  bleAngleEstimateConfig with properties:

           ArraySize: [4 4]
      ElementSpacing: [0.4000 0.3000]
        SlotDuration: 2
    SwitchingPattern: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]

Generate Random Positions for Bluetooth LE Locators

A Bluetooth LE locator represents a receiving device and a transmitting device in AoA and AoD calculation, respectively. To place a Bluetooth LE node at the origin and the locators randomly in the 2-D or 3-D space, use helperBLEGeneratePositions function. Specify the number of locators as 3 and the number of dimensions as 2. The function returns the 2-D position of the Bluetooth LE node at the origin, a matrix representing the position of the three locators, and the AoA or AoD (in degrees) between the Bluetooth LE node and the locators.

[nodePos,locatorPos,angle] = helperBLEGeneratePositions(3,2)
nodePos = 2×1

     0
     0

locatorPos = 2×3

  -23.7249  -57.5071  -12.5811
  -77.9415   69.9823   -1.7241

angle = 3×1

   73.0701
  -50.5887
    7.8032

Generate Bluetooth LE Direction Finding Packet

Set the simulation parameters to generate a Bluetooth LE direction finding packet.

dfPacketType = "ConnectionCTE";
cteLength = 160;
dfMethod = "AoA";
payloadLength = 1;               % Payload length in bytes
crcInit = '555551';
slotDuration = 2;                % Slot duration in microseconds

Derive the type of CTE based on the slot duration and the direction finding method.

if strcmp(dfMethod,'AoA')
    cteType = [0;0];
else
    cteType = [0;1];
    if slotDuration == 1
        cteType = [1;0];
    end
end

To generate a direction finding packet corresponding to the type of CTE, use helperBLEGenerateDFPDU function.

dfPacket = helperBLEGenerateDFPDU(dfPacketType,cteLength,cteType,payloadLength,crcInit);

Perform Antenna Steering and Switching on Bluetooth LE Waveform

Set Bluetooth LE direction finding simulation parameters to perform antenna steering and switching on a Bluetooth LE waveform.

dfPacketType = "ConnectionCTE";
cteLength = 160;
dfMethod = "AoA";
payloadLength = 1;          % Payload length in bytes
crcInit = '555551';
slotDuration = 2;           % Slot duration in microseconds
phyMode = "LE1M";
sps = 8;
chanIndex = 17;

Derive the type of CTE based on the slot duration and the direction finding method.

if strcmp(dfMethod,'AoA')
    cteType = [0;0];
else
    cteType = [0;1];
    if slotDuration == 1
        cteType = [1;0];
    end
end

Create a default Bluetooth LE angle estimation configuration object. Specify the antenna slot duration.

obj = bleAngleEstimateConfig;
obj.SlotDuration = slotDuration;

Generate a direction finding packet corresponding to the type of CTE by using the helperBLEGenerateDFPDU function.

dfPacket = helperBLEGenerateDFPDU(dfPacketType,cteLength,cteType,payloadLength,crcInit);

Using the direction finding packet, generate the Bluetooth LE waveform.

bleWaveform = bleWaveformGenerator(dfPacket,'Mode',phyMode,'SamplesPerSymbol',sps, ...
    'ChannelIndex',chanIndex,'DFPacketType',dfPacketType);

Use the helperBLESteerSwitchAntenna function to steer the Bluetooth LE waveform by 45 degrees in azimuth and 0 degrees in elevation and switch between the antennas according to the switching pattern.

dfWaveform = helperBLESteerSwitchAntenna(bleWaveform,45, ...
    phyMode,sps,dfPacketType,payloadLength,obj);

Decode Bluetooth LE Waveform with Connection-Oriented CTE

Set the simulation parameters to decode the Bluetooth LE waveform.

dfPacketType = "ConnectionCTE";
cteLength = 160;
dfMethod = "AoA";
payloadLength = 1;          % Payload length in bytes
crcInit = '555551';
slotDuration = 2;           % Slot duration in microseconds
phyMode = "LE1M";
sps = 8;
chanIndex = 17;

Derive the type of CTE based on the slot duration and the direction finding method.

if strcmp(dfMethod,'AoA')
    cteType = [0;0];
else
    cteType = [0;1];
    if slotDuration == 1
        cteType = [1;0];
    end
end

Create a default Bluetooth LE angle estimation configuration object. Specify the antenna slot duration.

obj = bleAngleEstimateConfig;
obj.SlotDuration = slotDuration;

To generate a direction finding packet corresponding to the type of CTE, use the helperBLEGenerateDFPDU function.

dfPacket = helperBLEGenerateDFPDU(dfPacketType,cteLength,cteType,payloadLength,crcInit);

Generate the Bluetooth LE waveform by using the direction finding packet.

bleWaveform = bleWaveformGenerator(dfPacket, ...
    'Mode',phyMode, ...
    'SamplesPerSymbol',sps, ...
    'ChannelIndex',chanIndex, ...
    'DFPacketType',dfPacketType);

Get the in-phase and quadrature (IQ) samples by decoding the Bluetooth LE waveform.

[bits,accAddr,iqSamples] = bleIdealReceiver(bleWaveform, ...
    'Mode',phyMode, ...
    'SamplesPerSymbol',sps, ...
    'ChannelIndex',chanIndex, ...
    'DFPacketType',dfPacketType, ...
    'SlotDuration',slotDuration);

Estimate AoA of Bluetooth LE Waveform

Create a Bluetooth LE angle estimation configuration object, specifying the values of the antenna array size, slot duration, and antenna switching pattern.

cfgAngle = bleAngleEstimateConfig('ArraySize',2,'SlotDuration',2, ...
    'SwitchingPattern',[1 2]);

Estimate the AoA of the Bluetooth LE waveform by using the bleAngleEstimate function. The function accepts IQ samples and the Bluetooth LE angle estimation configuration object as inputs. You can either use the IQ samples obtained by decoding the Bluetooth LE waveform or use the IQ samples corresponding to the connection data channel protocol data unit (PDU).

Specify the IQ samples of a connection data PDU with an AoA CTE of 2 μs slots, CTE time of 16 μs, and azimuth rotation of 70 degrees.

IQsamples = [0.8507 + 0.5257i; -0.5257 + 0.8507i; -0.8507 - 0.5257i; ...
    0.5257 - 0.8507i; 0.8507 + 0.5257i; -0.5257 + 0.8507i; ...
    -0.8507 - 0.5257i; 0.5257 - 0.8507i; -0.3561 + 0.9345i];

Estimate the AoA of the Bluetooth LE waveform.

angle = bleAngleEstimate(IQsamples,cfgAngle)
angle = 70

Estimate Bluetooth LE Transmitter Position in 2-D Network Using Angulation

Set the positions of the Bluetooth LE receivers (locators).

rxPosition = [-18 -40;-10 70];          % In meters

Specify the azimuth angle of the signal between each Bluetooth LE receiver and transmitter.

azimuthAngles = [29.0546 -60.2551];     % In degrees

Specify the localization method. Because the angle of the signal between each Bluetooth LE receiver and transmitter is known, set the localization method to 'angulation'.

localizationMethod = "angulation";

Estimate the position of the Bluetooth LE transmitter. The actual position of the Bluetooth LE transmitter is at the origin: (0, 0).

txPosition = blePositionEstimate(rxPosition,localizationMethod, ... 
    azimuthAngles)
txPosition = 2×1
10-4 ×

    0.2374
    0.1150

References

[1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed September 1, 2020. https://www.bluetooth.com/.

[2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.1. https://www.bluetooth.com/.

[3] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. https://www.bluetooth.com/.

See Also

Functions

Objects

Related Topics