Version 1 (modified by 12 years ago) ( diff ) | ,
---|
USRP2 configration and data collection with OEDL script
Description
In this tutorial we'll demonstrate exactly what the title says.
Hardware / Software Resourcesutilized
- 4 grid nodes with a USRP2 connect via Ethernet.
- ubuntu-12-04-uhd-daemon.ndz: node image with all the precompiled software required to configure the USRPs.
- uhd.rb - OEDL script executed on the console. This script configures the USRPs for data collection at specified frequencies, sampling rate, etc…
- uhd_daemon - a node background process that bridges the gap between OMF commands and USRP2.
Set up
- To get started first make a reservation on the Orbit Scheduler.
- Let's pick 4 nodes with a USRP2. For a current list of nodes with USRPs, goto the Orbit Scheduler, click on Status Page under Quick Links. Select the Grid Tab and filter by SDR and USRP_N210 or SBX. This will give a topology list of nodes (below) that can be used with the OMF commands:
[node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-19.grid.orbit-lab.org,node1-20.grid.orbit-lab.org, node2-1.grid.orbit-lab.org,node2-2.grid.orbit-lab.org,node2-19.grid.orbit-lab.org,node2-20.grid.orbit-lab.org, node19-1.grid.orbit-lab.org,node19-19.grid.orbit-lab.org,node19-20.grid.orbit-lab.org,node20-1.grid.orbit-lab.org, node20-19.grid.orbit-lab.org,node20-20.grid.orbit-lab.org,node1-1.sb3.orbit-lab.org,node1-2.sb3.orbit-lab.org]
- After logging into grid console, make sure all nodes are turned off
nilanjan@console.grid:~$ omf tell -a offh -t node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-19.grid.orbit-lab.org,node1-20.grid.orbit-lab.org
- Verify state of node before continuing. Make sure all nodes are in the POWEROFF state.
nilanjan@console.grid:~$ omf stat -t node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-19.grid.orbit-lab.org,node1-20.grid.orbit-lab.org
- Image nodes
nilanjan@console.grid:~$ omf load -i ubuntu-12-04-uhd-daemon.ndz -r 20 -t node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-19.grid.orbit-lab.org,node1-20.grid.orbit-lab.org
- 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 tell -a offh -t node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-19.grid.orbit-lab.org,node1-20.grid.orbit-lab.org
- Turn nodes back on and verify they are in POWERON state
nilanjan@console.grid:~$ omf tell -a on -t node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-19.grid.orbit-lab.org,node1-20.grid.orbit-lab.org
- Download the OEDL experiment script uhd.rb to your local directory on the console. Executing this script will tell the USRP2 record spectrum data for a few seconds at different carrier frequencies.
The contents of the uhd file is shown with additional comments:
nilanjan@console.grid:~/UHD$ cat uhd.rb defProperty('rxfreq', 2400e6, "Starting rx frequency") defProperty('rxstep', 10e6, "Rx frequency increments") defProperty('nfreq', 10, "Number of frequency steps") defProperty('dwell', 10, "Number of seconds at each frequency step") defGroup('rxnode', 'node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-19.grid.orbit-lab.org,node1-20.grid.orbit-lab.org') { |n| } onEvent(:ALL_UP) do |event| info "Give machines some time to warm up" wait 4 allGroups.uhd.u0.activate # starts uhd_daemon wait 3 group("rxnode").uhd.u0.rxrate = "8e6" # set receive chain sampling rate group("rxnode").uhd.u0.rxgain = "20" # set receive chain gain (dB) group("rxnode").uhd.u0.numbins = "128" # set size of fft group("rxnode").uhd.u0.avgwinlen = "32" # set averaging window size for each fft bin across time. group("rxnode").uhd.u0.omlfile = "spectrum.grid" # oml database filename to store fft data group("rxnode").uhd.u0.omlserver = "idb2:3003" # oml server group("rxnode").uhd.u0.record # enable recording thread (0..property.nfreq).each { |i| # set up loop cf = property.rxfreq + (property.rxstep*i) # compute next carrier frequency group("rxnode").uhd.u0.rxfreq = cf # set receive chain carrier frequency (Hz) wait property.dwell # wait for number of seconds before computing next frequency } group("rxnode").uhd.u0.stop # stop recording thread allGroups.uhd.u0.deactivate # turn off uhd_daemon info "Finish it." Experiment.done end
Execute script and view recorded data
- To run the experiment script:
nilanjan@console.grid:~/UHD$ omf exec uhd.rb
- Once the script finishes, check the contents of the database file on specified oml server and directory. The data should be
recorded in spectrum.grid.sq3.
nilanjan@console.grid:~/UHD$ ssh idb2 nilanjan@idb2:~$ cd /var/lib/oml2 nilanjan@idb2:/var/lib/oml2$ nilanjan@idb2:/var/lib/oml2$ ls -l spectrum.grid.sq3 -rw-r--r-- 1 oml2 oml2 753561600 May 14 10:41 spectrum.grid.sq3
- Dump the contents of spectrum.grid.sq3 to have a quick look inside the sql file.
nilanjan@idb2:/var/lib/oml2$ sqlite3 spectrum.grid.sq3 ".dump"
- The magnitude value of the fft bins are stored in binary format. The first entry of the db file is shown below. So when dumping the file contents the ftt bins data is shown as consecutive ascii representation of the binary floating point numbers.
- 5/15/2013 - Work in progress… How to parse this data and
Frequency detection with multiple nodes.
Spectrum sensing code
Logging spectrum data directly to an OML server
Attachments (6)
- uhd_exp1.rb.txt (1.7 KB ) - added by 12 years ago.
- sq3_parse.cpp (2.0 KB ) - added by 12 years ago.
- random_tx.png (105.3 KB ) - added by 12 years ago.
- uhd_exp1.rb (2.2 KB ) - added by 11 years ago.
- octave_plot.jpg (22.5 KB ) - added by 9 years ago.
- wiserd.rb (4.1 KB ) - added by 9 years ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.