Lab 2: RSSI Localization

Sample program: svn://


In this project, you will program a set of zigduinos to measure the amount of power loss between the transmitter and the receiver based on the RSSI values of the received packets. With the measurement results, you will then implement a RSSI-based localization system (to derive the location of the receiver based on the RSSI values).

System description

We will deploy 8 zigduinos on the 2nd floor of the CSIE building. These nodes will periodically send out beacon packets using the B-MAC API. You will implement a receiver (another zigduino board) to receive these beacon packets; the RSSIs of the received beacon packets are then processed by the algorithm you design to derive the 2-dimensional coordinate of the receiver's estimated location. Your final system should be able to show the estimated location of the receiver in real-time on the screen of a cellphone or a laptop.

The location of the deployed zigduino nodes on the 2F is as below:

(red points: node, green numbers: node addr number, blue numbers: rough distance between nodes)

Path loss measurement

It is quite intuitive to carry out the path loss measurement. Using the same transmission power for the transmitter, each time we move the receiver a little bit further away from the transmitter and calculate the path loss of that distance by PL=Pt-Pr, where PL=path loss, Pt=transmission power, Pr=received power (RSSI). At the end of the measurement, you will have a set of RSSI values with respect to different distances. Repeat the measurement for several times and average the RSSI values at different distances. Finally, use the average RSSI values at different distances to calculate the path loss exponent.

Strongly recommended finishing this part
at first week.

The rssi get from sample code (RF_RX_INFO.rssi) -90 = rssi in dbm.

What you need to submit

  1. Due : 10/27 1pm
  2. Commit all related source codes to the svn repository.
    • The source code should be committed to your teams' svn repository.
      file: main.c, nrk_cfg.h, makefile …
    • The report should be committed to your teams' svn repository.
      file: team[#]_lab[#]_report.pdf …
    • ps. The team[#] = team01, team02, …… , team11, team12, … team16
  3. You need to demonstrate your system to the TA by the deadline. The TA will grade your system by the accuracy of the estimated real-time location shown on the screen.
  4. A report (need to be committed to the svn repository). The report should include:
    1. Explanations of how you convert the RSSI values of the received beacon packets to the coordinate.
    2. The path loss measurements you carried out using the zigduinos. Calculate the path loss exponent and create a figure to show the result.


  1. B-MAC: Find out how to use nano-RK's B-MAC API to transmit and receive packets here.
  2. An example of using RSSI to estimate the location: [pdf]. This can be a starting point for your algorithm.

Sample program makefile usage

  • TARGET=[ rf_rx | rf_tx | bmac_rx | bmac_tx ]
    • default = main, change to the code you want to make (without “.c”)
  • PROGRAMMING_PORT=<serial port device> (ex: /dev/ttyUSB0)
  • CHANNEL=<certain channel>
    • default = 26,no wifi on this channel
  • RX_ADDR=<RX_address>
    • used in Path_Loss_Exponent
  • TX_ADDR=<TX_address>
    • used in Path_Loss_Exponent
  • SRC_ADDR=<local_address>
    • used in RSSI Localization (configure the receiver with SRC_ADDR = 20)
  • DST_ADDR=<remote_address>
    • used in RSSI Localization (the node at CSIE2F is configured with DST_ADDR = 20)


$ make clean TARGET=bmac_rx
$ make TARGET=bmac_rx CHANNEL=26 SRC_ADDR=20
$ make program TARGET=bmac_rx PROGRAMMING_PORT=/dev/ttyUSB0

About the demo

Dear all,

The demo is “suggest” but not “ask” to use a GUI that showing the localization result at CSIE2F for a better representation.

So feel free to use any format for the demo, as long as it could show the localization result in real-time.

ex. using console + asciiart

click here to see the example

Ask any question about this Lab here.

Hakki, 2011/10/26 16:23

I didn't quite get what is the purpose that you provide two different source codes for the two different parts of this assignment.

In fact, we wrote some other script which we feed it with the real-time data retrieved by the path loss exponent code you have provided. So, I guess there should be no difference. Just to be sure, is it OK we use the path loss exponent code to do the real-time localization?
WNFA_TA, 2011/10/26 18:02
The short answer is OK, you can use the path loss exponent code to do the real-time localization.

The side effect is : Using rf_rx to get bmac_tx packet will make you get duplicate packets. (may be you have noticed that already. Check the sequence number and you will see.)
Hakki, 2011/10/21 16:27

In the path loss exponent formula, I guess 'C' is a constant which is hardware dependent - am I right? Plus, how can we do the measurement for that?

PS. Sorry for posting this question to the homepage accidentally. TA, please help me to remove it from there. Thanks!
Kuang-Shih Huang, 2011/10/24 11:55

Yes, C is a constant when we assume that the passloss only depended on distance.
(if the pathloss follows the model that being proportional to (1/d)^n)

You can get the value of C by calculating the linear regression line of the rssi.
You could leave a comment if you were logged in.
wn_11fall_lab2.txt · Last modified: 2011/10/25 12:59 by hikaru4 · [Old revisions]
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki