Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I connect to the FitBit Zip over Bluetooth 4.0 LE on Linux with bluez?

I purchased a FitBit zip. This device uses Bluetooth 4.0 LE. I would like to at least connect to it via bluez. If that is successful I want to see how much of the protocol I can figure out.

I am using a Lenovo P500 Ideapad which has integrated support for Bluetooth 4.0. It seems to work (kind of)

When I do:

hcitool lescan

I am able to find the device's bluetooth address, which (though potentially irrelevant) is: CF:D9:24:DB:F4:7B

Now, I read in another question: Bluetooth Low Energy: listening for notifications/indications in linux that I can listen for notifications and other protocol features. I've worked with old bluetooth, but I have no experience with bluetooth LE.

I am getting stuck trying to use hcitool lecc or gatttool to connect to the device. The connection times out and seems to leave bluetooth in a bad state on the Linux box. I am able to fix that by reloading bluetooth related kernel modules.

Any hints are appreciated. I'm trying with the latest bluez now.

like image 666
Thomas Dignan Avatar asked May 21 '13 09:05

Thomas Dignan


2 Answers

Have a look at the galileo project, we are able to connect to the tracker (and synchronise it) using the Fitbit dongle, which is also a BluetoothLE connector. The bytes used there should help you figure out the one you need ...

Full Disclosure: I am the maintainer of this project.

like image 125
Ben Avatar answered Nov 12 '22 08:11

Ben


I remember doing something similar to what you're describing and being able to connect fine. However, there was no listed characteristics for any indications/notifications so I wasn't able to get any data from the device except for the really basic meta data (device type, device name, etc).

I just tried to do the same thing today and I couldn't seem to establish a connection at all until I told it to use a random type of address.

Here's the results I recorded when I got it to work before:

# gatttool -b EB:47:1D:11:11:11 --addr-type=random --primary
attr handle = 0x0001, end grp handle = 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle = 0x0008, end grp handle = 0x0008 uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle = 0x0009, end grp handle = 0x000e uuid: adabfb00-6e7d-4601-bda2-bffaa68956ba
attr handle = 0x000f, end grp handle = 0xffff uuid: 0000180a-0000-1000-8000-00805f9b34fb

# gatttool -b EB:47:1D:11:11:11 --addr-type=random --characteristics
handle = 0x0002, char properties = 0x02, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x0004, char properties = 0x02, char value handle = 0x0005, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x0006, char properties = 0x02, char value handle = 0x0007, uuid = 00002a04-0000-1000-8000-00805f9b34fb
handle = 0x000a, char properties = 0x12, char value handle = 0x000b, uuid = adabfb01-6e7d-4601-bda2-bffaa68956ba
handle = 0x000d, char properties = 0x06, char value handle = 0x000e, uuid = adabfb02-6e7d-4601-bda2-bffaa68956ba
handle = 0x0010, char properties = 0x02, char value handle = 0x0011, uuid = 00002a29-0000-1000-8000-00805f9b34fb
handle = 0x0013, char properties = 0x02, char value handle = 0x0014, uuid = 0000fb00-0000-1000-8000-00805f9b34fb

You may have to pair the devices to get the actual useful data... not sure how to do that.

like image 11
Tim Tisdall Avatar answered Nov 12 '22 07:11

Tim Tisdall