Close

Switching to Bluetooth Low Energy

A project log for Ariadne Headband

Arduino-based heaband that uses haptic feedback to navigate blind people. Controlled via Bluetooth using Android app.

vojtech-pavlovskyVojtech Pavlovsky 10/15/2018 at 16:450 Comments

Since the beginning of our project we have used HC-06 Bluetooth module. This component is based on Bluetooth Classic – a kind of older version of Bluetooth protocol. When you use Bluetooth Classic and connect two devices, a communication channel will be created between them so they can send data to each other. There is only one channel and it is kept open when you are connected. This is very useful when you want to send huge amount of data through it, e. g. sound (like wireless speakers). Keeping connection active at all times means that it will also drain battery a lot (at all times).

For this reason a new version of Bluetooth protocol was designed: Bluetooth Low Energy or simply BLE (fun fact: in Czech the word “ble” is almost exactly the sound a child make when he doesn’t like food and spits it out). BLE uses so called characteristics instead of single channel. Image characteristics as a row in a data table. Each has its name or more exactly unique identificator (UUID) and some value placeholder. You can either READ characteristic or WRITE some data you want into it. Very useful is also NOTIFY function which will listen and notify you when given characteristic’s data was changed.

BLE is often used in fitness wearables. These type of devices often track multiple health informations, be it temperature, heart rate, how many meters have you walked and more. Sending all this individual data together would be cumbersome and not very pretty. You might make a byte array and fit every possible data into it (method we use and describe lower why) and send it. But BLE offers far better way.

You instead write different values to different characteristics on our device that collects it. Then on the mobile phone you simply can read different characteristics and put them into different variables. Fine thing about this is that you can listen for changes on specific characteristics (like heart rate and notify the user that they should calm down) or on the other side completely ignore some values you do not need. So instead of listening to everything that is sent to you as is true in the case of Bluetooth Classic, on BLE you have way more granular control over what data you really want to read from the device and also when you want to read it. This also allows you to improve battery life, sometimes significantly.

We have HC-06 Bluetooth Classic and HM-10 Bluetooth Low energy modules in our testing. To illustrate you how drastically different power consumption can be, take a look on a graph we have created. When the module is not connected to anything, it is looking for new connection and is discoverable. During this phase, HC-06 energy consumption can vary up to 200 mA, though the average is 92 mA. HM-10 is significantly lower: it consumes only about 9 mA. When the module is connected to other device (mobile phone in our case), using BLE can save up to 50 % of power when compared to old-school HC-06.

HM-10 Module

We have bought a HM-10 BLE module for purpose of testing Bluetooth Low Energy. It is one of the cheapest available BLE module (mainly because of the plethora of its clones).

In the picture above, you can see HC-06 module (left) and HM-10 module (right). They look almost identical.

There is one (kind of funny) thing to note. While BLE uses characteristics instead of single communication channel. But there is a catch with HM-10: it has only one available characteristic that you can write to. Anything written to this characteristic will be immediately sent to Arduino’s serial port and vice versa. This means that while HM-10 is BLE it pretty much acts like a standard Bluetooth Classic module.

We are planning to find better BLE module to put into Ariadne Headband. BLE protocol is incompatible with Bluetooth Classic so we had to change our Android’s app inner workings. When we will eventually find an ideal piece of BLE module, we will be ready to go.

Software Implementation

As I already mentioned, BLE is incompatible with BC. We had to completely rewrite our app to make it work with BLE protocol. Due to this, we could remove dependency on AndroidSPP third-party library. Instead, we used purely Android’s default libraries to work with BLE.

Updates are already uploaded to our repository. Remember that with this new updates, Ariadne Headband will not work with non-BLE modules. We would also like to mention that we are extensively working in our free time on making Ariadne Headband better so not everything is already prepared for prime time. Stay tuned!

Discussions