BLE Coexistence Model with WLAN Signal Interference

This example shows how to simulate Bluetooth® low energy (BLE) coexistence with WLAN interference using the Communications Toolbox™ Library for the Bluetooth Protocol and the WLAN Toolbox™. Coexistence mechanisms are used to minimize the interference of WLAN on BLE network. In this example, the collision probability and interference level of each WLAN network is used to corrupt the BLE signals. The simulation results generated in this example conclude that for high collision probability and interference level of a WLAN channel, the achieved success rate of the respective BLE channel is low.

BLE-WLAN Coexistence Mechanism

As there are different types of wireless networks operating in the same unlicensed frequency band, it is possible for two different networks to interfere with each other. This interference can cause transmission failures in both the networks. There is no standardized algorithm to achieve coexistence of two different wireless networks. However, the IEEE® 802.15.2™ standard [ 1 ] specifies some recommended practices to achieve the coexistence of wireless personal area networks (WPAN) with other wireless devices operating in unlicensed frequency bands.

This example illustrates a BLE coexistence model with WLAN signal interference. WLAN communication requires a minimum of 20 MHz bandwidth, while BLE devices require only 2 MHz bandwidth. WLAN uses a channel access mechanism called carrier-sense multiple access with collision avoidance (CSMA/CA), while BLE devices use frequency hopping. Interference occurs when the operating frequency of BLE and WLAN devices overlap. To minimize the interference, coexistence mechanisms are used.

Coexistence mechanisms are broadly classified into these two categories [ 1 ]:

  • Collaborative: This mechanism requires a communication link between the BLE and WLAN networks. Since these two networks can communicate with each other, one of these networks pauses its transmission while the other is using the channel. This mechanism is used when the WLAN and BLE devices are embedded into the same physical device.

  • Non-Collaborative: This mechanism does not require any communication link between the BLE and WLAN networks. Since these two networks cannot communicate with each other, they use their own methods to detect the interference of the other network. This mechanism is used when the WLAN and BLE devices are not embedded into the same physical device.

This example illustrates a non-collaborative coexistence mechanism for BLE devices with WLAN.

BLE Coexistence with WLAN - Model Description

This section elaborates the data communication in BLE, WLAN interference and coexistence algorithm used for avoiding the interference in this example.

Communication in BLE: BLE defines two major roles at the Link Layer, namely the Master and the Slave. Master initiates the data communication and Slave responds to the Master. In this example, BLE packet exchange is modeled between one Master and multiple (configurable up to 5) Slaves. In BLE [ 2 ], data communication occurs only during connection events. A connection event is a recurring (at regular intervals called connection interval) sequence of data packets exchange between a Master and a Slave. All the packets within a connection event are transmitted on the same data channel. At the start of every connection event, the Master initiates communication with the respective Slave. Thereafter, the Slave responds to the Master with a data packet. If there is no data to send, the Slave responds with an empty packet. In this example, only one transaction is modeled per connection event. A new connection event uses a new data channel. The new channel is selected based on adaptive channel hopping. A channel map indicating good or bad channels is used while selecting a new channel, thus showing the adaptiveness in channel hopping.

WLAN traffic: WLAN traffic is dynamically added to, or removed from, the model according to the specified start and end times. Each WLAN network is configured with an individual collision probability. Additionally, WLAN interference level is configured for each WLAN network to corrupt the BLE signals in the respective channel. For every transmission, a random number between 0 and 1 is generated. If the generated random number is less than the collision probability, then the transmitting BLE signal is corrupted by adding the WLAN signals in that channel. The generated WLAN traffic can be modified for IEEE® 802.11ax™ [ 3 ] or 802.11n [ 4 ] using the wlanTraffic function. However, this example uses only 20 MHz WLAN channels.

