Estimating beacon proximity/distance based on RSSI - Bluetooth LE
The txPower
mentioned by @davidgyoung is given by the formula:
RSSI = -10 n log d + A
where
d
= distanceA
= txPowern
= signal propagation constantRSSI
= dBm
In free space n = 2
, but it will vary based on local geometry – for example, a wall will reduce RSSI
by ~3dBm
and will affect n
accordingly.
If you want the highest possible accuracy, it may be worthwhile to experimentally determine these values for your particular system.
Reference: see the paper Evaluation of the Reliability of RSSI for Indoor Localization by Qian Dong and Waltenegus Dargie for a more detailed explanation of the derivation and calibration.
double getDistance(int rssi, int txPower) {
/*
* RSSI = TxPower - 10 * n * lg(d)
* n = 2 (in free space)
*
* d = 10 ^ ((TxPower - RSSI) / (10 * n))
*/
return Math.pow(10d, ((double) txPower - rssi) / (10 * 2));
}