In this posting I will demonstrate how to connect between an Android phone and a BeagleBone Black Wireless (BBBW) using bluetooth RFCOMM (basically a wireless RS-232 link).
For this demonstration I have created an Android application which
- discovers bluetooth devices
- connects to a bluetooth device
- toggles LED connected to bluetooth device
The BBBW hosts a python application which accepts a connection request and manages three LED which are remotely controlled from the Android application.
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
- 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
- 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:
- ExecStart=/usr/lib/bluetooth/bluetoothd -C
- Save the file and reboot. Start again at item 6.
- BBBW should now be ready for Android commands.
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.
- Pull the source from github
- Compile using Android Studio and deploy to phone.
- Ensure bluetooth is enabled on your phone
- Start the application ("PerkyBlue")
- You can now press for red/yellow/green LED toggle, the corresponding LED should light on BeagleBone.