Friday, 27 May 2022 10:47

Bluetooth LE Direction Finding for Tracking Node Position

This example shows you how to track the 2-D or 3-D position of a Bluetooth® low energy (LE) node by using Bluetooth® Toolbox.

Using this example, you can:

  • Simulate direction-finding packet exchange in the presence of radio frequency (RF) front end impairments, path loss, and additive white Gaussian noise (AWGN).

  • Track the node position by using Bluetooth direction-finding features and position estimation techniques.

  • Improve the location accuracy by using a Kalman filter from Sensor Fusion and Tracking Toolbox™.

Bluetooth LE Direction Finding
The Bluetooth Core Specification v5.1 [2] introduced new features that support high-accuracy direction finding. Bluetooth direction finding presents two distinct methods to estimate the 2-D or 3-D location of the Bluetooth LE node: angle of arrival (AoA) and angle of departure (AoD). In AoA and AoD techniques, the antenna array is present at the receiver and transmitter, respectively. Some commonly used antenna arrays are uniform linear array (ULA) and uniform rectangular array (URA).
The example uses these terminologies:



Node - The device whose location is to be determined.


Locator - The receiving device (in AoA calculation) or transmitting device (in AoD calculation).



This figure shows two different ways to calculate the location of the Bluetooth LE node. Each circle indicates the range of a Bluetooth LE locator.




Distance plus angle: If one locator is present in the range of the Bluetooth LE node, use this method to estimate the node position. The location can be estimated by calculating the AoA or AoD of a direction-finding signal and estimating the distance between the locator and node by performing a path loss calculation on the received signal strength indicator (RSSI).


Angulation: If two or more locators are present in the range of the Bluetooth LE node, use this method to estimate the node position. The location can be estimated by triangulating the AoA or AoD between each locator and node.



Simulation Parameters
Specify the linear motion model. Generate dynamic node positions by using one of these motion models:



2-D constant velocity


3-D constant velocity


2-D constant acceleration


3-D constant acceleration






motionModel = "2-D Constant Velocity"; % Linear motion model



Specify the direction-finding method, the direction-finding packet type, and the physical layer (PHY) transmission mode.



dfMethod = "AoA"; % direction-finding method
dfPacketType = "ConnectionCTE"; % direction-finding packet type

% PHY transmission mode, must be LE1M or LE2M (for ConnectionCTE) and LE1M
% (for ConnectionlessCTE)
phyMode = "LE1M";



Specify the antenna array parameters.



% Antenna array size, must be a scalar (represents ULA) or a vector
% (represents URA) for 2-D or 3-D positioning, respectively
arraySize = 16;

% Normalized spacing between the antenna elements with respect to
% wavelength
elementSpacing = 0.5;

% Antenna switching pattern, must be a 1xM row vector and M must be in the
% range [2, 74/slotDuration+1]
switchingPattern = 1:prod(arraySize);



Specify the waveform generation and reception parameters.



slotDuration = 2; % Slot duration in microseconds
sps = 4; % Samples per symbol
channelIndex = 17; % Channel index
crcInit = '555551'; % Cyclic redundancy check (CRC) initialization
accessAddress = '01234567'; % Access address
payloadLength = 1; % Payload length in bytes

% Length of constant tone extension (CTE) in microseconds, must be in the
% range [16, 160] with 8 microseconds step size
cteLength = 160;

% Sample offset, must be a positive integer in the range [sps/8,7*sps/8]
% for LE1M and [sps/4,7*sps/4] for LE2M
sampleOffset = 2;



Specify the bit energy to noise density ratio (EbNo), environment and transmitter power.



EbNo = 25; % Eb/No in dB
environment = "Outdoor"; % Environment
txPower =0; % Transmit power in dBm



Validate the simulation parameters.



% Configure the bluetoothRangeConfig object
rangeConfig = bluetoothRangeConfig;
rangeConfig.SignalPowerType = "ReceivedSignalPower";
rangeConfig.Environment = environment;
rangeConfig.TransmitterPower = txPower;
rangeConfig.TransmitterCableLoss = 0; % Transmitter cable loss
rangeConfig.ReceiverCableLoss = 0 % Receiver cable loss






rangeConfig =
bluetoothRangeConfig with properties:

