I’ve recently been able to get my hands on some Bluetooth UART modules. They’re under the name HC-05/HC-06/HC-07 on websites such as aliexpress, ebay and dealextreme. They’re available for around $8USD each with international shipping included.
If you’re familiar with using a UART/RS-232/TTL communications, you’ll love these little cuties! These devices run off 3.3V and accept TTL serial input with baud rates between 300bps to 115200bps. Not bad if you need some cheap, reliable wireless connections.
With these being bluetooth, not only can they talk to each other, but they can talk to smartphone devices and laptops with ease! They also handle the entire BTstack for you so you dont need to worry about it, and all you get is CRISP , clean communications unlike those AM/FM 433MHz ‘dumb’ modules – where you need to worry about noise, antennae’s etc!
So they all seem great on the outside. And they mostly are, but my main concern about using this devices would be the latency. I wonder how long it takes for a character to be sent from the micro to the HC-05 to another HC-05 and then seen on the remote HC-05 output.
Lets take a quick look!
- Firstly, using AT Commands that the HC-05 accepts, we configure one as master and one as a slave.
- Pair the master with the slave
- Send a character from the master
- Time the delay until the character appears on the slave’s output.
To begin configuring, we need to set the module’s KEY input to high.
Here are the commands for the master. The units are already shipped as a Slave setup, so no need to re-init the Slave module.
These commands essentially set the module as a Master. Inquire (bluetooth’s lingo for search for devices) and then connect (Link) and pair (PAIR) with the device. The FSAD command is not a random keyboard press – it’s Check with the Device is already paired. Since these devices remember all previously paired devices.
We then remove the KEY input and it becomes floating, it’s okay since the module has an internal pull down resistor.
The unit come out of COMMAND mode goes into DATA. Here are the results when sending characters.
With 2ms intervals its approximately 13.8ms before the character comes out of the Remote/Slave device.
With 2ms intervals its approximately 7ms before the character comes out of the Remote/Slave device.
So you can see that the character latency varies between about 5ms-20ms. It’s a bit laggy if you ask me.
However, there’s more. The Bluetooth radio’s stop talking to each other after around 2 – 3seconds of inactivity. The current then noticeably drops from 15.5mA per BT module to 8mA per BT module. So with 2 BT modules, I found that the current increased around 15mA from idle to transmitting.
You can probably guess that the latency when transmitting successive bytes is going to be a low lower than when it has to transmit from an idle state. And that’s dead right! Check out these HUGE latencies!
Due to the nature of it all, I wasn’t able to capture the range of latencies when transmitting from an Idle state. But from the two bytes i did capture, the latency was around 42ms. That’s significant especially if you are dealing with Audio and timing applications.
What’s important here is that the jitter is constant. Jitter is the variance in latency, having a constant, known latency is sometimes better than a lower latency but tends to vary wildly!
So there you have it, some performance parameters for the Bluetooth HC-05 modules!
How you get around these issues is all part of your design!
- Keep the connection active by sending dummy data
- Pre send the data so it is buffered on the client side.
- Burst send data so the connection remains active throughout the entire transmission.
What new knowledge, materials, products, devices, processes or services does this aim to produce?
A convenient way to transfer data between devices. No need to worry about wires or the right type of cable. Wireless data transmission has it’s advantages over wired methods.
What eligible activities were undertaken to meet this objective?
1. An investigation into wireless data transmission techniques.
2. Performance of bluetooth Serial port profile and HC-05 modules
3. Developing a method of dealing with possible latency issues.
What is the scientific or technological uncertainty this project seek to resolve?
Since wireless communications has significant latency issues, we need to develop or design a method which can deal and handle the significant latency. It may be pre-buffering data or burst data transfer or keeping the connection active so that it never idles (sending dummy data)
What appreciable element of novelty does this project contain?
No wires. Seamless setup and integration between devices.