Main Content

Generate and Attenuate Bluetooth BR/EDR Waveform in Industrial Environment

This example shows you how to generate a Bluetooth® basic rate/enhanced data rate (BR/EDR) waveform in an industrial environment and attenuate the waveform by using a path loss model. The Bluetooth® Toolbox functionalities enable you to add free space, log distance, log normal shadowing, or two-ray ground reflection path loss models to the Bluetooth waveform.

Using this example, you can:

  1. Generate a Bluetooth BR/EDR waveform.

  2. Configure the parameters of a log distance path loss model.

  3. Attenuate the Bluetooth BR/EDR waveform and plot the spectra of the transmitted and attenuated Bluetooth BR/EDR waveforms.

Create a default Bluetooth BR/EDR waveform configuration object.

BREDRcfg = bluetoothWaveformConfig();

Set the packet type, transmission mode, samples per symbol, and symbol rate.

BREDRcfg.PacketType = 'FHS';                 % Packet type
BREDRcfg.Mode = 'BR';                        % Physical layer (PHY) transmission mode
BREDRcfg.SamplesPerSymbol = 8                % Samples per symbol
BREDRcfg = 
  bluetoothWaveformConfig with properties:

                       Mode: 'BR'
                 PacketType: 'FHS'
              DeviceAddress: '0123456789AB'
    LogicalTransportAddress: [3x1 double]
          HeaderControlBits: [3x1 double]
            ModulationIndex: 0.3200
           SamplesPerSymbol: 8
               WhitenStatus: 'On'
       WhitenInitialization: [7x1 double]

symbolRate = 1e6;                            % Symbol rate in Hz

Calculate the payload length (in bytes) for the Bluetooth BR/EDR configuration object by using the getPayloadLength object function. Then, calculate the payload length (in bits) by multiplying the calculated payload length in bytes by 8.

numBits = getPayloadLength(BREDRcfg)*8;      % Length of the payload in bits

Generate the payload for a single packet by using a random input bit vector.

txBits = randi([0 1],numBits,1);             % Generate data bits

Generate the Bluetooth BR/EDR waveform.

BREDRWaveform = bluetoothWaveformGenerator(txBits,BREDRcfg);

Set the environment to outdoor, industrial, home, or office. Specify the distance (in meters) between the transmitter and receiver.

environment = 'Industrial';                  % Environment
distance = 15;                               % Distance in meters

Set the frequency of the transmitted signal (in Hz) and the path loss exponent, which depends on the propagation environment. If you set the environment as outdoor, home, or office, you do not need to specify the path loss exponent value.

fc = 2.402*1e9;                              % Frequency of the signal
plExp =5;           % Path loss exponent

Obtain the path loss value in linear scale by using the helperBluetoothEstimatePathLoss helper function. Attenuate the generated Bluetooth BR/EDR waveform by using this path loss value.

plLinear = helperBluetoothEstimatePathLoss(environment,distance,fc,plExp);
rxWaveform  = BREDRWaveform./plLinear;

Compute Bluetooth BR/EDR packet duration (in microseconds).

packetDuration = bluetoothPacketDuration(BREDRcfg.Mode,BREDRcfg.PacketType,numBits/8);

Plot the spectra of the transmitted and attenuated Bluetooth BR/EDR waveforms in an industrial environment.

specAnalyzer = spectrumAnalyzer('NumInputPorts',2, ...
    'SampleRate',symbolRate*BREDRcfg.SamplesPerSymbol, ...
    'Title','Spectra of Transmitted and Attenuated Bluetooth BR/EDR Waveforms in Industrial Environment', ...
    'ShowLegend',true, ...
    'ChannelNames',{'Transmitted Bluetooth BR/EDR waveform','Attenuated Bluetooth BR/EDR waveform'});
specAnalyzer(BREDRWaveform(1:packetDuration*BREDRcfg.SamplesPerSymbol), ...
    rxWaveform(1:packetDuration*BREDRcfg.SamplesPerSymbol));
release(specAnalyzer);

References

[1] Bluetooth® Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed December 27, 2021. https://www.bluetooth.com/.

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

See Also

Functions

Objects

Related Topics