<< Chapter < Page Chapter >> Page >
You have seen that the strength of a link can not be easily predicted as a function of the distance between sender andreceiver, especially indoors. You will now discover the relationship between the RSSI of a link and its probability. Wedefine link probability as the portion of the messages sent by the sender which are successfully received at the receiver. You will see that link probability isstrongly correlated to the RSSI.

The experimental setup goes as follows. You will use to boards, a sender and a receiver. The sender continuously sends bursts of 100 messages, each containing a counter which increases from 1 to 100. Out of those 100 sent messages, the receiver may only receive 40. It will count the number of received messages until the counter reaches 100, or until the counter loops back to a smaller value. When this happens, the receiver outputs the number of received messages, i.e. the probability of the link.

At the same time as the receiver counts the number of the received messages, it calculates the average RSSI over those 100 messages, which it outputs togetherwith the link probability. Finally, to allow for the receiver to output these statistics (which takes some time), after each burst of 100 messages, the sender sends 20messages with counter set to 101.

To implement this:

  • Reprogram two boards with the code taken from the listing below Alternatively, this code is available in the downloadable source code . Open source_code/iar_v4.11/lab_ezwsn.eww with IAR. The project corresponding to this section is called txrx_probability . .
  • Attach one board to the host computer, and read the output from COMx using PuTTY;
  • Power the second board from the battery unit and press the button; this will cause that board to transmit the bursts of 100 messages. You can read the statistics using PuTTY.
  • Reprogram the sender node by changing line P1IFG&= ~0x04; by P1IFG |= 0x04; . This causes a continuous stream of messages. Power the newly programmed node on the battery pack and press the button; the red LED flashes.
  • On the receiver side, verify with PuTTY that you are receiving continuously. Close PuTTY.
  • Open Cygwin, and enter cat /dev/comx>probability.txt . This logs the output in a file.
  • Walk away with either node to record data for low RSSI values. Press (Ctrl+C) in Cygwin to stop the logging process.
  • Start XLaunch . In Cygwin, type export DISPLAY=127.0.0.1:0.0 .
  • In Cygwin, enter gnuplot , then plot "probability.txt" using 1:2 . This plots the probability as a function of the RSSI, make sure to obtain a graph similar to the one in the figure below.

#include "mrfi.h" uint8_t counter, num_received, bool_counting;int16_t cumulative_rssi; mrfiPacket_t packet;void print_probability(int16_t cumulative_rssi, uint8_t number) {char output[] = {" 000 0.00\n"};if (cumulative_rssi<0) { output[0]='-'; cumulative_rssi=-cumulative_rssi;} output[1]= '0'+((cumulative_rssi/100)%10); output[2]= '0'+((cumulative_rssi/10)%10); output[3]= '0'+ (cumulative_rssi%10); output[5]= '0'+((number/100)%10); output[7]= '0'+((number/10)%10); output[8]= '0'+ (number%10); TXString(output, (sizeof output)-1);} int main(void){ BSP_Init();P1REN |= 0x04; P1IE |= 0x04;MRFI_Init(); P3SEL |= 0x30;UCA0CTL1 = UCSSEL_2; UCA0BR0 = 0x41;UCA0BR1 = 0x3; UCA0MCTL = UCBRS_2;UCA0CTL1&= ~UCSWRST; MRFI_WakeUp();MRFI_RxOn(); __bis_SR_register(GIE+LPM4_bits);} void MRFI_RxCompleteISR(){ P1OUT ^= 0x02;MRFI_Receive(&packet); counter = packet.frame[9]; if (counter==101) {if (bool_counting == 1) { print_probability(cumulative_rssi/num_received,num_received);} bool_counting=0;num_received=0; cumulative_rssi=0;} else { bool_counting=1;num_received++; cumulative_rssi+=Mrfi_CalculateRssi(packet.rxMetrics[0]); }} #pragma vector=PORT1_VECTOR__interrupt void interrupt_button (void) {P1IFG&= ~0x04; P1OUT ^= 0x01;mrfiPacket_t packet; packet.frame[0]=8+3; for (counter=1;counter<101;counter++){ packet.frame[9]=counter; MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED); }for (counter=0;counter<20;counter++){ packet.frame[9]=101; MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED); }}

Some keys to understand the code:

  • Line 55. When the button is pressed, the board continuously sends bursts of 100 messages followed by 20 "guard" messages.
  • Line 61. The format of a packet is presented in 4.2. Simple Tx/Rx . packet.frame[0] is the length field, which sets the payload length at 3 bytes (minimum accepted value).
  • Line 63. packet.frame[9] is the first byte of the payload.
  • Line 43. bool_counting indicates whether the statistics have already been printed out (without this semaphore, as there are 20 guard messages, the statistics would be printed out 20 times)

As shown in hte figure below, link probability is closely correlated to RSSI. The theory tells us that, at very low RSSI, link probability is very close to 0; at very high RSSI it isclose to 1. Between those extremes, there is a linear slope, shown as an overlay in the figure below.

success_vs_rssi

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ezwsn: experimenting with wireless sensor networks using the ez430-rf2500. OpenStax CNX. Apr 26, 2009 Download for free at http://cnx.org/content/col10684/1.10
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ezwsn: experimenting with wireless sensor networks using the ez430-rf2500' conversation and receive update notifications?

Ask