BLE RSSI level



  • Hello everybody,

    I am trying to use the RSSI of the BLE scanning on Wipy to send some message when some threshold is reached. But unfortunately, the reported values during the scan seems to be randomly generated. It goes from -15 to -60 without any update of the emitter location. And there is no significant change in values when the emitter us far away and still detectable.
    I thought it was related to the onboard antenna, but with the external antenna plugged, behaviour is still unchanged.

    Did you already noticed that ? Is there a way to activate the use of external antenna?
    Did i make something wrong or is there a problem with my WiPy chipset?

    Thanks



  • @jmarcelino will you need to activate the external antenna even if you don't use an antenna for bluetooth ? just wondering, because i get horribly unstable rssi values...



  • @jmarcelino

    You are certainly right. That is the same problem. Actually the returned values are strange, with the same variation pattern. It is like the decoding was wrong, maybe some inversion in some bits or a Little or big endian inversion.

    Thanks for your support. I hope it will be corrected soon.



  • @the_ned
    I found a post on the ESP32 forum about the same problem so it seems it's happening at a lower level. Maybe some calibration isn't correct or maybe something due to the recent WiFi coexistence.

    http://www.esp32.com/viewtopic.php?f=2&t=818

    When it's fixed by Espressif in the ESP-IDF it should reflect very quickly on MicroPython, the values come directly from there.



  • OK,
    I tried using the Lopy with or without external antenna and the RSSI level provided are too inconsistent and not reliable.
    It is a showstopper for what I have planned to use the chipset. I hope it could be solved quickly. Usually BLE chipset are quite good at Signal Strength measurement.

    It could anyway be interesting to see if someone have the same poor results when executing the code . Here after is my short test code.

    from network import Bluetooth
    from machine import Timer
    from network import WLAN
    
    chrono = Timer.Chrono()
    chrono.start();
    
    bluetooth = Bluetooth()
    print("start")
    wlan = WLAN(mode=WLAN.STA, antenna=WLAN.EXT_ANT)
    while True:
        bluetooth.start_scan(-1)    # start scanning with no timeout
        while bluetooth.isscanning():
            adv = bluetooth.get_adv()
            if adv:
               print(adv)
    


  • Hi,

    I have made the test. Actually it did not changed anything in the RSSI level accuracy.
    I will try using a LoPy instead WiPy and give you some feedback.

    (mac=b'\xc3\xf3\x12\x00\x02\xd1', addr_type=1, adv_type=1, rssi=-29, data=b'\x02\x01\x06\x1a\xffL\x00\x02\x15\xd9F\xb9\xf0\r\xb3E\t\xb1\xbb\xa3tgX\x98\x01\x00\x00\x01\xcb\x00') (mac=b'\xc3\xf3\x12\x00\x02\xd1', addr_type=1, adv_type=1, rssi=-53, data=b'\x02\x01\x06\x1a\xffL\x00\x02\x15\xd9F\xb9\xf0\r\xb3E\t\xb1\xbb\xa3tgX\x98\x01\x00\x00\x01\xcb\x00')
    (mac=b'\xc3\xf3\x12\x00\x02\xd1', addr_type=1, adv_type=1, rssi=-29, data=b'\x02\x01\x06\x1a\xffL\x00\x02\x15\xd9F\xb9\xf0\r\xb3E\t\xb1\xbb\xa3tgX\x98\x01\x00\x00\x01\xcb\x00') (mac=b'\xc3\xf3\x12\x00\x02\xd1', addr_type=1, adv_type=1, rssi=-41, data=b'\x02\x01\x06\x1a\xffL\x00\x02\x15\xd9F\xb9\xf0\r\xb3E\t\xb1\xbb\xa3tgX\x98\x01\x01\x00\x01\xcb\x00')
    (mac=b'\xc3\xf3\x12\x00\x02\xd1', addr_type=1, adv_type=1, rssi=-59, data=b'\x02\x01\x06\x1a\xffL\x00\x02\x15\xd9F\xb9\xf0\r\xb3E\t\xb1\xbb\xa3t`gX\x98\x01\x01\x00\x01\xcb\x00')
    (mac=b'\xc3\xf3\x12\x00\x02\xd1', addr_type=1, adv_type=1, rssi=-25,



  • @the_ned
    Yes, you need to activate the external antenna even for Bluetooth.

    It's not very intuitive - or documented! - as you have to do it through the WiFi module (Bluetooth shares the same radio hardware)

    Something like this should work

    from network import WLAN
    wlan = WLAN(mode=WLAN.STA, antenna=WLAN.EXT_ANT)
    

    replace WLAN.STA with WLAN.AP if you're not connecting to your own WiFi and want the WiPy to create it's own WiFi network (the default). You can also use the wlan.antenna(WLAN.EXT_ANT) function.

    then use your Bluetooth code as usual. I've not checked the accuracy of the RSSI values yet though.


Log in to reply
 

Pycom on Twitter