BLE coexistence with WLAN: If the selected BLE channel is significantly impacted by the WLAN interference based on collision probability, then the transmitted BLE signal is interfered by WLAN signals in that channel. The Master device periodically classifies the Slave channels as 'good channels' or 'bad channels', based on packet failures in that channel. The channel classification information is stored in the form of a bitmap called channel map. The bitmap is an array of 1's and 0's defining the classification of the channel (either 'good' or 'bad'). The classifyChannels function classifies the BLE channels and stores the generated bitmap. The Master maintains a different channel map for each Slave. The updated channel map is sent to the Slave. The periodicity of channel classification is configured by setting the property ClassificationInterval in helperBLEChannelClassification object. BLE devices in idle state, calculate channel busy time for all the 'bad channels' by performing energy detection (ED) of the received signals. If the current number of good channels is less than the preferred number of good channels, the bad channels are classified again. This classification is based on the channel busy time when the BadChannelClassificationMethod property is set to 'Using energy indications'. If the BadChannelClassificationMethod property is set to 'Reset all bad channels', then all the bad channels are reset to good channels.

Check for Support Package Installation

Check if the 'Communications Toolbox Library for the Bluetooth Protocol' support package is installed or not.

commSupportPackageCheck('BLUETOOTH');

BLE Configuration Parameters

This section adds a BLE Master device and the specified number of Slave devices to the BLE network. Since the Master is responsible for updating channel map for each Slave in a BLE network, the channel classification parameters are configured at the Master device using helperBLEChannelClassification. The helperBLEDeviceModel object is used to model the BLE coexistence with WLAN.

% The number of BLE Slaves in connection with the Master
slavesCount = 1;

% Create the BLE Master device capable of connecting with "slavesCount"
% number of Slaves
master = helperBLEDeviceModel('Role','Master', ...
    'SlavesCount',slavesCount);

% Initialize the channel classification parameters to classify the BLE
% channels into good or bad channels. PERThreshold:                 Packet
% error rate (PER) threshold value ClassificationInterval:
% Periodicity of channel classification RxStatusCount:
% Maximum number of received packets status MinRxCountToClassify:
% Minimum number of received packets status BadChannelClassificationMethod:
% Method for bad channels classification PreferredMinimumGoodChannels:
% Preferred number of good channels
channelClassification = helperBLEChannelClassification(...
    'PERThreshold',40, ...
    'ClassificationInterval',150, ...
    'RxStatusCount',50, ...
    'MinRxCountToClassify',4, ...
    'BadChannelClassificationMethod','Reset all the bad channels', ...
    'PreferredMinimumGoodChannels',30);

% Assign channel classification parameters to the Master device
master.ChannelClassification = channelClassification;

% Initialize "slavesCount" number of Slaves
slaves(1, slavesCount) = helperBLEDeviceModel;

% Create "slavesCount" number of Slave devices
for idx = 1:slavesCount
    slaves(idx) = helperBLEDeviceModel('Role','Slave');
end

% Create "slavesCount" connections between the "Master" and "Slaves". This
% function creates a Link Layer connection by sharing the common connection
% parameters such as connection interval, access address for each
% Master-Slave connection pair.
[master, slaves] = helperBLECreateLLConnection(master, slaves);

Model WLAN Traffic

This section models the WLAN traffic using specified configuration.

Configuration Parameters

The configuration parameters for each WLAN network includes collision probability, interference level, interference start time and interference end time in the specified WLAN channel. The helperBLEWLANSignalTrafficConfig object is used to model the WLAN traffic.

% Set number of WLAN networks interfering with the BLE network
wlanNetworksCount = 6;

% Set of WLAN channels (in the range [1, 14]) used by each WLAN network
wlanChannels = [1, 5, 6, 12, 9, 8];
% Probability of collisions of each WLAN network with BLE network
collisionProbabilities = [0.75, 0.68, 0.76, 0.80, 0.78, 0.64];
% Start and end times (in milliseconds) of transmission in each WLAN
% network
wlanInterferencePeriod = [0, inf; ...
    0, inf; ...
    0, 2100; ...
    0, inf; ...
    200, 2800; ...
    150, inf];

% Ratio of WLAN signal power level relative to BLE signal power level
wlanInterferenceLevel = [1.20, 0.90, 0.85, 0.95, 0.70, 1.15];

Model WLAN Traffic

This section configures the interference to each Slave by adding WLAN traffic with the specified configuration. WLAN traffic (non-HT waveforms) is added in all specified WLAN channels using wlanTraffic function.

% Create a configuration object for WLAN traffic
wlanTrafficConfig = helperBLEWLANSignalTrafficConfig();

% Configure WLAN traffic with the specified WLAN network parameters
wlanTraffic(wlanTrafficConfig, wlanNetworksCount, wlanChannels, collisionProbabilities, ...
    wlanInterferencePeriod, wlanInterferenceLevel);

