Now let's go and find out who's out there! Make sure your BT device is discoverable. On my Android phone, I go to settings, bluetooth, and check the box 'make visible'

Now let's go and find out who's out there! Make sure your BT device is discoverable. On my Android phone, I go to settings, bluetooth, and check the box 'make visible'

−

hcitool scan #lists available devices, my phone was found

+

hcitool scan

−

bluez-simple-agent hci0 <my phone mac address> # Note I had to copy this script from another system, it was not on my image

+

You should see your device and a mac code. Now let's pair them up:

−

# Minnow and phone will ask a few questions, after which they are paired

+

bluez-simple-agent hci0 <my phone mac address>

−

# Now set up serial connection through phone

+

−

rfcomm listen hci0 &

+

Minnow and phone will send eachother confirmation codes, which you are asked to verify, after which they are paired You really have to do this step only once, the bluetooth service remembers the fact that you're paired next boot. If, for some reason, you want to unpair:

−

# Now I start a 'Bluetooth Terminal' app on my android phone, and connect to my paired minnow. Once connection is set up, I now have a /dev/rfcomm0 in my minnowBoard. Test out serial communication:

+

bluez-simple-agent hci0 <my phone mac address> remove

−

minicom -D /dev/rfcomm0

+

For my experiment, I want to create a serial connection, so I use rfcomm to create one:

−

# now I can type text between phone and minnowboard.

+

rfcomm listen hci0 &

+

+

Your minnowboard will listen for a serial connection request from hci0 (paired with my phone). If found, rfcomm will set up a /dev/rfcomm0 node, which you can read and write from. Now I start a 'Bluetooth Terminal' (free, see google play store) app on my android phone, and connect to my paired minnow. Once connection is set up, I now have a /dev/rfcomm0 in my minnowBoard. To test out my serial communication:

+

+

minicom -D /dev/rfcomm0

+

+

After which you shoudl be able to type text between phoen and Minnowboard. Similarly, if you've paired, for instance, with a BT GPS module, you should be able to serially read GPS data, but I have not tried this.

Revision as of 21:52, 27 August 2014

This guide will walk you through the steps necessary to add additional kernel modules to your Angstrom build, in order to properly support a Bluetooth USB adapter on your Minnowboard

Now proceed with the rest of your build

Once the above changes have been made, you can proceed onto the "Compile Time" steps in the Building Angstrom Linux for the MinnowBoard guide. When your image is running, you should see that the new modules have been compiled and installed in "/lib/modules/3.8.13-yocto-standard" (and that similarly, your kernel interfaces reflect the newly configured functionality)

Configuring wireless ethernet once your image is running

First install the Bluez4 package. You can do this by adding it to your build, as described in Adding Additional Packages To Your Build, by adding a reference in your "setup-scripts/conf/local.conf" file:

IMAGE_INSTALL_append=" bluez4"

Note that installing the newer bluez5 package resulted in build-errors for me, not sure why, so I reverted back to bluez4.

Alternatively, you can install Bluez it after your build on your Monniwboard by doing:

opkg install bluez4

Setting up Bluetooth

Unfortunately, if you install the bluez4 package during build-time, the Angstrom image seems to be missing the very useful script 'bluez-simple-agent', which can be used for pairing. You can copy this Python script from Ubuntu to your Minnowboard:

scp -r bluez-simple-agent root@<your_Minnowboard_ip>:/usr

Now plug in your bluetooth USB dingle, and let's start pairing up with some Bluetooth devices! First, we start the service:

systemctl enable bluetooth.service

Apparently rfkill has a soft-block on the bluetooth device hci0 be default, so I had to unblock it first:

rfkill unblock all && rfkill list

We use hciconfig to see what bluetooth devices we have:

hciconfig

We should see an hci0. If not, do a lsusb to see if the dingle is there, and a lsmod to see if the kernel modules are loaded (btusb and others). Then we bring up the device, and tell it to scan:

hciconfig hci0 up piscan

We give the service a name

hciconfig hci0 name minnow

We then set the device to simple pairing mode. This prevents programming of pin-codes, and simply lets the 2 bluetooth endpoints verify each other by confirming a key.

hciconfig hci0 sspmode 1

Technically we are now ready to pair, but in my experiment I wanted to establish a serial protocol (SP) across bluetooth between my Android phone and my Minnowboard, so I had to enable that protocol:

sdptool add SP

Now let's go and find out who's out there! Make sure your BT device is discoverable. On my Android phone, I go to settings, bluetooth, and check the box 'make visible'

hcitool scan

You should see your device and a mac code. Now let's pair them up:

bluez-simple-agent hci0 <my phone mac address>

Minnow and phone will send eachother confirmation codes, which you are asked to verify, after which they are paired You really have to do this step only once, the bluetooth service remembers the fact that you're paired next boot. If, for some reason, you want to unpair:

bluez-simple-agent hci0 <my phone mac address> remove

For my experiment, I want to create a serial connection, so I use rfcomm to create one:

rfcomm listen hci0 &

Your minnowboard will listen for a serial connection request from hci0 (paired with my phone). If found, rfcomm will set up a /dev/rfcomm0 node, which you can read and write from. Now I start a 'Bluetooth Terminal' (free, see google play store) app on my android phone, and connect to my paired minnow. Once connection is set up, I now have a /dev/rfcomm0 in my minnowBoard. To test out my serial communication:

minicom -D /dev/rfcomm0

After which you shoudl be able to type text between phoen and Minnowboard. Similarly, if you've paired, for instance, with a BT GPS module, you should be able to serially read GPS data, but I have not tried this.