Understanding ibeacon distancing

后端 未结 7 1312
野趣味
野趣味 2020-11-22 13:45

Trying to grasp a basic concept of how distancing with ibeacon (beacon/ Bluetooth-lowenergy/BLE) can work. Is there any true documentation on how far exactly an ibeacon can

相关标签:
7条回答
  • 2020-11-22 14:30

    The iBeacon output power is measured (calibrated) at a distance of 1 meter. Let's suppose that this is -59 dBm (just an example). The iBeacon will include this number as part of its LE advertisment.

    The listening device (iPhone, etc), will measure the RSSI of the device. Let's suppose, for example, that this is, say, -72 dBm.

    Since these numbers are in dBm, the ratio of the power is actually the difference in dB. So:

    ratio_dB = txCalibratedPower - RSSI
    

    To convert that into a linear ratio, we use the standard formula for dB:

    ratio_linear = 10 ^ (ratio_dB / 10)
    

    If we assume conservation of energy, then the signal strength must fall off as 1/r^2. So:

    power = power_at_1_meter / r^2. Solving for r, we get:

    r = sqrt(ratio_linear)
    

    In Javascript, the code would look like this:

    function getRange(txCalibratedPower, rssi) {
        var ratio_db = txCalibratedPower - rssi;
        var ratio_linear = Math.pow(10, ratio_db / 10);
    
        var r = Math.sqrt(ratio_linear);
        return r;
    }
    

    Note, that, if you're inside a steel building, then perhaps there will be internal reflections that make the signal decay slower than 1/r^2. If the signal passes through a human body (water) then the signal will be attenuated. It's very likely that the antenna doesn't have equal gain in all directions. Metal objects in the room may create strange interference patterns. Etc, etc... YMMV.

    0 讨论(0)
提交回复
热议问题