7

I'm trying to estimate the distance from an iOS device to an iBeacon. I am aware that distance estimation is not super accurate, and I am also aware of this formula:

https://electronics.stackexchange.com/questions/83354/calculate-distance-from-rssi

I have found, through some research, that an iBeacon's BLE advertisement in fact contains data that represents the calibration value. That is to say, the RSSI determined at 1 meter away is actually broadcast by the beacon for all to see.

Now, I think the iOS must internally use this information to determine the Near, Far, Immediate, and Unknown categorizations of distance but I am not aware of any way to access this 1-meter RSSI directly.

My question is simply: Is there a way to get the distance estimate between an iOS device and a beacon WITHOUT having the 1-meter calibration value saved on the iOS device beforehand?

Some people say that the 'accuracy' field of the CLBeacon class is, in fact, the distance measurement to the beacon. The documentation does not support this statement, here's what it says:

accuracy The accuracy of the proximity value, measured in meters from the beacon. (read-only)

@property (readonly, nonatomic) CLLocationAccuracy accuracy;

Discussion Indicates the one sigma horizontal accuracy in meters. Use this property to differentiate between beacons with the same proximity value. Do not use it to identify a precise location for the beacon. Accuracy values may fluctuate due to RF interference.

A negative value in this property signifies that the actual accuracy could not be determined.

Community
  • 1
  • 1
fjlksahfob
  • 1,019
  • 3
  • 16
  • 27
  • Possible duplicate of [Understanding ibeacon distancing](https://stackoverflow.com/questions/20416218/understanding-ibeacon-distancing) – Senseful Jul 29 '18 at 03:23

2 Answers2

8

There is a new iBeacon Document released by Apple on June 2, 2014 that states:

When building an application that uses either GPS or beacon, it is important to consider this accuracy. The values reported by the Core Location objects (the horizontalAccuracy property in the CLLocation class, or the accuracy property in the CLBeacon class) indicate this level of uncertainty, or the margin of error. Both are measured in meters. The higher the value, the lower the certainty of the position of the device or beacon. Keep in mind that depending on the physical surroundings a low accuracy may not be possible.

I suspect that's Apple's 'confidence' metric when reading their CLProximity values. I interpret that as obtaining something like:

CLProximityNear with an accuracy value of 5; Apple pinpoints your position within a 5m margin of error.

The general sentiment I'm getting from my general analysis of sources is that using beacon technology for distance approximation is probably not the strength of the technology.

EDIT: Chaise Hocking from Shine Technologies in Melbourne has an insightful blog post that has some experiments and results regarding the accuracy property.

brontus
  • 91
  • 5
4

Is there a way to get the distance estimate between an iOS device and a beacon WITHOUT having the 1-meter calibration value saved on the iOS device beforehand?

YES, you simply read the CLBeacon accuracy field as you suspected. This is an estimate of the distance to the beacon in meters.

This estimate uses an undocumented calculation that is based on the RSSI measurements (likely a 30 second running average, perhaps discarding outliers) combined with the 1-meter RSSI calibration value embedded in the iBeacon advertisement. A port of this calculation to Android is shown here.

And, no, there is no way to read the calibration value from an app. It is obscured by iOS, which disallows seeing the details of iBeacon Bluetooth LE advertisements. See here for a detailed explanation.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • hmm OK, is this officially documented anywhere? – fjlksahfob Apr 30 '14 at 19:15
  • 3
    No, I do not think I have seen any official Apple documentation saying that the accuracy value is the estimated distance in meters. This is probably because Apple discourages its direct use for this purpose due to the large amount of noise on the estimate. Apple recommends using the proximity field which bucketizes the distance estimate into immediate/near/far categories, which is therefore less variable. The closest I have seen to an official definition of "accuracy" as distance in meters is in a support forum where it was described as such by an Apple employee. – davidgyoung Apr 30 '14 at 19:21
  • 3
    I tracked down the posts you were talking about: https://devforums.apple.com/message/934466#934466 **"We are not saying you are exactly XX meters away. Instead we are saying that you are proximate to this beacon within some range of accuracy."** He goes on to talk about the near/far/immediate stuff and says immediate < 0.5m and near = 1-3 m https://devforums.apple.com/message/908989#908989 I guess they're saying there's no real way to be accurate about distance but they're not really committing to an answer either. They aren't saying that distance and accuracy are the same thing. – fjlksahfob Apr 30 '14 at 19:47
  • 1
    Accuracy is not the distance, it's the accuracy of distance (Proximity) – Saad Jul 29 '16 at 07:37