For this demonstration I have created an Android application which
- discovers bluetooth devices
- connects to a bluetooth device
- toggles LED connected to bluetooth device
BBBW Preparation
- Flash your BBBW w/the latest image, currently bone-debian-8.7-iot-armhf-2017-03-19-4gb.img
- apt-get update; apt-get upgrade
- apt-get install python-bluez
- Pull the python sources from github
- Add green/red/yellow LED to BBGW. You can changes the port assignments in perky_blue.py
LED GPIO green 48 red 49 yellow 60 - As root, make BBBW discoverable for bluetooth by invoking bluetoothctl(1)
- You might see an error like the screenshot below: If so, you need to tweak /etc/systemd/system/dbus-org.bluez.service. Change this line:
- BBBW should now be ready for Android commands.
ExecStart=/usr/lib/bluetooth/bluetoothd
to
ExecStart=/usr/lib/bluetooth/bluetoothd -C
Save the file and reboot. Start again at item 6.
Android Preparation
- Pull the source from github
- Compile using Android Studio and deploy to phone.
- Ensure bluetooth is enabled on your phone
- Start the application ("PerkyBlue")
- Press "Start Discovery" and wait ~20 seconds for completion.
- Usually the host name is "beaglebone" (in this case it is "porkchop"). Press on the host to connect. When connection succeeds you will see both the Android app and the python app update.
- You can now press for red/yellow/green LED toggle, the corresponding LED should light on BeagleBone.