Main Content

End-to-End Bluetooth BR/EDR PHY Simulation with Path Loss, RF Impairments, and AWGN

This example uses Bluetooth® Toolbox to perform end-to-end simulation for the Bluetooth basic rate/enhanced data rate (BR/EDR) physical layer (PHY) transmission modes in the presence of the path loss model, radio front-end (RF) impairments, and additive white Gaussian noise (AWGN). The simulation results show the estimated value of the bit error rate (BER), path loss, and the impact of path loss on the spectrum of the waveform.

Path Loss Modeling in Bluetooth BR/EDR Network

Bluetooth is a short-range Wireless Personal Area Network (WPAN) technology, operating in the globally unlicensed industrial, scientific, and medical (ISM) band in the frequency range of 2.4 GHz to 2.485 GHz.

The Bluetooth Core Specification [1] specifies these PHY modes.

Basic rate (BR) - Mandatory mode, uses Gaussian frequency shift keying (GFSK) modulation with a data rate of 1 Mbps.

Enhanced data rate (EDR) - Optional mode, uses phase shift keying (PSK) modulation with these two variants:

  • EDR2M: Uses pi/4-DQPSK with a data rate of 2 Mbps

  • EDR3M: Uses 8-DPSK with a data rate of 3 Mbps

For more information about Bluetooth BR/EDR protocol stack, see Bluetooth Protocol Stack.

For more information about Bluetooth BR/EDR packet structures, see Bluetooth Packet Structure.

Path loss or path attenuation is the decline in the power density of a given signal as it propagates from the transmitter to receiver through space. This reduction in power density occurs naturally over the distance and is impacted by the obstacles present in the environment in which the signal is being transmitted. The path loss is generally expressed in decibels (dB) and is calculated as:


In this equation,

  • PLdB is the path loss in dB.

  • Pt is the transmitted signal power in dB.

  • Pr is the received signal power in dB.

Path loss models describe the signal attenuation between the transmitter and receiver based on the propagation distance and other parameters such as frequency, wavelength, path loss exponent, and antenna gains. The example considers these path loss models:

  • Free-space [3]

  • Log-normal shadowing [3]

  • Two-ray ground reflection [3]

  • NIST PAP 02-Task 6 [4]

Bluetooth networks are operated in different environments such as home, office, industrial, and outdoor. A specific path loss model is used for each environment.

For more information about these path loss models, see End-to-End Bluetooth LE PHY Simulation Using Path Loss Model, RF Impairments, and AWGN example.

This example estimates the BER and the path loss between the transmitter and receiver by considering a specific path loss model with RF impairments and AWGN added to the transmission packets.

End-to-End Bluetooth BR/EDR Simulation Procedure

To perform the end-to-end simulation in the presence of path loss, implement these steps.

  1. Generate random bits

  2. Generate a Bluetooth BR/EDR waveform

  3. Add impairments

  4. Attenuate the waveform based on the path loss

  5. Add AWGN

  6. Display the spectrum of the transmitted and received waveforms

Pass the distorted and noisy waveforms through a practical receiver and perform these operations.

  1. Remove DC offset

  2. Detect the signal bursts

  3. Perform matched filtering

  4. Estimate and correct the timing offset

  5. Estimate and correct the carrier frequency offset

  6. Demodulate BR/EDR waveform

  7. Perform forward error correction (FEC) decoding

  8. Perform data dewhitening

  9. Perform header error check (HEC) and cyclic redundancy check (CRC)

  10. Outputs decoded bits

To estimate the bit error rate, compare the transmitted bits with the decoded bits.

Configure Simulation Parameters

Specify the path loss environment and the distance between the transmitter and receiver. Set the PHY transmission mode and the type of Bluetooth BR/EDR packet to be generated. Configure the RF impairments.

Configure parameters related to the communication link between the transmitter and receiver

environment = 'Outdoor';              % Environment
distance = 5;                                   % Distance between transmitter and receiver, in meters
EbNo = 25;                                      % Eb/No in dB

Configure parameters for waveform generation

phyMode = 'BR';                  % PHY transmission mode
bluetoothPacket = 'FHS';                        % Type of Bluetooth BR/EDR packet. This value can be: {'ID',
                                                % 'NULL','POLL','FHS','HV1','HV2','HV3','DV','EV3',
                                                % 'EV4','EV5','AUX1','DM3','DM1','DH1','DM5','DH3',
                                                % 'DH5','2-DH1','2-DH3','2-DH5','2-DH1','2-DH3',
                                                %  '2-DH5','2-EV3','2-EV5','3-EV3','3-EV5'}
sps = 8;                                        % Samples per symbol

Configure RF impairments

frequencyOffset = 6000;% In Hz
timingOffset = 0.5;    % Offset within the symbol, in samples
timingDrift = 2;       % In parts per million
dcOffset = 2;           % Percentage with respect to maximum amplitude value

Generate Bluetooth BR/EDR Waveform

Generate Bluetooth BR/EDR waveform based on the physical layer transmission mode, packet type, and samples per symbol.

