was successfully added to your cart.

Raspberry Pi with Bluetooth

By April 7, 2016Uncategorized

The new Raspberry Pi 3 comes with Wifi and Bluetooth chip, but my v2 does not.  I do have a bluetooth dongle and I wonder if the new Raspbian OS already included the bluetooth driver so I don’t have to install it myself.  So I reinstall the OS and YES!  It already has bluetooth commands and can detect my bluetooth dongle!  Cool!

root@raspberrypi:~# hciconfig
 hci0: Type: BR/EDR Bus: USB
 BD Address: 00:1B:DC:06:C1:18 ACL MTU: 310:10 SCO MTU: 64:8
 UP RUNNING
 RX bytes:610 acl:0 sco:0 events:36 errors:0
 TX bytes:942 acl:0 sco:0 commands:36 errors:0
root@raspberrypi:~# hcitool scan
 Scanning ...
 34:C7:31:AB:27:F5 FHMLAPYAMADAT
 34:C7:31:AB:64:A2 KURODATCALT

Bug Fix

Bluetooth works but I found it can pair, trust, but cannot connect. What good with bluetooth module when it cannot connect to anything? I found by editing /etc/systemd/system/bluetooth.target.wants/bluetooth.service file fix the connect issue. Here is how:

vi /etc/systemd/system/bluetooth.target.wants/bluetooth.service

change the line

ExecStart=/usr/lib/bluetooth/bluetoothd

to

ExecStart=/usr/lib/bluetooth/bluetoothd -C

Save and then restart the Raspberry Pi

Connect two Raspberry Pis with Bluetooth

On one of the Raspberry Pi, make its bluetooth discoverable by doing

hciconfig hci0 piscan

Once this command is entered, hciconfig will show hci0 has

UP RUNNING PSCAN ISCAN

instead of just

UP RUNNING PSCAN

On the other Raspberry Pi, the hcitool scan command will see Raspberry Pi 1 now.

 

 

Leave a Reply