Close

Adventures in Bluetooth development

A project log for Watchduino2

Inexpensive Open Source BLE smartwach compatible with Arduino tooling

Mar BartolomeMar Bartolome 10/02/2015 at 22:070 Comments
During the last week, we've done some researching around different Bluetooth options for Watchduino 2, with aims giving an extra kick to the battery life. As you know, the current build of Watchduino 2 has a battery life of around 48 hours; the path to improve that even further goes through optimizing our Bluetooth usage.The Bluetooth modules that are commonly used in hobby electronics projects (the HM-10, CC2540 or nRF8001) are essentially a radio plus a little controller microprocessor, exposing even some GPIO pins on a breakout board. The microprocessor usually allows you to finely tune certain parameters, such as the strength of the signal, intervals for data exchange, or activating and deactivating certain capabilities of the circuit. This would be a smart way to achieve some extra power efficiency.Not all is rainbows and sunshines for Watchduino though. As you aware, we are using the HM-10 module for Watchduino 2. This module is manufactured by Jinan Huamao, a not-too-fancy chinese company. We picked it originally because of how cheap it is (you can easily find them for less than 5 USD on Aliexpress), and our priority at the time was optimizing on cost...


... But cheap comes at a prize. Now that we find ourselves wanting to fine tune the module, we find a stumbling block in the module's sloppy interface, and obscure documentation. All that we have to work with is a PDF document (that has obviously been the product of an automated translation) describing AT commands to interface with the module's processor. Just look at a particularly... brilliant? extract from the document, and judge yourself:

7.1 Send "I am iron man, I am iron man, I am iron man, I am iron....." string.
Yes, that is a joke, in sleep mode, you can send a long string (Length > 80 or more),
that string can made module wake up, and you will receive "OK+WAKE" string through UART.

There are some alternative open source firmware projects for HM-10 that might be more helpful, but don't seem to be mature enough. So we are considering trying with a different Bluetooth module as an alternative, one that is less obscure and better documented.

This alternative is also not hassle free. The problem with Bluetooth modules is that each of them comes with it's own firmware, and it's own particular set of options and AT commands to interface with it. So if you write any code targeted at interacting with the Bluetooth module, it needs to be customized for the particular module that you are using. You cannot simply swap hardware keeping your code intact, which is not great for testing the different options.

It's also not great when you go and try to find guidance in the source code of other projects using Bluetooth with Arduino: each of them deals with Bluetooth differently depending on the module used; and often to understand it you need to study the specific module's documentation first.

We are quite frustrated about this, because it's a problem that the Arduino community has definitely solved with screens. Screens are a similar case: each of them is particular, has different characteristics, and has it's own way of interacting with it. But as with Bluetooth, they talk to Arduino via a serial interface, and "sort of" they function in the same way, despite their differences (it's all about switching pixels on an off, no matter the size of your screen). It would be a nightmare to program them if it were not for the amazing u8glib library, that abstracts away the nitty gritty details of each particular screen, and lets you interact with a broad set of them using a common high level interface.


Surely it must be possible to construct something similar for Bluetooth modules: their differences are smaller than their similarities, and can ceirtanly be abstracted into a higher level interface. Anyone looking for a challenge to work into?

Discussions