Coexistence Simulation

This section illustrates the communication between Master and Slave devices while interfering with WLAN signals.

Initialize Simulation Parameters

The simulation parameters required for the BLE coexistence with WLAN signal interference are initialized in this code.

% Initialize simulation parameters

% Reset the random number generator seed
sprev = rng('default');

% To enable the visualization of BLE coexistence with WLAN, set the
% "enableVisualization" to true. To disable the visualization of BLE
% coexistence with WLAN set the "enableVisualization" to false.
enableVisualization = true;

% To enable the visualization of channel hopping sequence, set the
% "enableHoppingVisualization" to true. To disable the visualization of
% channel hopping sequence, set the "enableHoppingVisualization" to false.
% If the "enableVisualization" is set to false, then
% "enableHoppingVisualization" is not considered.
enableHoppingVisualization = true;

% Total simulation time in milliseconds
simulationTime = 4000;

% One step time is considered as 0.025 milliseconds. All the timing
% parameters (connection interval, scan interval, advertising interval,
% etc.) in BLE specification are multiple of 0.625 milliseconds. The
% minimum packet size used in this example is 9 octets (72 bits). The
% packet transmission time in different PHY modes are: 0.072 milliseconds
% (in LE1M), 0.036 milliseconds (in LE2M), 0.144 milliseconds (in LE500K)
% and 0.288 milliseconds (in LE125K). Therefore, the step time is
% considered as 0.025 milliseconds (0.625 is multiple of 0.025) to achieve
% a trade-off between the simulation time and accuracy.
timeStep = 0.025;

% Parameters for generating BLE transmission mode
phyMode = 'LE1M';   % Mode can be 'LE2M' | 'LE1M' | 'LE500K' | 'LE125K'
EbNo = 16;          % Eb/No value in dB

% Initialize PHY parameters sps:              Samples per symbol bleSNR:
% BLE signal to noise ratio initImpairments:  System object for BLE PHY
% impairments
[sps, bleSNR, initImpairments] = helperBLEInitPHYParameters(EbNo, phyMode);

% Create structure for an empty packet to initialize the output of Master
% and Slaves LLPDU:        Generated Link Layer Protocol Data Unit (PDU)
% appended with
%               Cyclic Redundancy Check (CRC)
% RateIndex:    String representing the rate at which the packet will be
%               transmitted. It contains one of 'LE2M' | 'LE1M' | 'LE500K'
%               | 'LE125K'
% AccessAddress:Unique address for each Master-Slave connection pair
% ChannelIndex: Channel on which the packet is transmitted
emptyPacket = struct('LLPDU',[], ...
    'AccessAddress','', ...
    'RateIndex','', ...
    'ChannelIndex',-1);

% Initialize the Slave output
slaveOutput = emptyPacket;

% Preallocate the buffers to store the Slave outputs
slaveOutputs = cell(1, slavesCount);

Simulation

This section simulates the exchange of packets between a BLE Master and Slave devices for a specified amount of time.

  • Master (Transmission or Reception): In each connection event, BLE Master initiates the communication with the respective Slave by transmitting a BLE waveform generated for the Link Layer packet on a data channel. The WLAN signal interferes with the generated BLE waveform in the respective BLE channel. After transmission, the Master waits for the response from the Slave.

  • Slave (Transmission or Reception): In each connection event, BLE Slave receives the interfered waveform from the Master on a data channel. Thereafter, the Slave responds to the Master on the same data channel by transmitting a Link Layer packet after the generating BLE waveform. The generated BLE waveform is interfered by the WLAN signal in the respective BLE channel.

Before adding the WLAN interference, the transmitted BLE signal is passed through the following RF impairments.

  • DC offset

  • Carrier frequency offset

  • Carrier phase offset

  • Timing drift

Use the helperBLEImpairments function to configure the RF impairments.

The run function of helperBLEDeviceModel is used for communication between BLE Master and Slave devices. The addInterference function adds the WLAN signals to corrupt the BLE signals. White gaussian noise (WGN) is added to the interfered BLE waveforms. The helperBLEVisualizeCoexistence visualizes the simulation of BLE coexistence with WLAN signals.