% Create a Bluetooth BR/EDR waveform configuration object
txCfg = bluetoothWaveformConfig('Mode',phyMode,'PacketType',bluetoothPacket,...
if strcmp(bluetoothPacket,'DM1')
    txCfg.PayloadLength = 17;       % Maximum length of DM1 packets in bytes
dataLen = getPayloadLength(txCfg);  % Length of the payload

% Generate Bluetooth BR/EDR waveform
bitsPerByte = 8;                             % Number of bits per byte
txBits = randi([0 1],dataLen*bitsPerByte,1); % Generate data bits
txWaveform = bluetoothWaveformGenerator(txBits,txCfg);

Add RF Impairments, Path Loss, and AWGN

Distort the generated Bluetooth BR/EDR waveform by adding the RF impairments.

% Create timing offset object
timingDelayObj = dsp.VariableFractionalDelay;

% Create frequency offset object
symbolRate = 1e6; % Symbol rate, in Hz
frequencyDelay = comm.PhaseFrequencyOffset('SampleRate',symbolRate*sps);

% Add Frequency Offset
frequencyDelay.FrequencyOffset = frequencyOffset;
txWaveformCFO = frequencyDelay(txWaveform);

% Add Timing Delay
packetDuration = bluetoothPacketDuration(phyMode,bluetoothPacket,dataLen);
filterSpan = 8*any(strcmp(phyMode,{'EDR2M','EDR3M'})); % To meet the spectral mask requirements
packetDurationSpan = packetDuration+filterSpan;
totalTimingDrift = zeros(length(txWaveform),1);
timingDriftRate = (timingDrift*1e-6)/(packetDurationSpan*sps);        % Timing drift rate
timingDriftVal = timingDriftRate*(0:1:((packetDurationSpan*sps)-1))'; % Timing drift
totalTimingDrift(1:(packetDurationSpan*sps)) = timingDriftVal;
timingDelay = (timingOffset*sps)+totalTimingDrift;                % Static timing offset and timing drift
txWaveformTimingCFO = timingDelayObj(txWaveformCFO,timingDelay);

% Add DC Offset
dcValue = (dcOffset/100)*max(txWaveformTimingCFO);
txImpairedWaveform = txWaveformTimingCFO + dcValue;

To obtain the path loss value, use helperBluetoothEstimatePathLoss.m function. To attenuate the Bluetooth BR/EDR waveform, add the path loss value to it.

% Obtain the path loss value in dB
[plLinear,pldB] = helperBluetoothEstimatePathLoss(environment,distance);

% Attenuate Bluetooth BR/EDR waveform
txAttenWaveform  = txImpairedWaveform./plLinear;

Add AWGN to the attenuated Bluetooth BR/EDR waveform.

% Set code rate based on packet type
if any(strcmp(bluetoothPacket,{'FHS','DM1','DM3','DM5','HV2','DV','EV4'}))
    codeRate = 2/3;
elseif strcmp(bluetoothPacket,'HV1')
    codeRate = 1/3;
    codeRate = 1;

% Set number of bits per symbol based on the PHY transmission mode
bitsPerSymbol = 1+ (strcmp(phyMode,'EDR2M'))*1 + (strcmp(phyMode,'EDR3M'))*2;

% Get SNR from EbNo values
snr = EbNo + 10*log10(codeRate) + 10*log10(bitsPerSymbol) - 10*log10(sps);

% Add AWGN
rxWaveform = awgn(txAttenWaveform,snr,'measured');

Receiver Processing

To retrieve the data bits, pass the attenuated, AWGN-distorted Bluetooth BR/EDR waveform through the practical receiver.

% Get PHY configuration properties
rxCfg = getPhyConfigProperties(txCfg);

% Receiver Module
rxBits = helperBluetoothPracticalReceiver(rxWaveform,rxCfg);

Simulation Results

Estimate BER based on the retrieved and transmitted bits.

% Calculate BER
if ((~any(strcmp(bluetoothPacket,{'ID','NULL','POLL'})))&&((length(txBits) == length(rxBits))))
    ber = (sum(xor(txBits,rxBits))/length(txBits));
    berDisplay = num2str(ber);
else % BER is not applicable either when packet is lost or when packet type is ID, NULL, POLL packets
    berDisplay = 'Not applicable';

Display Results

Display the estimated BER results. Plot the spectrum of the transmitted and received Bluetooth BR/EDR waveform.

% Display the estimated BER and distance between the transmitter and the receiver.
disp(['Input configuration: ', newline , '    PHY transmission mode: ', phyMode,....
    newline,'    Environment: ', environment, newline ,...
    '    Distance between the transmitter and receiver: ', num2str(distance), ' m', newline ,...
    '    Eb/No: ', num2str(EbNo), ' dB']);
Input configuration: 
    PHY transmission mode: BR
    Environment: Outdoor
    Distance between the transmitter and receiver: 5 m
    Eb/No: 25 dB
disp(['Estimated outputs: ', newline , '    Path loss : ', num2str(pldB), ' dB'....
    newline, '    BER: ', berDisplay]);
Estimated outputs: 
    Path loss : 27.9588 dB
    BER: 0
% Plot the spectrum of the transmitted and received Bluetooth BR/EDR waveform
specAnalyzer = spectrumAnalyzer( ...
    'Method','welch', ...
    'NumInputPorts',2, ...
    'Title','Spectrum of Transmitted and Received Bluetooth BR/EDR Signals',...
    'ShowLegend',true, ...
    'ChannelNames',{'Transmitted Bluetooth BR/EDR signal','Received Bluetooth BR/EDR signal'});

This example demonstrates an end-to-end Bluetooth BR/EDR simulation by considering the path loss model, distance between transmitter and receiver, RF impairments, and AWGN. The obtained simulation results display the estimated path loss and BER. The spectrum of the transmitted and received Bluetooth BR/EDR waveforms is visualized by using a spectrum analyzer.


The example uses these helper functions:

Selected Bibliography

[1] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification". Version 5.3.

[2] Path Loss Models Used in Bluetooth Range Estimator. Bluetooth Special Interest Group (SIG).

[3] Rappaport, Theodore. Wireless Communication – Principles and Practice. Prentice Hall, 1996.

[4] NIST Smart Grid Interoperability Panel Priority Action Plan 2: Guidelines for Assessing Wireless Standards for Smart Grid Applications. National Institute of Standards and Technology, U.S. Department of Commerce, 2014.

See Also


Related Topics