Bluetooth Low Energy devices

I have quite a collection of Bluetooth Low Energy devices, so I thought I ought to integrate them with my home automation system.

This is a Ruuvi Tag that I bought on Kickstarter. It is acting as a temperature, pressure, and humidity sensor in my bathroom.

2017-10-10 13.19.16

The Ruuvi Tag works by default as an Eddystone weather station beacon and is part of Google’s implementation of the Physical web, which means that it can show a web page with the sensor values when you are close to the beacon.

You can also, using the same weather station firmware, put the device in a mode that sends the sensor values in binary data rather than as a URL with the data encoded in it. This is more useful for me as there is then a node.js package (node-ruuvitag) and a Node-RED node (RuuviTag node) that can be used to read the data and integrate with my home automation system by send it to an MQTT broker.  In this raw mode all the sensor data is encoded in the advertising data in a proprietary format, so there is no need to connect to the device to get the data. The device can also be programmed in Javascript using the Espruino Web IDE, if you flash the appropriate firmware.

In general, I want to link all my BLE devices to MQTT. There are some generic BLE beacon to MQTT projects, but I don’t believe they will deal with all my devices, particularly the ones that aren’t beacons, so I am integrating them one at a time. Even the ones that are beacons such as the Ruuvi tag, use proprietary data formats.

For the Ruuvi Tag I used the Node-RED node to forward the data to MQTT.

The Ruuvi tags are quite a nice way  of getting temperature, humidity and pressure data from the rooms in my house. They are low energy and run off coin batteries, and have nice packaging. I might get some more, but they don’t do the other things that I want room sensors to do, such as light level and human presence detection.

With Raspberry Pis now having BLE support, it is easy to use them as a central device to collect data from a collection of BLE peripheral devices using Node-RED.

Another BLE device that I got from Kickstarter is the Tepron Move blind controller:

I have just installed this but am having problems calibrating it, so Tepron are sending me a replacement device.

It uses Qualcomm CSRMesh technology, which creates a mesh of BLE devices.

I currently operate the Move device using the provided Android App, but would like to integrate it with my home automation system, so I can open and close it at dusk and dawn or via voice commands from Alexa or Google home.

Tepron don’t seem to have implemented their developer tools yet, but there are some CSRMesh CLI tools which I think can be made to control it. Someone has used them to integrate it with OpenHAB.

Bluetooth Low Energy has a simple model, but one that it a lot different to classic Bluetooth. BLE peripherals send out advertising data at regular (configurable) intervals. A central BLE device can scan for the advertising data, connect to the device and read and write characteristics to get data from the device or control it. Characteristics are collected into services. While connected to a device a central client can also receive notifications when characteristics changes.

The Ruuvi tag does not use characteristics as it encodes its sensor data in the advertisement data, or in the Eddystone URL. The main characteristic that the MOVE device uses, after calibration, is the required position of the blind. I think this is a byte value with 0 meaning closed and 255 meaning open.

There are several Android apps that are useful for investigating BLE devices, particularly LightBlue Explorer, and nRF Connect.

Yet another Kickstarter BLE device that I have is the LightBlue Bean+, which is programmable over the air by the Arduino IDE:

2017-10-10 18.06.17

The LightBlue Bean+ device supports Grove sensors, so it could be used to implement BLE sensors.

I had problems with both the Android app for the Bean+, and the node.js based CLI running on a Raspberry Pi. They were both very unreliable. But the CLI runs fins on my Ubuntu desktop machine.

Another BLE device that a lot of UK schoolchildren (and I) have is the BBC Micro:Bit.

2017-10-10 14.16.53

The Micro:Bit has some non-standard features including pairing and encryption. To make it work with standard BLE software such as the noble node.js package, I am using firmware that removes the non-standard security features, that comes with the node-bbc-microbit package written by Sandeep Mistry. Sandeep has written a lot of the open source BLE software including the node.js noble package, and Arduino libraries for various devices.

I also have a Pebble watch that I believe uses or can use BLE, but I have not seen it show up in any of the BLE scans that I have done. I think my Pebble might be using classic Bluetooth.

Devices that I have that can act as a central node to collect data from BLE peripherals are Raspberry Pi 3s, Raspberry Pi Zero Ws, my Oneplus 3T phone and my Gigabyte Ubuntu desktop.

I also have a HubPiWi Blue from Kickstarter that I can use to make an earlier Raspberry Pi Zero support Wifi and BLE.

My Google Home devices advertises a BLE service with a lot of charcteristics, but I don’t know what they do.

My Fitbit Charge2 appears as a Bonded device in nRF Connect, which I thinks means it requires pairing and implements encryption. It has a couple of services and several characteristics, but I haven’t been able to find documentation for them.

I also have a Haiku BLE Bike computer from Kickstarter, but haven’t deployed it yet.

2017-10-10 15.10.28

I have been reading a book on BLE:


I have ordered a couple of devices so that I can try some of the BLE projects from that book. So I have ordered a Bluefruit module for Arduino and a Parrot rolling spider drone, so I can control a drone via BLE.

2017-10-11 13.56.32

2017-10-11 13.54.48

The book has some interesting Arduino projects. Being able to program the Arduino and Bluefruit combination as a HID device opens lots of possibilities. The book’s HID project is a volume control for a mobile phone using a potentiometer  connected to an Arduino.

I have an old Fitbit Zip BLE device which I replaced with a Charge2 when the glue came unstuck and the device fell apart. But it still seems to be trying to talk to me from by box of dead equipment.

I also have an ESP32 development board, which supports BLE. The software for the ESP32, particularly for the Arduino IDE, seems a bit immature at the moment. It is possible to create a simple beacon that incorporates a sensor value in its name.

2017-10-11 13.59.37

Here is the working smart light switch from Chapter 3 of the book:

2017-10-11 19.04.31

And here is the lock example driving a solenoid st the moment as I have a lock mechanism on order:

2017-10-18 11.29.47

And here is the NeoPixel lamp from the book, using a very cheap Lamp, the Lampan, from Ikea:

2017-10-20 11.06.09

A phone app written using PhoneGap/Cordova allows you to change the colour and brightness., and switch the lamp on and off. It would be easy to add control of this via my home automation system and via Alexa and/or Google Home.

In general BLE is good for things that have associated phone apps because of the support in Android and iOS. It is good for low-powered devices. A problem with it is range. It it difficult to have one central device in my house, such as a Raspberry Pi, getting data from and controlling BLE peripherals across the house. The range of Wifi is better, but the pain with Wifi is connecting everything to the router and having them not working if the router or its Internet connection are down.

BLE mesh technology might help with the range issue. My Move blind uses the Qualcomm CSRMesh technology, but a mesh of one device is not much use. The Bluetooth Mesh standard has recently been published and Qualcomm will support that. If that standard gets a lot of support, it might solve the range issue and become a real competitor to Zigbee and Z-Wave for home automation devices.

I am going to have another look at Zigbee, as I have had some Xbee radios for a while and not done much with them. I have two commercial Zigbee networks in my house: one for my Smart meter and its associated display device, and another for my Hive thermostat and its boiler controller and Internet hub. Zigbee seems quite a reliable choice for home automation devices, but it is very complex.


This entry was posted in Home automation and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s