Omega2 Bluetooth
Get Bluetooth Expansion Running on the Omega2
Bluetooth was the expansion I chose with the Omega2 kickstarter. Below are the first steps I took to try out the device. I was able to pair it with an Android phone and a MacBook. Next I want to try out some beacons for a basic home IoT experiment.
Assuming you’ve started your Omega2 and connected to the terminal:
Update
$ opkg update
Install Bluetooth libs/utils
Find the packages
$ opkg list | grep blue
Install
$ opkg install bluez-libs bluez-utils
Remote Bluetooth Device Setup
Ensure your BLE USB device is connected properly
$ hciconfig -a
then turn on the USB device:
$ hciconfig hci0 up
$ hciconfig hci0 sspmode enable
$ hciconfig hci0 piscan
You should see blinking a blue light from the USB device.
Bluetooth Control
To connect a device use bluetoothctl
Enter the command:
$ bluetoothctl
This is the bluetoothctl menu. Make the USB device discoverable/pairable and allow it to discover other devices.
Attempting to tab-autocomplete will give all the available commands.
$ show
$ agent on
$ discoverable on
$ pairable on
$ scan on
Ensure you have another device to pair with and enabled, it will appear in the list after the scan. Copy the ID and use to pair.
pair XX:XX:XX:XX:XX:XX
Prompt for a PIN, enter a value, e.g. 0000
and enter that on the remote device when prompted. Enable trust with the same device ID:
trust XX:XX:XX:XX:XX:XX
Links
There is a dated example project using Audio streaming over Bluetooth at the Onion Wiki