33

I am working on Bluetooth low energy concept project. I am getting the RSSI value between 1 and 100. As I move the tag the RSSI value increase as the peripheral moves away from the iPhone and decreases as it moves closer.

Can anybody help me to get exact distance between the iPhone and the Bluetooth tag based on the RSSI value? Are there any available formulas?

I am getting the RSSI value of the device with the help of this bluetooth Low energy delegate method:

 - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral   
   *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
Sam R.
  • 14,850
  • 9
  • 56
  • 106
puneet kathuria
  • 710
  • 1
  • 7
  • 10
  • This thread is more or less a duplicate of this one: http://stackoverflow.com/questions/15687332/bluetooth-le-rssi-for-proximity-detection-ios. The conclusion is that it's very tricky. – Jessedc Dec 25 '13 at 23:57
  • have you got the distance between BLE device and user location using RSSI ? if yes then guide me on that . – Moxarth May 30 '17 at 13:27

4 Answers4

34

I answered this in another thread, repeating it here.

In line-of-sight (no obstacles causing change in RSSI), -6dB seems to be double the distance.

If you at 1m distance read RSSI -40dB then 2m gives -46dB, 4m gives -52dB, 8m gives -58dB, 16m gives -64dB.

You can not get an exact position, only a circular maximum distance.

Using triangulation with 2-3 or more devices you get a much more accurate positioning result. You can get this purely from Advertisement packages but you must either Disable scan -> Enable scan or tell iOS CoreBluetooth to report all adv packages.

In foreground mode you can do this but in background mode you can't get all adv packages. You must connect and read RSSI to do it in the background.

Raptor
  • 48,613
  • 43
  • 209
  • 344
henrik
  • 1,312
  • 9
  • 9
  • 3
    Well. I don't think it is quite true in my case. In my case within 1m distance, it always read about -66dB. – Yeung Oct 09 '13 at 08:33
  • 1
    This is actually not -66dB but -66dBm. Basically it is voltage on output of analog amplifier and this depends not on distance but also on antenna type used, antenna position on both sides and many other aspects. Just change is about 6 dB when you go 2x more away. – Tõnu Samuel May 17 '14 at 04:27
  • 5
    Not to nitpick, but in this case it is actually trilateration, not triangulation. You don't know the angles involved, that's the whole point, all you know are the lateral distances, thus it is trilateration. – Max von Hippel Jun 12 '14 at 23:23
  • This algorithm puts you at 645 meters away with an RSSI value of -96. This algorithm is not correct, and the growth is not truly exponential – John Foley Aug 03 '16 at 20:03
  • did anyone get the solution for this ? distance between BLE and peripheral using RSSI ? anyone ? – Moxarth May 31 '17 at 05:29
28

There are quite a number of RSSI-based localization techniques like triangulation and fingerprinting. None of them are perfect. RSSI is affected by many factors like obstacles, multipath fading, antenna polarization and cross-body shielding.

The theoretical relationship between RSSI and distance is something like this:

RSSI[dbm] = −(10n log10(d) − A) 

where d is the distance and A is the offset which is the measured RSSI 1 meter point away from the BLE device.

Simply google for RSSI[dbm] = −(10n log10(d) − A) and you will find some sources about it.

Sam R.
  • 14,850
  • 9
  • 56
  • 106
foresightyj
  • 1,836
  • 2
  • 21
  • 40
  • 5
    what is 'n' in this equation? – Sten Petrov Jan 24 '14 at 17:04
  • It is an empirical value that is different among different terrains, urban areas, mountainous areas, remote areas. Normally around 2 ~4. I don't have references at hand right now. – foresightyj Jan 25 '14 at 01:32
  • 1
    Mentioned in this paper (with further references to the source): 'Evaluation of the reliability of RSSI for Indoor Localization' http://www.rn.inf.tu-dresden.de/dargie/papers/icwcuca.pdf. –  Jan 27 '14 at 14:11
  • 1
    In a test i did based on wifi. ITU Indoor Path Loss model delivered excellent results. – Rob Anderson Mar 29 '14 at 13:55
  • I am wondering: If `RSSI` and `A` are in dBm, but `d` is in meter... how does this work out? – BlackWolf Jun 09 '15 at 14:29
  • @BlackWolf d is intended to be unitless: http://math.stackexchange.com/questions/238390/units-of-a-log-of-a-physical-quantity. – Luca Carlon Oct 21 '15 at 10:23
  • 1
    d is actually the dimensionless quantity equal to (distance / 1 metre) – Airsource Ltd Mar 19 '16 at 19:47
  • did anyone got the distance between the BLE device using RSSI ? if yes then guide me how to find it . – Moxarth May 30 '17 at 13:09
10

Finding distance from RSSI is bit tricky and it depends on lots of factors, even test environment and antenna orientation etc. Following paper is having some study regarding the same http://www.s2is.org/Issues/v1/n2/papers/paper14.pdf

Arathil
  • 189
  • 1
  • 4
1

In swift 4.2

func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
if let power = advertisementData[CBAdvertisementDataTxPowerLevelKey] as? Double{
   print("Distance is ", pow(10, ((power - Double(truncating: RSSI))/20)))
   }
}

More detailed answer Here

Saranjith
  • 9,547
  • 2
  • 55
  • 102