0

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
}
Greg
  • 19
  • 3
  • Just a wild guess... what calibratedRssi values are you getting in both cases and how are you getting them? I am just thinking of a case where the calibratedRssi is already recalculated @ 1m for Eddystone (by the lib you are using) and you are doing it again – Dietatko Oct 24 '18 at 09:08
  • I am getting the calibratedRssi from the second byte of the UID frame – Greg Oct 24 '18 at 09:41
  • Another wild guess. Are you sure that the correct if-branch is chosen for Eddystone in the getCalibratedRssiAtOneMeter? Isn't -62 added instead of -41 because of a coding error somewhere else? – Dietatko Oct 24 '18 at 15:31
  • Yes, I check it – Greg Oct 25 '18 at 05:53

1 Answers1

0

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.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • `getCalibratedRssiAtOneMeter()` do exactly like you mention in the last paragraph, it adds -41 to Eddystone and takes the same value for iBeacon. So you are telling me that If I do that the distance will be close to the distance calculated when it's an ibeacon ? – Greg Oct 24 '18 at 11:54
  • Again, I don't understand all the logic in getCalibraredRssiAtOneMeter. There appears to be more code there than would be needed simply to adjust any eddystone calibrared rssi by -41, so I am concerned it may not be doing what you expect. But, yes, you need to do this adjustment. – davidgyoung Oct 24 '18 at 14:51