Main Content

Create, Configure, and Simulate Bluetooth BR Piconet

This example shows how to simulate a Bluetooth® basic rate (BR) piconet by using Bluetooth® Toolbox.

Using this example, you can:

  1. Create and configure a Bluetooth BR piconet with one Central and multiple Peripheral nodes.

  2. Create, configure, and share connections between the Central and Peripheral nodes.

  3. Simulate a Bluetooth BR piconet with synchronous connection-oriented (SCO) traffic, and retrieve the statistics of the Central and Peripheral nodes.

Create a wireless network simulator.

networkSimulator = wirelessNetworkSimulator.init;

Create a Bluetooth BR node, specifying the role as "central".

centralNode = bluetoothNode("central")
centralNode = 
  bluetoothNode with properties:

         TransmitterGain: 0
            ReceiverGain: 0
     ReceiverSensitivity: -100
             NoiseFigure: 0
    InterferenceFidelity: 0
                    Name: "Node1"
                Position: [0 0 0]

   Read-only properties:
                    Role: "central"
             NodeAddress: "D091BBE70001"
        ConnectionConfig: [1x1 bluetoothConnectionConfig]
          NumConnections: 0
                      ID: 1

Create two Bluetooth BR nodes, specifying the role as "peripheral".

peripheralNode1 = bluetoothNode("peripheral");
peripheralNode2 = bluetoothNode("peripheral")
peripheralNode2 = 
  bluetoothNode with properties:

         TransmitterGain: 0
            ReceiverGain: 0
     ReceiverSensitivity: -100
             NoiseFigure: 0
    InterferenceFidelity: 0
                    Name: "Node3"
                Position: [0 0 0]

   Read-only properties:
                    Role: "peripheral"
             NodeAddress: "A1E24C190003"
        ConnectionConfig: [1x1 bluetoothConnectionConfig]
          NumConnections: 0
                      ID: 3

Create a default Bluetooth BR connection configuration object to configure and share the connection between the Central and Peripheral nodes. Specify the SCO packet type.

cfgConnection = bluetoothConnectionConfig(SCOPacketType="HV3")
cfgConnection = 
  bluetoothConnectionConfig with properties:

    CentralToPeripheralACLPacketType: "DH1"
    PeripheralToCentralACLPacketType: "DH1"
                       SCOPacketType: "HV3"
                 HoppingSequenceType: "Connection adaptive"
                        UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 ... ]
                        PollInterval: 40
                       InstantOffset: 240
                    TransmitterPower: 20
                  SupervisionTimeout: 32000

   Read-only properties:
                      CentralAddress: [1x0 char]
                    PrimaryLTAddress: []

Configure connections between the Central and the Peripheral nodes. Note that, when you configure the connections, the SCO traffic is internally added as two-way traffic at the Central and Peripheral nodes.

connection1 = configureConnection(cfgConnection,centralNode,peripheralNode1);
connection2 = configureConnection(cfgConnection,centralNode,peripheralNode2);

Create a Bluetooth piconet consisting of one Central and two Peripheral nodes.

nodes = [centralNode peripheralNode1 peripheralNode2];

Add the Central and Peripheral nodes to the wireless network simulator.

addNodes(networkSimulator,nodes);

Set the simulation time in seconds, and run the simulation.

simulationTime = 0.3;
run(networkSimulator,simulationTime);
Custom channel model is not added. Using free space path loss (fspl) model as the default channel model.

Retrieve application, baseband, and physical layer (PHY) statistics corresponding to the Central and Peripheral nodes.

centralStats = statistics(centralNode);
peripheral1Stats = statistics(peripheralNode1);
peripheral2Stats = statistics(peripheralNode2);

References

[1] Bluetooth® Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed June 22, 2022. https://www.bluetooth.com/.

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

See Also

Objects

Functions

Related Topics