<< Chapter < Page | Chapter >> Page > |
You will modify the code for the mote taken from 5.2. Creating a Spectrum Analyzer to Measure Noise in order to read 200 times the RSSI value from the same channel . A python script will then average those read values. To this end:
mrfiSpiWriteReg(CHANNR,channel);
. The mote will now
read the RSSI 200 times on channel 0.txrx_rssi_dist.py
Alternatively, this file is already present in the downloadable
source code , in the directory
source_code/c_files/
. ;cat /dev/comx | ./txrx_rssi_dist.py
In Cygwin, you should first go to the folder containing
txrx_rssi_dist.py
, see
5.2. Creating a Spectrum Analyzer to Measure Noise . . This script outputs the average value of the RSSI 200 readings.#!/usr/bin/env python
import sysif __name__ == '__main__':
char = ''line = ''
while 1:char = sys.stdin.read(1)
if char == '\n':sline = line.split()
sumsum = 0counter = 0
for i in range(len(sline)):try:
sline[i]= int(sline[i])sumsum += sline[i]
counter += 1except:
sline[i]= 0
result = sumsum/counterprint result
line = ''else:
line = line + char
The figure below plots the evolution of RSSI as transmitter and receiver boards are parted away in three different directions. Because these measurements are not done in aninfinite open space, shadowing and fading effects introduce randomness into the relationship between RSSI and distance.
Notification Switch
Would you like to follow the 'Ezwsn: experimenting with wireless sensor networks using the ez430-rf2500' conversation and receive update notifications?