Android/BeagleBone Interaction Via Bluetooth RFCOMM

In this posting I will demonstrate how to connect between an Android phone and a BeagleBone Black Wireless (BBBW) using bluetooth RFCOMM.

Posted by Pete W on 2017-05-21T23:55:05-04:00

Categories: BeagleBone Black Wireless, Complete, General Purpose, Intermediate

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.

BBBW Preparation

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
  •   to
  • ExecStart=/usr/lib/bluetooth/bluetoothd -C
  • Save the file and reboot.  Start again at item 6.
  • BBBW should now be ready for Android commands.

Android Preparation

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.

  • 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.

Comments are not currently available for this post.