<< 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=
  • 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

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

where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
yes that's correct
I think
Nasa has use it in the 60's, copper as water purification in the moon travel.
nanocopper obvius
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
how nano science is used for hydrophobicity
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
what is differents between GO and RGO?
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
analytical skills graphene is prepared to kill any type viruses .
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play

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?