RPi Bluetooth LE

From eLinux.org
Revision as of 20:51, 17 March 2014 by IanH (Talk | contribs) (Created page with "= Bluetooth LE on the Raspberry Pi = At the time of writing Bluetooth Low Energy (BLE) is not well supported by the standard Raspberry Pi distributions. Some work is required...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Bluetooth LE on the Raspberry Pi

At the time of writing Bluetooth Low Energy (BLE) is not well supported by the standard Raspberry Pi distributions. Some work is required to get it working, as described below.

Pre-requisites

Software

This page has been tested using the Raspbian Wheezy distribution, in particular the image at:

http://downloads.raspberrypi.org/raspbian/images/raspbian-2014-01-09/2014-01-07-wheezy-raspbian.zip

For reference, uname -a on the test system returned:

Linux raspberrypi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/Linux  

Hardware

You will need a Bluetooth 4.0 compatible USB adapter to use with the Pi. The following devices have been tested:

BlueZ installation

By default, the Wheezy distribution comes without a Bluetooth stack. The bluez package is version 4.99, which has patchy support for Low Energy. You can build and install a more modern version as follows:

BlueZ 5.4 build instructions

Firstly, you'll need a download and install a number of development libraries. From a command prompt run:

sudo apt-get install libdbus-1-dev libglib2.0-dev libdbus-glib-1-dev
sudo apt-get install libusb-dev libudev-dev libreadline-dev

Then, download the source:

mkdir -p work/bluepy
cd work/bluepy
wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.4.tar.xz
xz -d bluez-5.4.tar.xz
tar xvf bluez-5.4

If successful, you'll now have a bluez-5.4 source code directory on disk. To build it, do:

cd bluez-5.4
./configure --disable-systemd
make

This will take half an hour or so. When this is done, do:

sudo make install

Links: other Bluetooth Low Energy resources