Detecting rssi of multiple BLE beacons



  • Hello,

    I have a setup where 3 LoPy's are supposed to see the RSSI value of 4 Estimote BLE beacons in a distance of 0 - 4 meters. I have 2 concerns:

    1. My RSSI levels are extremely fluctuating, and in general performance is much worse than other platforms I have used for the same purpose. So I'm wondering if I'm doing anything wrong.
    2. In my main loop, when scanning for bluetooth devices, I'm unsure if my approach might "miss" some of the further-away beacons because it's looking at the first thing that pops up. Maybe this is the reason for the low performance? My code looks like this:
    while True:
        adv = bluetooth.get_adv()
        if adv != None:
            macRaw = adv[0] # binary mac address
            macReal = binascii.hexlify(macRaw) # convert to hexadecimal
            if macReal == b'f3bc0b6feb4c':
                print('beacon A rssi: ', adv[3]) # adv[3] is rssi
                sendToSocket(beaconID = 1, rssi = adv[3])
            elif macReal == b'edbed48d0b87':
                print('beacon B rssi: ', adv[3])
                sendToSocket(beaconID = 2, rssi = adv[3])
            elif macReal == b'c7c383eeaaa4':
                print('beacon C rssi: ', adv[3])
                sendToSocket(beaconID = 3, rssi = adv[3])
            elif macReal == b'cd87e6a38dc2':
                print('beacon D rssi: ', adv[3])
                sendToSocket(beaconID = 4, rssi = adv[3]) 
    


Pycom on Twitter