= Spectrum sensing with USRP2 = == Description == In this tutorial we'll use the USRPs on the grid for FFT-based spectrum sensing. Each USRP (centered on a frequency with specified bandwidth) will collect data into an OML server for post processing. For details on available USRP2s on the grid, please see [http://www.orbit-lab.org/wiki/Documentation/USRP2_hw_map available USRP2 HW]. == Hardware / Software Resources utilized == 1. Grid nodes with a USRP2 connect via Ethernet. 2. ''ubuntu-11-10-gnuradio.ndz'': disk image loaded onto nodes. This image has all the precompiled - software required to configure the USRPs and analyze recorded data. The USRP2's interface with the node is already configured. 3. spectrum: application on node to set up & collect data from USRP2 and send to OML server / local file for recording in database file. 4. spectrum_console: application on console to configure & initiate spectrum sense application on node. 5. Octave / sqlite3: for post processing data measured spectrum sense data. 6. Orbit's Arbitrary Waveform Injection System: used to inject noise or simple signal into RF environment. More information of this generator can be found [http://www.orbit-lab.org/wiki/Documentation/ArbInterference here]. == Set up == * To get started first make a reservation on the [https://www.orbit-lab.org/schedule/ Orbit Scheduler] for using the Grid. * After logging into grid console, make sure all nodes are turned off {{{ nilanjan@console.grid:~$ omf-5.3 tell -a offh -t system:topo:n210 }}} * Verify state of node before continuing. Make sure all nodes are in the POWEROFF state. {{{ nilanjan@console.grid:~$ omf-5.3 stat }}} * Image nodes {{{ nilanjan@console.grid:~$ omf-5.3 load -i ubuntu-11-10-gnuradio.ndz -t system:topo:n210 }}} * After nodes are imaged, verify that nodes are in POWEROFF state. Otherwise issue the following to turn them off for a reboot {{{ nilanjan@console.grid:~$ omf-5.3 tell -a offh -t system:topo:n210 }}} * Turn nodes back on and verify they are in POWERON state {{{ nilanjan@console.grid:~$ omf-5.3 tell -a on -t system:topo:n210 }}} * Before proceeding, download the [http://www.orbit-lab.org/attachment/wiki/Documentation/GNURadio/Tutorials/FFTSpectrum/spectrum_console.cpp spectrum console application code] to your local directory. This is the application that will invoke the application to configure the USRP on the nodes. {{{ nilanjan@console.grid:~/UHD/SPECTRUM/w$ wget http://www.orbit-lab.org/raw-attachment/wiki/Documentation/GNURadio/Tutorials/FFTSpectrum/spectrum_console.cpp }}} * Compile the application code. {{{ nilanjan@console.grid:~/UHD/SPECTRUM/w$ g++ spectrum_console.cpp -lboost_program_options-mt -loml2 -o spectrum_console }}} == Usage == * To view the available parameters for the console application {{{ nilanjan@console.grid:~/UHD/SPECTRUM/w$ ./spectrum_console --help }}} * The first run will demonstrate how to use the sensing application on multiple nodes centered at different frequencies. Check the following page to view nodes corresponding to [http://www.orbit-lab.org/wiki/Documentation/USRP2_hw_map n210].[[BR]] In this case we'll be sensing on node3-3, node8-8, node13-13 on the frequencies 5.0 GHz, 5.1 GHz, 5.2 GHz respectively.[[BR]] Sampling rate option ''--rate 16e6'' yields a bandwidth of 8MHz.[[BR]] The fft size (''--num-bins 1024'') corresponds to a 1024 point fft.[[BR]] The time option (''--time 5'') runs the application for 5 seconds. Since the ''--oml file'' option is used the collected data will be store on the node locally.[[BR]] {{{ nilanjan@console.grid:~/UHD/SPECTRUM/w$ ./spectrum_console --rate 16e6 --num-bins 1024 --time 5 --oml file --node node3-3,node8-8,node13-13 --freq 5.0e9,5.1e9,5.2e9 }}} * The recorded spectrum data was written in a file under the root directory on each of the nodes. Copy that data file from the node to the console and check the contents. The following will copy the data collect from node3-3. {{{ nilanjan@console.grid:~/UHD/SPECTRUM/w$ scp root@node3-3:/root/spectrum_measurement_node3-3 . }}} * The contents of the file is very long. Click here to see the contents of an example run.