Read Tx Power from a iBeacon Device with Wipy2



  • Hello Guys

    I want to calculate the distance to an iBeacon.
    So I need the Rssi and the Tx Power at 1m.

    For the RSSI I use this code:

    import binascii
    from network import Bluetooth
    bluetooth = Bluetooth()
    
    bluetooth.start_scan(20)
    while bluetooth.isscanning():
        adv = bluetooth.get_adv()
        if adv:
           print("device mac = {}".format(binascii.hexlify(adv.mac)))
           print("device RSSI = {}".format(adv.rssi)) 
    

    How do I get the TX Power at 1m from my device?

    Thanks



  • @pwest
    We've found out how. On iBeacon, when you read the data you get an Array. You need to do int(lastHexValue, 16) and then -256. This results in the set TxPower the BLE Beacon has

    Edit: this site explains very well how the iBeacon protocoll is built, aswell as to where to find the TxPower:
    http://www.warski.org/blog/2014/01/how-ibeacons-work/



  • You need some kind of signal propogation model. Some of the parameters within this model you would then empirically determine.

    E.g. https://en.wikipedia.org/wiki/Free-space_path_loss



  • @redimo Probably the best way to do this is to actually measure the RSSI as you move the beacon away from the receiver. That is, measure RSSI at 1 meter separation, 2m, 3m, and so on, and then a table (or function) that, based on the measured data, will allow you to look up range based on RSSI. You'll need different tables for different beacons (if they have different output power or antennas), and things will be very different whenever obstructions (e.g. furniture, walls, people) are between the beacon and the receiver.



Pycom on Twitter