Sending and Receiving Data Between Two Bluetooth Dongle

237

3

Introduction: Sending and Receiving Data Between Two Bluetooth Dongle

About: The BleuIO is Bluetooth low energy solution that can be used to create new BLE 5.0 applications in the fastest and easiest way.

In this instructables, i will demonstrate how two Bluetooth dongles can be paired together and share data between them. To pair two Bluetooth dongle, one of them needs to be configured as Central and other needs to be configured as Peripheral. We already have a Python script that sends data back and forth between dongles.

In short :

  • One dongle will take on the Central role and the other will take on the Peripheral role.
  • Then they will connect to each other.
  • The Central dongle will then start off sending a message; "Echo".
  • The Peripheral dongle will then receive the message and send it back to the Central dongle which in turn will receive it and send it back and so forth until the script is stopped.

Device Required:

Software Tools Required :

Step 1: Install Python

Install Python on both laptop and connect a USB Dongle on each of them.

For a quick setup, copy the following script and save it on your local directory as sps_example.py . You can also get the source code from the GITHUB PAGE.

Step 2: Change the COM-port

Change the COM-port in the script on both computers to match the ones your dongles is actually connected to.You can find com port details on device manager.

For the one that will be set up as the Central dongle you will also need to change the target_dongle_mac_address variable in the script to the MAC address of your Peripheral dongle. There are several ways of getting MAC address of a target dongle. Here we will obtain it from device manager.

Select your device. go to properties > Details. Select Device Instance Path. And the last value is the dongle MAC address. 40:48:XX:XX:XX:XX

Step 3: Send, Receive Data

Open up the command prompt, on both computers, in the directory where the script is located. Start the script by typing python sps_example.py and press Enter.

You should now be prompted to enter 1 or 2 depending on what role the dongle should have. Set one as Peripheral and the other as Central. It is advisable to setup the Peripheral first as the Central will need someone to connect to.
You should now see in the terminal how the dongles send and receive data to and from each other. The script will run until you stop it.

And that is an example of how we can send data between two dongles. If you want to stop the script, you can simply press control C.
Full source also available on GitHub.

Follow the project video for better understanding.

Be the First to Share

    Recommendations

    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest
    • Puzzles Challenge

      Puzzles Challenge
    • Rice & Grains Challenge

      Rice & Grains Challenge

    Comments