<< Chapter < Page Chapter >> Page >
The CC2500 can easily change its operating frequency, through the use of channels. For each of these channels, theCC2500 can sense the level of electro-magnetic noise, in dBm. The goal of this section is to build a spectrum analyzerby continuously plotting noise vs. frequency. We therefore use a Python script running on the host computer.
For this section, you will need to have installed all the software. If not, please follow the Installation Instructions .

Running the code

  • Copy-paste the code presented below into IAR 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_noise . , and program a single board; close IAR.
  • Copy-paste the python code below into a new file called txrx_noise.py in some directory on your computer Alternatively, this file is already present in the downloadable source code , in the directory source_code/c_files/ . .
  • Connect your USB programmer board to the host computer, and find the COM x port it is connected to. Use PuTTY to read from that x port; you should see a continuous series of 200 numbers appearing.
  • Start an X server onto the host computer using Xlaunch you have installed on your computer.
  • Start Cygwin and go into the folder containing ./txrx_noise.py using command cd path to your folder In cygwin, your Windows drive C:\ is called /cygdrive/c . Also, use forward slashes. If your folder is located at C:\Users\Thomas\Desktop\source_code , in Cygwin, type cd /c/cygdrive/Users/Thomas/Desktop/source_code . .
  • type export DISPLAY=127.0.0.1:0.0
  • type cat /dev/com x . You should see the same content appearing as when using PuTTY. If not, read the COM x port with PuTTY and try again.
  • type cat /dev/com x | ./txrx_noise.py A window appears which looks like the one depicted below.
#include "mrfi.h" #include "radios/family1/mrfi_spi.h"void print_rssi(int8_t rssi) {char output[] = {" 000 "};if (rssi<0) {output[0]='-';rssi=-rssi;}output[1] = '0'+((rssi/100)%10);output[2] = '0'+((rssi/10)%10);output[3] = '0'+ (rssi%10);TXString(output, (sizeof output)-1); }int main(void) {int8_t rssi; uint8_t channel;BSP_Init(); MRFI_Init();P3SEL |= 0x30; UCA0CTL1 = UCSSEL_2;UCA0BR0 = 0x41; UCA0BR1 = 0x3;UCA0MCTL = UCBRS_2; UCA0CTL1&= ~UCSWRST; MRFI_WakeUp();__bis_SR_register(GIE); while(1) {for (channel=0;channel<200;channel++) { MRFI_RxIdle();mrfiSpiWriteReg(CHANNR,channel); MRFI_RxOn();rssi=MRFI_Rssi(); print_rssi(rssi);} TXString("\n",1);} }void MRFI_RxCompleteISR() {}
C code
#!/usr/bin/env python import re, Gnuplot, sysif __name__ == '__main__': print 'display started...'g = Gnuplot.Gnuplot(debug=1) g('set term x11 title "eZWSN sprectum analyzer"')g('set yrange [-110:0]')g('set data style linespoints') g.xlabel('frequency (MHz)')g.ylabel('RSSI (dBm)') char = ''line = '' while 1:char = sys.stdin.read(1) if char == '\n':sline = line.split() data = []for i in range(len(sline)): try:sline[i] = int(sline[i]) except:sline[i] = 0frequency = 2433.0+(0.2*i) data.append([frequency,sline[i]]) g.plot(data)line = '' else:line = line + char
Python code

spectrum_analyzer
Output of the spectrum analyzer in Section 6.2; one transmission is going on on channel 0.

Some keys for understanding the code running on the mote:

  • Line 6. print_rssi() is a function which prints the RSSI value read from the CC2500 onto the serial port which is initialized between lines 18 and 25. TXString() is a function provided in bsp_board.c .
  • Lines 18-25 initialize the serial port, which enable your code to output lines of text using the TXString() function. These lines can then be read using PuTTY.
  • Line 27 instructs the MSP430 to stay in active mode all the time, i.e. not to enter any low power mode.
  • Lines 28-37 is a loop which continuously scans through channels 0-200, recording and outputting the RSSI value. MRFI_Rssi() is a function declared in the drivers.

