Is there any other way to get RSSI values than blueZ (Pybluez)
Asked Answered
S

1

8

I am struggling very hard on this one, so any help / pointers would be greatly appreciated.

I have been trying to get precise values from RSSI with pyblueZ

I get some good results, but this below is the thing I don't want (from blueZ doc) :

For a BR/EDR Controller, a Connection_Handle is used as the Handle command parameter and return parameter. The RSSI parameter returns the difference between the measured Received Signal Strength Indication (RSSI) and the limits of the Golden Receive Power Range for a Connection_Handle to another BR/EDR Controller. The Connection_Handle shall be a Connection_Handle for an ACL connection. Any positive RSSI value returned by the Controller indicates how many dB the RSSI is above the upper limit, any negative value indicates how many dB the RSSI is below the lower limit. The value zero indicates that the RSSI is inside the Golden Receive Power Range.

In others words, when the receiver is somewhat near the generator, the RSSI value will still be 0 (2/3 meters range maybe) And it really bothers me.

The method I used is the command HCI_Read_RSSI from BlueZ, there is an example here : https://github.com/ewenchou/bluetooth-proximity

Another way to get RSSI value is to get it with event : HCI_Inquiry_Result_with_RSSI, here I get true value of RSSI, BUT, it is discovery mode and it is kinda slow and return me all devices' mac addresses. And that I don't want as well.

With my knowledges and the fact that I can't get google to find what I want, I got to a point where I seem to be stuck.

So my questions are :

  1. Is there anyway to dig into the bluetooth API provided by blueZ ? I can't seem to find it anywhere !! And don't begin to talk to me about their documentation, it is kind of nearly inexistent !!

  2. Is there any way to get the HCI_Inquiry_Result_with_RSSI to work with a single mac addresse ?

  3. Is there any other way to get RSSI values ? I tried hcitool (same issue it appears ?), l2ping (i get 100% ping loss after 4/5 successfull one, I didn't dig into that)

  4. Could it be my dongle that is kinda rigged ?

  5. Will it be different if i'm trying to detect RSSI from BLE devices ?

(I want to stick with bluetooth for now, but if you think of any other RF signals that I can use, just mention it and I'll keep it in mind definitly to use it later.)

Thanks for anyone who got there and read my issue.

And sorry about my english, it has been ... a long day.

Peace

Edit : with Bluez I can discover BT classic, or ask for RSSI for specific addr (but get values outside golden range though). I can as well discover BLE, but I can't find anything to ask for RSSI for specific addr (for BLE)...

Sophist answered 24/4, 2019 at 19:1 Comment(0)
B
0

For BLE you can use hcitool and btmon, you should see RSSI values in the output, e.g.:

sudo btmon

and in another shell:

sudo hcitool lescan

For more convenient access I've motified btmon to output just timestamp, address and RSSI. It's also possible to define custom callback on each received event: https://github.com/kbobrowski/btlemon

import pybtlemon


def callback(addr, rssi):
    print(f"addr: {addr}, distance: {10**((-60-rssi)/20):.2f}")


pybtlemon.set_callback(callback)
pybtlemon.run()
Burnout answered 10/5, 2020 at 23:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.