0

How can i get a numeric distance from ibeacon:

 NSString *proximity;
switch (beacon.proximity) {
    case CLProximityNear:
        proximity = @"Near";
        break;
    case CLProximityImmediate:
        proximity = @"Immediate";
        break;
    case CLProximityFar:
        proximity = @"Far";
        break;
    case CLProximityUnknown:
    default:
        proximity = @"Unknown";
        break;
}

I want to have values like 2.4m

Nabil El
  • 972
  • 1
  • 10
  • 24
  • 2
    It's not possible. There is no way to get a real world distance reliably from signal strength. You can try RSSI, but it still won't do it for you. – Linuxios Feb 19 '14 at 16:02
  • possible duplicate of [What are the nominal distances for iBeacon "Far", "Near", and "Immediate"](http://stackoverflow.com/questions/19007306/what-are-the-nominal-distances-for-ibeacon-far-near-and-immediate) – rckoenes Feb 19 '14 at 16:08
  • Although the question asked at the link is slightly different, for all practical purposes this should be considered a duplicate as the link discusses the inherent limitation of the mechanism, which would be even more of an issue for this goal than for that one. – Chris Stratton Feb 19 '14 at 16:26

4 Answers4

2

There's a great answer here on Stack Overflow: What are the nominal distances for iBeacon. The simple answer is, there is no numerical value you can easily extrapolate. The longer answer is to get a numerical value you'd either need multiple iBeacons, or a lot of luck to be able to generate a figure that's accurate.

Community
  • 1
  • 1
Nicholas Smith
  • 11,642
  • 6
  • 37
  • 55
  • Yeah approximated distance calculations (like what CoreLocation does with iBeacons) is NOT accurate. It mostly does an ok job but it's so often very wrong. – Zach Dennis May 21 '14 at 15:33
1

If you're using Estimote beacons,they have property distance which automatically calculate distance between device and beacon

chingi3
  • 91
  • 1
  • 10
  • Hi, that's true, and it technically is in meters, although as it was mentioned before, the distance calciulations are not precise and should only be treated as a approximation. – Wojtek Borowicz May 23 '14 at 06:21
  • @chingi3 http://estimote.github.io/iOS-SDK/Classes/ESTBeacon.html seems dead... the saga of beacon and triangulation continues! – koconder Aug 07 '15 at 04:49
0

There is no simple and reliable way to do this. You can recon it base on the proximity value (immediate,near,far). Moreover you can try to play with RSSI (which is changing all the time, sometimes quite rapidly) and compare it with TxPower which is a measured signal strength at a distance of 1 meter form beacon. As I mentioned at the beginning it won't be a reliable method but you can try it how well it will work for you. I do not expect that those value will change in a linear way but maybe you will find a good method that will work in your case.

Julian
  • 9,299
  • 5
  • 48
  • 65
0

Accuracy parameter returns numeric distance in meters. Proximity values like Immediate, Near, Far and Unknown are predefined by apple on the basis of RSSI (Recieved signal strength intensity), Accuracy (distance in meters) and Tx Power (Measured signal strength at 1m distance from beacon). If you want to create your own algorithm you can always use parameters those parameters but they are not reliable as RSSI fluctuates too much. So you have to do testing for optimum values of these parameters according to your surroundings.