The python script continuously feeds the GNUplot environment with data received from the standard interface. Note that the content of the right COMx port if pipedto this python script.

Refresh rate of the spectrum analyzer

  • in the code, after line BSP_Init(); , add line P2DIR |= 0x08;
  • in the code, after line TXString("\n",1); , add line P2DIR ^= 0x08; . This toggles extension port P6 every time the screen gets refreshed.
  • using the oscilloscope, measure on extension port P6 the refresh rate of the frequency analyzer. Make sure to refresh rate is around 1.1s.
  • move line P2DIR ^= 0x08; right after line print_rssi(rssi); . You now measure the time it takes for the mote to sample the noise level on one channel, and move to the other.
  • Make sure you measure a value close to 5.5ms.

Testing the spectrum analyzer

  • Reprogram a second board using the code described in 4.3. Continuous Tx/Rx , so that it continuously sends data. Start the continuous sending and visualize this transmissionon the spectrum analyzer (at channel 0 by default).
  • Using the technique described in 4.2. Simple Tx/Rx , change the operating channel, and see the implications on the spectrum analyzer.
  • You can also see the impact of a running microwave oven.
When you bring the transmitting mode close to the receiver, you see on the spectrum analyzer that the signal 'leaks' over multiple channels. This is why a standard such as IEEE802.15.4 specifies the channel spacing to be 5MHz. We have set the spacing to a much lower value (200kHz) on purpose to see the effect of adjacent channel leakage. In practice, you should use frequencies which are far away from each other.

Questions & Answers

can someone help me with some logarithmic and exponential equations.
Jeffrey Reply
sure. what is your question?
ninjadapaul
20/(×-6^2)
Salomon
okay, so you have 6 raised to the power of 2. what is that part of your answer
ninjadapaul
I don't understand what the A with approx sign and the boxed x mean
ninjadapaul
it think it's written 20/(X-6)^2 so it's 20 divided by X-6 squared
Salomon
I'm not sure why it wrote it the other way
Salomon
I got X =-6
Salomon
ok. so take the square root of both sides, now you have plus or minus the square root of 20= x-6
ninjadapaul
oops. ignore that.
ninjadapaul
so you not have an equal sign anywhere in the original equation?
ninjadapaul
Commplementary angles
Idrissa Reply
hello
Sherica
im all ears I need to learn
Sherica
right! what he said ⤴⤴⤴
Tamia
what is a good calculator for all algebra; would a Casio fx 260 work with all algebra equations? please name the cheapest, thanks.
Kevin Reply
a perfect square v²+2v+_
Dearan Reply
kkk nice
Abdirahman Reply
algebra 2 Inequalities:If equation 2 = 0 it is an open set?
Kim Reply
or infinite solutions?
Kim
The answer is neither. The function, 2 = 0 cannot exist. Hence, the function is undefined.
Al
y=10×
Embra Reply
if |A| not equal to 0 and order of A is n prove that adj (adj A = |A|
Nancy Reply
rolling four fair dice and getting an even number an all four dice
ramon Reply
Kristine 2*2*2=8
Bridget Reply
Differences Between Laspeyres and Paasche Indices
Emedobi Reply
No. 7x -4y is simplified from 4x + (3y + 3x) -7y
Mary Reply
is it 3×y ?
Joan Reply
J, combine like terms 7x-4y
Bridget Reply
im not good at math so would this help me
Rachael Reply
yes
Asali
I'm not good at math so would you help me
Samantha
what is the problem that i will help you to self with?
Asali
how do you translate this in Algebraic Expressions
linda Reply
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
Crystal Reply
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
Chris Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
AMJAD
what is system testing
AMJAD
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
can nanotechnology change the direction of the face of the world
Prasenjit Reply
At high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.
Ali Reply
the Beer law works very well for dilute solutions but fails for very high concentrations. why?
bamidele Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
QuizOver.com Reply

Get the best Algebra and trigonometry course in your pocket!





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