One of the simplest formulas for calculating distance (found it in this paper) is:
RSSI = -20 * logd + TxPower (where d = distance)
Which gives you this:
d = 10 ^ ((TxPower - RSSI) / 20)
This will give you very “jumping” results, coming from the nature of RSSI. RSSI readings are not very stable and highly depend on environment. I’m pretty sure Estimotes uses much mores sophisticated formula that also enables some kind of “smoothing” of data, so the readings are more stable. But this will be a good start to get at least some approximation.
Just like @mlusiak said, it’s a fairly complex topic, to estimate the distance to the beacon based on the signal strength (i.e., RSSI). I’ll mention just a few things to account for:
RSSI will go down if you cover the beacon (e.g., a person comes in between you and the beacon). That is, you’re still in the same distance, but RSSI goes down—so where you to base the distance estimate on the RSSI, the distance would go up, without you moving an inch.
Beacon signal is a radio waves that bounces of walls, ceiling, floor, objects, etc. If a radio wave bounced of a ceiling, and then reached the phone, it’s strength is going to be smaller than that of a radio wave that went straight from a beacon to the phone. But the phone has no idea what’s the difference between the two radio waves that hit it, so it’ll report different RSSI. Again, you can stand in place, same distance to the beacon, but you’ll see two different RSSI levels reported, and thus, two different distance estimates.
Holding the phone at a different angle, in your pocket, etc., will also affect RSSI.
The model of the phone affects the RSSI. (Different antenna, different form factor affecting the signal propagation, etc.)
There are more, but I don’t want this to be a very long post (:
You smooth and average out the RSSI spikes and fluctuations, but naturally, it’ll never be perfect. Long story short, make sure to manage your expectations about estimating distance to beacons.
Hi…
Using this formula distance what we get is that in mm??
because in my case my txpower is 8and RSSI is -21 and above formula gives distance 28.183 so I have a doubt here is that in mm or meters or any other Units?
If I’m not mistaken, the distance is in meters, and TxPower really means the power received at a 1 meter distance (i.e. the value received by an iPhone 5S at 1 meter.) For the old (and possibly newer) Estimote beacons, this related to your actual TX power (which can be +8 dBm as you have it) - 62. So for a +8 dBm tx power, the power received at 1m should be -54 dBm. Of course you should take the 1 meter power from the beacons actual message, because it will depend on the beacons antenna, case, etc, and this value could be calibrated by the manufacturer for your specific beacon.
Anyways (assuming I’m correct) the formulas should be:
RSSI = -20 * log10(distance in meters) + RssiAtOneMeter distance in meters = pow(10, (RssiAtOneMeter - ReceivedRSSI) / 20)
And for the older gen Estimotes, in general:
RssiAtOneMeter = TxPower - 62
I realize this post is pretty old, but thought it might be nice to clarify for those that run across this. And if I’m mistaken, please correct me!
Hi
I am trying to use this formulae, but I am confused what is the data type of these two variables.
The RSSIAtOneMeter and ReceivedRSSI value is in hex or float?