# Calculate distance from RSSI

I am working on an indoor positioning system where I need to:

1. Compute distance based on RSSI (I understand this won't be 100% accurate)
2. Then do trilateration to pinpoint the location of the wifi signal. This part might be solved via this solution: Trilateration using 3 latitude and longitude points, and 3 distances

I am stuck with (1).

The relationship b/w RSSI and Distance is (source PPT): Where:

Fm = Fade Margin - ??
N = Path-Loss Exponent, ranges from 2.7 to 4.3
Po = Signal power (dBm) at zero distance - Get this value by testing
Pr = Signal power (dBm) at distance - Get this value by testing
F = signal frequency in MHz - 2412~2483.5 MHz for Ralink 5370


But I am not able to figure out how to calculate the fade margin. Based on some findings, fade margin = sensitivity of receiver - received signal But then again, how do I get sensitivity of the receiver?

I have an Ralink RT5370 chipset wifi dongle with this specification: Ralink 5370 spec

Any suggestions will help!

Notes from: http://www.tp-link.sg/support/calculator/ suggest that fade margin varies from 14dB to 22dB

Excellent: Link should work with high reliability, ideal for applications demanding high link quality. Fade Margin level is more than 22dB.
Good: Link should give you a good surfing experience. Fade Margin level is 14~22dB.
Normal: Link would not be stable all the time, but should work properly. Fade Margin level is 14dB or lower

• RSSI won't even be 50% accurate, never mind "not quite 100%". This has come up many times before and been explained a similar number of times. I'd suggest further reading. – John U Sep 25 '13 at 13:56
• Your formula might work in an empty space, but indoor environments are not empty (objects, walls, reflections, multi-path effects). The indoor positioning systems that I know don't bother with formula's like the one you mention and use extensive calibration instead. Being able to reliably locate the receiver in a specific room is usually considered a (very) good result. – Wouter van Ooijen Sep 25 '13 at 17:38
• @John U I agree that the "position" figured out on the basis of trilateration and RSSI will be all over the place. My next step will be normalize a path based on multiple mac addresses. I am not building a realtime indoor positioning system, I am trying to get the route of a person in a building, which is an offline process. – zengr Sep 25 '13 at 18:04
• @zengr YOu better understand what is fading and look up Ricean Fading and learn how to recognize, simulate nulls with slight 1mm motions near -70-80dBm range and learn avoid it by peaking the data rates to avoid "collisions" with reflections of equal amplitude and out of phase with primary signal> In a building many signals are ultimately reflected and so Rice Fading nulls are common. – Sunnyskyguy EE75 Oct 12 '16 at 11:46

## 2 Answers

Fade margin is the difference in power levels between the actual signal hitting the receiver and the bottom-line minimum signal needed by the receiver to work. It gives an indication of likely bit error rates for instance.

There is a standard formula for calculating minimum theoretical signal level needed by a receiver for a given data rate. This is -154dBm + 10$log_{10}$(bit rate). If data rate is 1Mbps then a receiver will need -94dBm to stand a chance of reasonably getting decent data.

If the received signal is in fact -84dBm then the fade margin is 10dB i.e. it can allow fading of the received signal up to 10dB.

To apply this to your situation means you need to understand the data rate so you can calculate minimum acceptable receiver power. Because Fm = Pr - Pm (where Pm is minimum receiver power level calculated from bit rate or maybe marked on the box) I believe you should be able to work this out based on RSSI being equivalent to Pr.

If you look in the link you provided you'll see this: -

Receive Sensitivity: 802.11b: -84dBm@11Mbps

In other words, at 11Mbps, using the formula in my answer you get a minimum receiver power required of -154 dBm + 10$log_{10}$(11,000,000) dBm = -154dBm + 70.4dBm = -83.59dBm.

EDIT

I've been having a little look on this and there is a simpler formula you can use based on this document. The formula is #19 on page 3 and basically it is this: -

RSSI (dBm) = -10n $log_{10}$(d) + A

Where A is the received signal strength in dBm at 1 metre - you need to calibrate this on your system. Because you are calibrating at a known distance you don't need to take into account the frequency of your transmission and this simplifies the equation.

d is distance in metres and n is the propagation constant or path-loss exponent as you mentioned in your question i.e. 2.7 to 4.3 (Free space has n =2 for reference).

Your original formula - if you could supply a source for that I can check it against data I have.

• I agree with Andy's simplified formula, and would like to add as a hint that, because RSSI may vary over independent from the distance, think e.g. rel. humidity &c., and given that you will have more than one signal source for your trilateration it may be worth to consider the relative RSSI factor between different sources, which may compensate for some elements of variability of absolute RSSI values. The result may be some information in the form of "the distance to point A is about 1.5x the distance to point B" which is enough information to infer relative location to the fix points. – JimmyB Sep 25 '13 at 13:59
• I apologize for the delayed reply, this is my source for my original formula: www.ece.lsu.edu/scalzo/Mega%20Hurtz%20FDR.pptx – zengr Sep 28 '13 at 6:43
• @zengr the link doesn't work dude - it takes you to a folder but there doesn't appear to be an "openable" file. Maybe I'm being stoopid? – Andy aka Sep 28 '13 at 10:58
• There, I uploaded it to dropbox. You will need to download it to view: dl.dropboxusercontent.com/u/2432670/Mega%20Hurtz%20FDR.pptx – zengr Sep 28 '13 at 19:18
• @merveotesi distance is related precisely to received field strength in free-space - put obstacles in the way and you get attenuation at some points. Put metal objects in the area and you will get increases in signal strength in some positions and decreases in others. It's not a precise measurement except in free-space. – Andy aka Aug 20 '14 at 13:29

I am currently working on the same thing and it can be very confusing. I find this formula seems to be suited for indoor environments:

$P(x) = 10n \text{ } log\left(\frac{d}{d_0}\right) + 20log\left(\frac{4πd_0}{λ}\right)$

Where,

• $P(x)$ is the path loss at distance $d$.
• $n$ is the signal decay exponent.
• $d$ is the distance between transmitter and receiver.
• $d_0$ is the reference distance (say 1m.)
• $λ$ is the wavelength of 2.4GHz signal = 0.125 m.

"Xσ is the fade margin. Fade margin is system-specific and has to be calculated empirically for the site. For office buildings, generally the value of Xσ is 10 dB."

So;

$d = 10^{\left({\frac{P-20log\left(\frac{4πd_0}{λ}\right)}{10n}}\right)d_0}$

Formula details can be found here, page 3 formula 2.

• What is the value for the Signal Decay component and where is the fade margin used in the formula? I am trying to make use of the same formula, but am not able to understand these 2 parameters. – Lakshmi Narayanan Mar 16 '16 at 11:27