Sneaky.NET

Tom’s Home page

Bluetooth on Rasberry Pi - Raspbian

I got Bluetooth working on the previous version of Raspbian, but I’m upgrading.. so I need it working in this version as well.

Needed to install the required tools..

apt-get install bluez python-gobject python-dbus

Then scan for the bluetooth device (hcitool scan) and then pair with it (bluez-simple-agent.) The rfcomm bind command creates the device. When you’re done, you can use rfcomm release 0 to drop it.

1
2
3
4
5
6
7
8
9
10
11
12
13
pi-2:/home/tomn# hcitool scan
Scanning ...
        00:13:01:06:05:52       HC-05
bluez-simple-agent   bluez-simple-service
pi-2:/home/tomn# bluez-simple-agent hci0 00:13:01:06:05:52
RequestPinCode (/org/bluez/3107/hci0/dev_00_13_01_06_05_52)
Enter PIN Code: 1234
Release
New device (/org/bluez/3107/hci0/dev_00_13_01_06_05_52)
pi-2:/home/tomn# rfcomm bind rfcomm0 00:13:01:06:05:52
pi-2:/home/tomn# ls -l /dev/rfcomm0
crw-rw---T 1 root dialout 216, 0 Jun  1 16:00 /dev/rfcomm0
pi-2:/home/tomn#

Then, I installed minicom and was able to change the serial port to /dev/rfcomm0 and set the baud rate. From there, I could take with the Arduino on the other end.

Just a note - I found that powering my Pi from a USB port on a computer, the bluetooth woudl fail. When powered from a stand alone USB battery (rated for 1amp) it worked.

This might come in handy.. seems to to the same as minicom when you start it..

rfcomm connect rfcomm0 00:13:01:06:05:52

Comments