Create a Bluetooth Low Energy repeater using multi-connection feature

April 1, 2021
images


Bluetooth low energy technology offers a suitable way of connecting smart devices.
However, despite the convenience, you can bear witness that the range offered can be a little limiting. Sometimes the connection tends to drop or lag when you move a little further away from the device. Fortunately, it’s easy to overcome this range limitation with the Bluetooth repeater.

This article will explain how to create a BLE Repeater using BLE USB dongle called BleuIO and python.

The BleuIO is Bluetooth low energy solution that can be used to create new BLE 5.0 applications in the fastest and easiest way. Using this dongle’s multi-connection feature, we will make a simple repeater where one dongle scans nearby devices data and sends it to the repeater. At the same time, the repeater passes the data to the receiver dongle. And that’s how a repeater will help us overcome the range limitation.

For this project, sender dongle will scan for air quality data from HibouAir device and pass the advertised data along with timestamp to the repeater. The repeater dongle will be connected to a Raspberry pi which will forward data to the receiver dongle.

We have already created a sample script in python, which will help us to do the task.

Requirements :

  1. 3 pcs BleuIO Dongle.
  2. HibouAir or any BLE device
  3. Python 2.7 or Python 3.4 and newer
  4. pyserial 3.5

Task:

Step 1: 

Let’s start by cloning the repository from 

https://github.com/smart-sensor-devices-ab/bleuio_repeater_example

Once you cloned the script, you will find three different python script called

  • repeater_example_reciever_dongle.py
  • repeater_example_repeter_dongle.py
  • repeater_example_sender_dongle.py

We need to update the ports on those scripts manually.

Step 2:
Connect two dongles on your PC. You can do the process on three different PC or Raspberry Pi.
For this project, I have connected both the sender and reciever dongles to one PC.
After connecting the dongles, open device manager (windows) to find ports of each dongle.

On my PC, I have two dongles connected on port 5 and 6.
Let’s make COM 5 as the sender, COM 6 as a receiver.
Now open the scripts and set the ports number accordingly.


We also need to know repeater dongles ID. To do that, we can simply advertise the dongle on Raspberry pi using AT+ADVSTART command .Then do a gapscan using AT+GAPSCAN from sender dongle and look for a dongle called BleuIO


Once we have repeater dongles id, we can put it on our scripts.

Step 3 :

Now lets run the script. 

First move to the script directory on Raspberry pi and using command prompt type sudo python3 repeater_example_repeter_dongle.py to run repeater script.

Similarly, run receiver and sender scripts accordingly on PC.

As the name suggests, the repeater will repeat its content. On the terminal, we will see the message sent to the repeater from the sender, and the repeater forwards the data to the receiver dongle. 

Follow this video for a better understanding.

Share this post on :
    LinkedIn