Bluetooth Proximity Support

As an expermiment I have build a module which uses my Sitecom bluetooth dongle to determine the RSSI value of the bluetooth devices I have defined, so it can determine their location.
You can link a bluetooth device to a user to DomotiGa knows which user is around.

You have to make sure that your bluetooth device(s) and server are paired and connected.
You can arrange the pairing via the bluetooth manager on your server's gnome panel.
To make a connection you first need to figure out which channel your phone is on.

$ sdptool browse 00:11:22:33:44::66

Use your own phone's MAC address. This will list all sorts of bluetooth services that your phone offer.
Well the next step is simply to tell your system which channel you want to talk RFCOMM. RFCOMM is a special bluetooth serial port emulation over radio frequency (hence the name rf communication). It is quite literally an implementation of the RS232 serial protocol over radio. Bluetooth can handle several rfcomm channels consecutively. We just have to decide which one we're going to use for this exercise.. This is dead easy. Just look at the output of the sdp search which you ran just now and look at the RFCOMM channel number in the 'Dial up Networking' service section. In the case above, it's channel 1.

All you do now is specify that channel in your rfcomm.conf, so on my system that looks like this:

$ cat vi /etc/bluetooth/rfcomm.conf
rfcomm0 {
  bind yes;
  device 00:11:12:50:0C:EB;
  channel 1;
  comment "PPP connect";
}

When you use the Bluetooth browser from DomotiGa's Tools menu, you should see an RSSI field strength instead of 'Not Connected.'

Install Pre-Requisites

sudo apt-get install bluez-utils

Startup Log Entries:

2008/11/17 21:11:18  My Phone status changed to 0 and Near 
2008/11/17 21:11:18  Bluetooth Proximity detected that 'Ron' is home!

Other approach

l2ping

See Proximity / bluetooth ...., using hcitool rssi has as drawback that there needs to be a connection. Using l2ping is another approach.

bluetoothctl

This command, see bluetoothtcl can be used to scan for paired and non-paired devices and will return the MAC adddress, the name, an alias and the RSSI:

$ bluetoothctl 
[NEW] Controller 00:10:60:D0:F7:26 linux-1xwp.site [default]
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:10:60:D0:F7:26 Discovering: yes
[NEW] Device 28:47:AA:FC:D6:2B Nokia108
[NEW] Device D0:66:7B:36:93:AB D0-66-7B-36-93-AB
[CHG] Device D0:66:7B:36:93:AB RSSI: -83
[NEW] Device 50:85:69:B9:6E:B5 50-85-69-B9-6E-B5
[NEW] Device DC:C7:93:C6:5C:8E DC-C7-93-C6-5C-8E
[CHG] Device D0:66:7B:36:93:AB RSSI: -75
[CHG] Device 50:85:69:B9:6E:B5 LegacyPairing: no
[CHG] Device 50:85:69:B9:6E:B5 Name: [HTS]H5200
[CHG] Device 50:85:69:B9:6E:B5 Alias: [HTS]H5200
[CHG] Device D0:66:7B:36:93:AB LegacyPairing: no
[CHG] Device D0:66:7B:36:93:AB Name: DTVBluetooth
[CHG] Device D0:66:7B:36:93:AB Alias: DTVBluetooth
[CHG] Device DC:C7:93:C6:5C:8E LegacyPairing: no
[CHG] Device DC:C7:93:C6:5C:8E Name: Nokia 113
[CHG] Device DC:C7:93:C6:5C:8E Alias: Nokia 113
[CHG] Device D0:66:7B:36:93:AB LegacyPairing: yes
[CHG] Device 50:85:69:B9:6E:B5 LegacyPairing: yes
[CHG] Device DC:C7:93:C6:5C:8E LegacyPairing: yes
[CHG] Device DC:C7:93:C6:5C:8E RSSI: -73
[CHG] Device DC:C7:93:C6:5C:8E RSSI: -82
[CHG] Device 28:47:AA:FC:D6:2B RSSI: -70
[CHG] Device D0:66:7B:36:93:AB RSSI: -83
[CHG] Device D0:66:7B:36:93:AB RSSI: -75

bluetooth.sh

This a script written by mobilewill that you can find on https://github.com/FriedCircuits/DomotiGA-BT-WiFi-Proximity/blob/master/bluetooth.sh

It uses a combination of hcitool and ping to detect if a device is within range.

See also DomotiGA Bluetooth\WiFi Proximity Shell Script.

    Updated by: danfos, Updated almost 3 years ago
    Access count: 72868 since 2011-08-25

    Attached Files

    install_log.txt Magnifier (1.62 KB) rdnzl, 12/02/2008 11:45 AM

    sitecom-bluetooth.jpg (14.3 KB) rdnzl, 08/23/2011 12:46 PM

    Also available in: PDF HTML TXT