Using WiFi RSSI to estimate distance to an Access Point

As I was discussing the problem of having a reliable WiFi indoor positioning systems with a colleague of mine, I decided to have a go at it myself.

RSSI is short for ‘Received Signal Strength Indication’. In a nutshell: the further away you move from an access point, the weaker the signal.

If you measure the strength of the signal, you have an indication of your distance relative to the source.

This has been done over and over and over again using WiFi, Bluetooth, insert some wireless standard here… So all in all not much of a challenge.

However: it hasn’t been done that many times using C# in a Universal App project. The advantage is that you can run your code on anything that boots Windows 10. Even mobile phones or Raspberry PI.

It turns out that you can have the RSSI measurement amazingly fast and with just a few lines of code.

Listing the adapters:

Iterating over the adapters and reading RSSI of every Access point, order by SSID:

Getting distance from RSSI value using a formula:

Consult the full GitHub repository here.

The formula to calculate the distance is pretty straightforward.

d = 10 ^ ((TxPower – RSSI) / (10 * n))

  • TxPower is the RSSI measured at 1m from a known AP. For example: -84 dB.
  • n is the propagation constant or path-loss exponent. For example: 2.7 to 4.3 (Free space has n = 2 for reference).
  • RSSI is the measured RSSI
  • d is the distance in meter

Be aware that this is a very basic attempt and should perhaps be considered more of a ‘proof of concept’ as to see how well you can estimate distance.

You could extend this by using triangulation so you can have an X, Y and Z coordinate instead of just a radius.

Leave a Reply

Your email address will not be published. Required fields are marked *