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

Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
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
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket 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!
Jobilize.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