This is another setup blog post, which involves setting up bluez(http://www.bluez.org) on the Beaglebone Black wireless, which a prerequisite to install, and program using python library. Now when writing this blog post the latest tarball on the bluez.org download section is 5.50, but when I tried to install this version the tarball was missing a few dependencies, which meant I spent most of last week and the early part of this week trying to debug. But, with the Bluetooth challenge just having about a month more to go, I cut my losses and installed an older version using 5.33 tarball. Here are the steps to follow -
If you have just got your Beaglebone out of your parts shelf after a long time , run the following command
Please note, if you are following along, there are a couple of gotcha’s to the install, so follow all the steps in the sequence mentioned below and check to see that there are no errors. Now, once you’re done with update, run the following command to install the pre-requisite packages
apt-get -y install libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
Then download the tarball using, followed by extracting it
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.33.tar.gz tar xvfz bluez-5.33.tar.gz
Once done, run configure to check that all the packages you need are available on the Beaglebone, this will take a couple of mins so quickly scroll through the output to check that there are no error/ packages missing. Just in case they are missing you will have to install then separately.
make make install
Now you should ideally be ready to use Bluetooth, but since I plan on installing python library , the prequiste is to run bluetoothd daemon in experimental aka beta mode.
and added --experimental & at the line
/usr/local/bin/bluetoothd --experimental &
Now restart the bluetoothd systemd service using the following command , and then check the status of the service. Also check the status is running in the experimental version.
systemctl daemon-reload systemctl restart bluetooth systemctl status bluetooth
This means you are in a good spot to test using bluetoothctl command line tool to run a few test with a mobile app.
For the mobile app on my iPhone, I am using the nRF connect app by Nordic semiconductors to check if I can read the services and characterstic , which are easy to setup with some existing sample service - like the battery service ( org.bluetooth.service.battery_service) . To check out and read more about generic service check out - https://www.bluetooth.com/specifications/gatt/services.
Now once you have the app setup lets check if we can find the Battery Service using the Bluetooth command line tool. Run the following command when you are in the command line tool, till you see the local name that you have setup in the Advertiser section of the nRF connect app, in my case it is - MazeIphone
scan on device scan off
Copy the bluetooth address, and use the connect command followed by the address
Now list the attribute on the command line which you have setup in the nRF connect app, run
As part of the next blog post the plan is to have the BBC micro bit talks to the Beaglebone Wireless via Bluetooth.