Sunday, June 17, 2012

How to use Rssi value to calculate Distance

Before we start to explain the formula. We have to make it clear about db and dbm.
db is just a kind of ratio between two value. db=10*lg(x/y)
so dbm is a ratio between a power value and 1 mWatt.

0dbm=10*lg(x/1mWatt), so x=1mWatt.
10dbm=10*lg(y/1mWatt), so y=10mWatt.


Thus, the difference between 2 two value in dbm is in db.

10dbm-0dbm=10*lg(x/1mWatt)-10*lg(y/1mWatt)=10*lg(x/y)=10*lg(10mWatt/1mWatt)=10db


Now lets look at the Log-distance path loss model:

PL\;=P_{Tx_{dBm}}-P_{Rx_{dBm}}\;=\;PL_0\;+\;10\gamma\;\log_{10} \frac{d}{d_0}\;+\;X_g,     (1)

PTxdbm is the transmitted power in dbm, and PRxdbm is the received power in dbm.
so the path loss PL is in db.

Path loss, in fact, can be calculated in this formula:

L = 10\ n\ \log_{10}(d)+C    (2)

If we add a reference path loss into the formula, we can have:

PL = PL0 - 10*n*lg(d0) + 10*n*lg(d) + C = PL0 + 10*n*lg(d/d0) + C   (3)

(3) is as same as (1).

We now can use the data from experiment to calculate the distance from Rssi.

Note: PTxdbm is the initial power P for sending the message. PRxdbm is the Rssi value.

First, choose a reference distance d0 and corresponding Rssi value. calculate the PL0 = PTxdbm - PRxdbm


Then, use the other data to make more formulas. We can use this formulas to get the value of γ and Xg

Finally, we can get a function between Rssi and d

Rssi(d) =  P - PL0 - 10*γ*lg(d/d0) + Xg

P is the transmitted power.
PL0 is the reference path loss.
d0 is the reference distance.
 γ is the path loss exponent.

reference:
http://en.wikipedia.org/wiki/Log-distance_path_loss_model
http://en.wikipedia.org/wiki/Path_loss#Loss_exponent

No comments:

Post a Comment