% Initialize figures for visualization of coexistence model for each Slave.
% This visualization shows the WLAN channels along with their collision
% probabilities and also shows the channel hopping for the communication
% between BLE Master and Slave devices. It also shows the status (good or
% bad) of each BLE channel along with the success rate in the respective
% channel.
coexistenceModel = ...
    helperBLEVisualizeCoexistence(...
    'Action','Initialize', ...
    'SlaveCount',slavesCount, ...
    'WLANChannelList',wlanChannels, ...
    'PERThreshold',master.ChannelClassification.PERThreshold, ...
    'ClassificationInterval',master.ChannelClassification.ClassificationInterval, ...
    'ChannelBusyCountThreshold',master.ChannelClassification.ChannelBusyCountThreshold, ...
    'PreferredMinimumGoodChannels',master.ChannelClassification.PreferredMinimumGoodChannels, ...
    'ConnectionInterval',master.LLConnectionConfigs(1).ConnectionInterval, ...
    'Stoptime',simulationTime, ...
    'PHYMode',phyMode, ...
    'EnableVisualization',enableVisualization, ...
    'EnableHoppingVisualization',enableHoppingVisualization);
coexistenceModel.initializeVisualization();
viewModel(coexistenceModel);
master.CoexistenceVisualization = coexistenceModel;