Environment: 'Outdoor'
SignalPowerType: 'ReceivedSignalPower'
ReceivedSignalPower: -79
TransmitterPower: 0
TransmitterAntennaGain: 0
ReceiverAntennaGain: 0
TransmitterCableLoss: 0
ReceiverCableLoss: 0
TransmitterAntennaHeight: 1
ReceiverAntennaHeight: 1

Read-only properties:
FSPLDistance: 87.1650
PathLossModel: 'TwoRayGroundReflection'








numDimensions = 2+(strcmp(motionModel,"3-D Constant Velocity") || strcmp(motionModel,"3-D Constant Acceleration"));
if numDimensions == 2 && size(arraySize,2) ~= 1
error("The arraySize must be a scalar for 2-D position estimation");
elseif numDimensions == 3 && size(arraySize,2) ~= 2
error("The arraySize must be a 1-by-2 vector for 3-D position estimation");
end
if strcmp(dfPacketType,"ConnectionCTE") && payloadLength ~= 1
error("The payloadLength must be 1 byte for direction-finding packet type of ConnectionCTE");
elseif strcmp(dfPacketType,"ConnectionlessCTE") && payloadLength < 3
error("The payloadLength must be greater than or equal to 3 bytes for direction-finding packet type of ConnectionlessCTE");
end



Create and configure a Bluetooth LE angle estimation configuration object.



if numDimensions == 3 && isscalar(elementSpacing)
elementSpacing = [elementSpacing elementSpacing];
end
cfg = bleAngleEstimateConfig("ArraySize",arraySize,"SlotDuration",slotDuration,"SwitchingPattern", ...
switchingPattern,"ElementSpacing",elementSpacing);
validateConfig(cfg); % Validate the configuration object
pos = getElementPosition(cfg); % Element positions of an array

% Derive type of CTE based on slot duration and direction-finding method
if strcmp(dfMethod,"AoA")
cteType = [0;0];
else
cteType = [0;1];
if slotDuration == 1
cteType = [1;0];
end
end



Create and configure System objects™ for receiver processing.



% Create and configure preamble detector System object
accessAddBitsLen = 32;
accessAddBits = int2bit(hex2dec(accessAddress),accessAddBitsLen,false);
refSamples = helperBLEReferenceWaveform(phyMode,accessAddBits,sps);
prbDet = comm.PreambleDetector(refSamples,"Detections","First");

% Create and configure coarse frequency compensator System object
phyFactor = 1+strcmp(phyMode,"LE2M");
sampleRate = 1e6*phyFactor*sps;
coarsesync = comm.CoarseFrequencyCompensator("Modulation","OQPSK",...
"SampleRate",sampleRate,...
"SamplesPerSymbol",2*sps,...
"FrequencyResolution",100);

% Create and configure CRC detector System object
crcLen = 24; % CRC length
crcDet = comm.CRCDetector("x^24 + x^10 + x^9 + x^6 + x^4 + x^3 + x + 1", "DirectMethod",true,...
"InitialConditions", int2bit(hex2dec(crcInit),crcLen).');



Packet Transmission and Reception
Perform these steps to track a Bluetooth LE node.


Consider 15 locators and a node in a network. Generate 30 node positions based on the motion of the node.


At each node position, consider active locators in 80 meters range.


Model the direction-finding packet exchange between the node and each active locator. This figure shows the processing chain that the example uses to estimate the angle(s) and distances between the node and active locator.



4. Repeat steps 2 and 3 for each node position.
5. Estimate the node position by using the known active locator positions, distances, and angles.



rng('default'); % Initialize the random number generator stream
snr = EbNo - 10*log10(sps); % Signal to noise ratio (SNR) in dB
headerLen = 16+8*strcmp(dfPacketType,"ConnectionCTE"); % Header length
preambleLen = 8*phyFactor; % Preamble length

% Derive initial state for whitening based on channel index
dewhitenStateLen = 6;
chanIdxBin = int2bit(channelIndex,dewhitenStateLen).';
initState = [1 chanIdxBin];

% Consider one node and 15 locators in a network. Generate random locator
% positions and generate node positions based on the motion model....

继续阅读完整内容

请查看下方广告以解锁文章剩余内容

广告加载中...
Read 67896 times