Search code examples
ibeaconbeaconrssieddystonekontakt.io

Beacon distance shows wrong values with Eddystone


I am getting wrong distance when I choose Eddystone protocol to my Kontakt beacon.

For Kontakt there is different values of RSSI :

Tx Power            RSSI for ibeacon @ 1m             RSSI for Eddystone @ 0m

0 (-30dBm)                -115                           -74
1 (-20dBm)                -84                            -43
2 (-16dBm)                -81                            -40
3 (-12dBm)                -77                            -36
4 (-8dBm)                 -72                            -31
5 (-4dBm)                 -69                            -28
6 (0dBm)                  -65                            -24
7 (4dBm)                  -59                            -18

Why all the distances are so far when using Eddystone and when i use iBeacon everything works fine?

Here is an example of my code :

public static let signalLossAtOneMeter: Int = -41

public static func calculateDistance(rssi: Float, calibratedRssi: Float, calibratedDistance: Float, pathLossParameter: Float) -> Float {
    return calculateDistance(rssi: rssi,
                             calibratedRssi: getCalibratedRssiAtOneMeter(calibratedRssi: calibratedRssi, calibratedDistance: calibratedDistance),
        pathLossParameter: BeaconDistanceCalculator.pathLossParameter)
}

public static func getCalibratedRssiAtOneMeter(calibratedRssi: Float, calibratedDistance: Float) -> Float {
    let calibratedRssiAtOneMeter: Float

    if calibratedDistance == IBeacon.calibrationDistanceDefault {
        calibratedRssiAtOneMeter = calibratedRssi
    } else if calibratedDistance == Eddystone.calibrationDistanceDefault {
        calibratedRssiAtOneMeter = calibratedRssi + Float(BeaconDistanceCalculator.signalLossAtOneMeter)
    } else {
        calibratedRssiAtOneMeter = -62
    }

    return calibratedRssiAtOneMeter
}

public static func calculateDistance(rssi: Float, calibratedRssi: Float, pathLossParameter: Float) -> Float {
    return pow(10, (calibratedRssi - rssi) / (10 * pathLossParameter)) as Float
}

Solution

  • I'm not sure what the logic in the getCalibratedRssiAtOneMeter method is intending to accomplish -- this should be a fixed value for each beacon based on the strength of its transmitter in the location it is in installed. You should actually measure this rather than use a manufacturer's lookup table, because it might vary due to reflections (some nearby objects act as a "backplane" and strengthen the signal) and some others attenuate it.

    The key thing for Eddystone is that it encodes is calibrated RSSI inside the beacon packet as a 0m reference value instead of iBeacon's 1m reference value. This effectively means that after reading the constant out of the Eddystone packet, you must add -41 to the constant before plugging it into your formula. This will convert a 0m reference value into a 1m reference value.

    If you don't do this conversion, the distance estimates will appear way too far on Eddystone.