% Run simulation
for simulationTimer = 0:timeStep:simulationTime
    % Stop the simulation, if all the Slaves are disconnected from the
    % Master due to interference. If the PER of the BLE channels in which
    % they are communicating with each other is high, then the Master and
    % the Slave are disconnected. The PER of the channel is high because of
    % the high collision probability in the respective channel.
    if numel(master.ActiveConnectionIdxs(master.ActiveConnectionIdxs ~= -1)) == 0
        fprintf('Simulation terminated as all Slaves are disconnected from the Master device.\n')
        break;
    end

    % Update WLAN traffic in visualization
    helperBLEUpdateWLANTraffic(slavesCount, wlanChannels, wlanTrafficConfig, simulationTimer, master);

    % MASTER: Transmitting or Receiving mode
    if (master.ActiveChannel == slaveOutput.ChannelIndex) && ...
            ~isempty(slaveOutput.LLPDU)
        masterOutput = run(master, slaveOutput);
    else
        masterOutput = run(master, emptyPacket);
    end

    if ~(isempty(masterOutput.LLPDU))
        % Generate PHY waveform
        masterOutput.RateIndex = phyMode;
        masterWaveformTx = helperBLEPHYTx(masterOutput, sps);

        % Add impairments
        masterWaveformTx = helperBLEImpairments(initImpairments, masterWaveformTx, sps);

        % Add WLAN interference
        masterWaveformTx = addInterference(wlanTrafficConfig, ...
            masterOutput.ChannelIndex, simulationTimer, masterWaveformTx);

        % Pass the transmitted waveform through AWGN channel
        masterWaveformRx = awgn(masterWaveformTx, bleSNR);

        % Decode PHY waveform after adding impairments and interference
        [decodedMasterPacket, decodedMasterAccessAddress] = helperBLEPHYRx(masterWaveformRx, ...
            phyMode, sps, masterOutput.AccessAddress, masterOutput.ChannelIndex);

        masterOutput.LLPDU = decodedMasterPacket;
        % Access address becomes empty when the BLE PHY receiver fails to
        % detect a valid BLE packet due to high interference level or
        % impairments or noise level.
        if ~isempty(decodedMasterAccessAddress)
            masterOutput.AccessAddress = dec2hex(bi2de(decodedMasterAccessAddress'), 8);
        end
    end

    % Update current simulation time
    master.CoexistenceVisualization.CurrentTime = simulationTimer;
    master.CoexistenceVisualization.Action = 'Simulation Progress';

    % SLAVE: Transmitting or Receiving mode
    for idx = 1:slavesCount
        % Pass the "MasterOutput" to the Slave listening in the same
        % frequency
        if (slaves(idx).ActiveChannel == masterOutput.ChannelIndex) && ...
                ~isempty(masterOutput.LLPDU)
            slaveOutputs{idx} = run(slaves(idx), masterOutput);
            % Pass an empty packet to all other Slaves
        else
            slaveOutputs{idx} = run(slaves(idx), emptyPacket);
        end

        % Update simulation progress for each Slave
        master.CoexistenceVisualization.SlaveNumber = idx;
        viewModel(master.CoexistenceVisualization)
    end

    slaveOutput = emptyPacket;

    % Get the active Slave output (At any time instance only one Slave is
    % active)
    for idx = 1:slavesCount
        if ~isempty(slaveOutputs{idx}.LLPDU)
            slaveOutput = slaveOutputs{idx};
            break
        end
    end

    if ~(isempty(slaveOutput.LLPDU))
        % Generate PHY waveform
        slaveOutput.RateIndex = phyMode;
        slaveWaveformTx = helperBLEPHYTx(slaveOutput, sps);

        % Add BLE impairments
        slaveWaveformTx = helperBLEImpairments(initImpairments, slaveWaveformTx, sps);

        % Add WLAN interference
        slaveWaveformTx = addInterference(wlanTrafficConfig, ...
            slaveOutput.ChannelIndex, simulationTimer, slaveWaveformTx);

        % Pass the transmitted waveform through AWGN channel
        slaveWaveformRx = awgn(slaveWaveformTx, bleSNR);

        % Decode PHY waveform after adding impairments and interference
        [decodedSlavePacket, decodedSlaveAccessAddress] = helperBLEPHYRx(slaveWaveformRx, ...
            phyMode, sps, slaveOutput.AccessAddress, slaveOutput.ChannelIndex);

        slaveOutput.LLPDU = decodedSlavePacket;
        % Access address becomes empty when the BLE PHY receiver fails to
        % detect a valid BLE packet due to high interference level or
        % impairments or noise level.
        if ~isempty(decodedSlaveAccessAddress)
            slaveOutput.AccessAddress = dec2hex(bi2de(decodedSlaveAccessAddress'), 8);
        end
    end
end

% Update the simulation progress for each Slave
for idx = 1:slavesCount
    master.CoexistenceVisualization.SlaveNumber = idx;
    master.CoexistenceVisualization.Action = 'Simulation Progress';
    viewModel(master.CoexistenceVisualization)
end

% Log the statistics of this example to
% |bleCoexistenceWithWLANSignalStatistics.mat| file
helperBLELogCoexistenceStats(master, slaves, ...
    'bleCoexistenceWithWLANSignalStatistics.mat');

% Restore the previous setting of random number generation
rng(sprev)

Simulation Results

The simulation of this example generates:

  1. A run-time plot for each Master-Slave connection pair depicting the status (good or bad) and the cumulative, recent success rates of each channel is displayed

  2. A MAT file bleCoexistenceWithWLANSignalStatistics.mat with detailed statistics such as number of packets received, number of packets corrupted on each channel and status (good or bad) of the channel for each classification interval is obtained

Further Exploration

You can further explore this example by:

  • Using other variants of WLAN formats such as non-HT direct-sequence spread spectrum (DSSS) or high throughput (HT) in the wlanTraffic function

  • Corrupting the BLE signal in the addInterference function by varying the interference present at different stages of the BLE signal

You can also explore Statistical Modeling of WLAN Interference on BLE Network.

This example enables you to analyze the BLE coexistence with WLAN signal interference. Collision probability and interference level of each WLAN network is used to corrupt the BLE signals. The BLE Master and Slave devices use good channels to communicate with each other to avoid packet loss. The success rate is calculated at each BLE channel. This example concludes that for high collision probability and interference level of a WLAN channel, the achieved success rate of the respective BLE channel is low. Therefore, these channels are not used for communication between BLE Master and Slave devices.

Appendix

The example uses these features:

The example uses these helpers:

Selected Bibliography

  1. IEEE® Standard 802.15.2™. "Coexistence of Wireless Personal Area Networks with Other Wireless Devices Operating in Unlicensed Frequency Bands". IEEE Recommended Practice for Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements; IEEE Computer Society

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

  3. IEEE P802.11ax™/D3.1. "Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications - Amendment 6: Enhancements for High Efficiency WLAN". Draft Standard for Information technology - Telecommunications and information exchange between systems Local and metropolitan area networks - Specific requirements; LAN/MAN Standards Committee of the IEEE Computer Society

  4. IEEE Std 802.11™. "Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications". IEEE Standard for Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements; LAN/MAN Standards Committee of the IEEE Computer Society

Related Topics