wiki:Old/Tutorials/k0SDR/Tutorial00

Using GNURadio

Table of Contents

  1. SDR Tutorials
    1. Working with USRP2 - Universal Software Radio Peripheral
      1. Description
      2. Hardware / Software Resources utilized
      3. Set up
      4. Usage
      5. Capture waveform and record to file & add time-domain plot of waveform
      6. Troubleshooting
    1. Simple radio example with GNURADIO benchmark scripts
      1. Description
      2. Hardware / Software Resources utilized
      3. Set up
      4. Running GNU Radio benchmark scripts
      5. Outputs from transmitter and receiver
      6. Troubleshooting
    1. Simple radio example with GNURADIO benchmark scripts (OEDL)
      1. Description
      2. Hardware / Software Resources utilized
      3. Set up
      4. Running OEDL script and viewing results
      5. OEDL script
    1. OFDM radio example with GNURADIO benchmark scripts
      1. Description
      2. Hardware / Software Resources utilized
      3. Set up
      4. Running OEDL script
    1. Spectrum sensing with USRP2 and wiserd
      1. Description
      2. Hardware / Software Resources utilized
      3. Set up
      4. Generate signal source file using octave
      5. Set up transmitting node
      6. Set up receiving node(s)
    1. Spectrum sensing with USRP2 and wiserd (OEDL and OML)
      1. Description
      2. Hardware / Software Resources utilized
      3. Transmit predefined tone
      4. Record spectrum data to an OML file
      5. Performing the experiment using OEDL
    1. Transmitting wideband signals using USRP X310 and wiserd
      1. Description
      2. Transmitting a signal using wiserd
      3. Creating the signal
    1. Running DSC match script from the grid console
    1. Working with GNURadio and Nutaq ZeptoSDR
      1. Description
      2. Set up
      3. Run the GRC scripts
    1. Realtek 2832 EZCap - A Frugal SDR
      1. Prereqs
      2. A cheap spectrum analyzer
    1. MacSwitch (Obsolete)
      1. Prerequisites
      2. Start Mac Switch
    1. Zynq-based WISER platform - Start-up test
      1. Description
      2. Hardware / Software Resources utilized
      3. Set up
      4. Loading the Zedboard
      5. Running a start up test
    1. Zynq-based WISER platform - Spectrum Sensing
      1. Description
      2. Hardware / Software Resources utilized
      3. Set up
      4. Start spectrum sensing
    1. Zynq-based WISER platform - Spectrum sensing with multiple nodes (OEDL)
      1. Description
      2. Hardware / Software Resources utilized
      3. Spectrum sensing with an OEDL script
    1. Zynq-based WISER platform - Building the Firmware
      1. Description
      2. Getting the FPGA source code
      3. Building the FPGA design
      4. Building ARM core software
    1. Nutaq - PicoSDR start-up and configuration
      1. Description
      2. Set up
      3. Launch demo scripts
    1. Multi channel sample collection with x310
      1. Description
      2. Set up
      3. Collect samples
    1. Getting started with RFNoC X310
      1. Description
      2. Set up
      3. Find USRP X310s
      4. Program the FPGA
    1. Multi Channel Sample Processing & Visualization
      1. Hardware / software resources utilized
      2. Receive multi channel signal for processing and plotting
      3. Transmit a signal using a single usrp
    2. Plot the IQ Constellation of received signal
      1. Multi-channel Uhd STreamer (MUST)
      2. Description
      3. How it works (without going into the source-code :-D
      4. Source code & compilation
      5. Hardware interface application
      6. XML file
      7. Command server
      8. Usage Example
      9. Signal handler applications
      10. Tutorials
    1. Using two RFNoC streams simultaneously on a single USRP device
      1. Description
      2. Set Up
      3. Running the Simulation
    1. Using 2 transmit or 2 receive antennas simultaneously
      1. Description
      2. Set Up
      3. Running the Experiment
    1. Generate random transmissions emulating Primary Transmitters
      1. Description
      2. Set Up
      3. Running the Experiment
    1. RFNoC Spectrum Sensing
      1. Description
      2. Set Up
        1. Prepare Receive Node
        2. Prepare Receive USRPs
        3. Prepare Transmit Node
        4. Prepare Transmit USRP
        5. Set up SSH tunnel from your local port 5100 to grid.orbit-lab.org:5100
        6. Set up a web proxy for the receive node
      3. Run the experiment
    1. Full-Duplex Wireless using USRP N210
      1. Description
        1. Technical Report
        2. Updates
      2. Hardware / Software Resources Utilized
      3. Set Up
      4. Run the Experiments
      5. Example Experiment 1: A Real-Time Full-Duplex Radio with OFDM PHY (GNU …
      6. Example Experiment 2: A Simple Full-Duplex Radio Experiment (Terminal …
        1. In Terminal 1
          1. In Terminal 2 (SUB-20)
        2. A Secondary Transmitter Using Node13-8
        3. Acknowledgements
    1. LTE Traffic Trace Collection
      1. Description
      2. Setup OAI emulation framework
      3. Connecting UE to LTE network
      4. Connecting Multiple UEs
      5. Enabling OAI logging Module
      6. Application Design
      7. Running OAI using scripts
    1. Simple Radio Example with USRP X310 on ORBIT Sandbox 2
      1. Description
      2. Set Up
        1. Prepare the nodes
        2. Prepare network setup for USRP access
      3. Run the experiment
    1. Wideband Channel Sounding with USRP X310s
      1. Description
      2. Set Up
        1. Prepare Receive Node
        2. Prepare Receive USRPs
        3. Prepare Transmit Node
        4. Prepare Transmit USRP
        5. Set up SSH tunnel from your local port 5100 to grid.orbit-lab.org:5100
        6. Set up a web proxy for the receive node
      3. Run the experiment

This document is not meant to be a complete tutorial on GNU Radio, but a starting point on using GNU Radio on Orbit Sandbox.

Prerequisites

Before you jump into GNU Radio on Orbit, you should have a clear picture on what GNU Radio is. An excellent starting reading material is Eric Blossom’s Exploring GNU Radio:http://www.gnu.org/software/gnuradio/doc/exploring-gnuradio.html. Eric is the founder of the whole GNU Radio project. Make sure you understand the data flow paths, including the receive path and the transmit path, understand the role that the USRP (Universal Software Radio Peripheral) plays. USRP is a flexible USB device that connects the PC to the RF world. USRP has one motherboard, which connected to the PC via USB 2.0 and can support up to four daughterboard. Each daughterboard has RF ends that can either transmit or receive waveform from the air. There are different types of daughterboard supporting a variety radio range, e.g. for example, Flex400 supports both transmit and receive in the frequency band 400MHz to 500 Mhz. You need to refresh your memory on the sample theory (Nyquist interval).

To create GNU Radio scripts, you need to build a radio by creating a graph (as in graph theory) where the vertices are signal processing blocks and the edges represent the data flow between them. The signal processing blocks are implemented in C++. The graphs are constructed and run in Python. If you are not familiar with C++ or Python, find a tutorial online and learn it.

What is Sandbox5 on Orbit-Lab?

Sandbox5 consists of two nodes, i.e. node1-1 and node1-2. Each individual node is connected to one Gnuradio motherboard, and each motherboard in turn has two BasicRX and two BasicTX mounted on it, as show in the following picture.

The frequency that the BasicTX operates on ranges from 2 MHz to 200 MHz, and the BasicRX can receive from 2 MHz to 300+ MHz.

The image above shows TX_A connected to RX_B through a 50 ohm attenuator. Likewise, side B of both nodes are connected through an attenuator. The ports are connected by wires in order to minimize noise. However, both TX and RX can use actual antenna.

Imaging nodes on Sandbox 5

To load the nodes with the right image:

  • Step 1: Login to the console.
          ssh username@console.sb5.orbit-lab.org
    
  • Step 2: Image the nodes.
          omf load [[1,1],[1,2]] gnuradio-3.3.0.ndz
    

gnuradio-3.3.0.ndz is the latest version and both the usrp and digital tx/rx tests have passed.

  • Step 3: Power up the nodes.
          omf tell on [[1,1],[1,2]]
    
  • Step 4: Log into the node.
              ssh root@node1-1
    	  ssh root@node1-2
    

Example: Transmitting/Receiving Sine Waves

This basic example illustrates a simple sine wave transmitter and receiver. In order to run it, copy usrp_siggen_multiple_sine.py script to node1-1 (in this case node1-1 will be the transmitter) and usrp1_rx_cfile.py to node1-2 (in this case the receiver):

  • On node1-1
          wget http://www.orbit-lab.org/raw-attachment/wiki/Tutorials/k0SDR/Tutorial00/usrp_siggen_multiple_sine.py
          chmod +x usrp_siggen_multiple_sine.py
    
  • On node1-2
          wget http://www.orbit-lab.org/raw-attachment/wiki/Documentation/GNURadio/Tutorials/GettingStarted/usrp1_rx_cfile.py 
          chmod +x usrp1_rx_cfile.py
    
  1. Receiver only If the transmitter is off, the receiver receives only white noise. On node1-2 run
       ./usrp1_rx_cfile.py -f 10e3 -N21000 -g 10 noise.dat
    
    Script arguments are:
    • '-f 10e3': tells the receiver to listen to the frequency band centered at 10kHz.
    • '-N21000': write 21000 data points to file.
    • '-g 10': set the gain to 10.
    • 'noise.dat': set the file name that will store the data samples.

Using the matlab script [attachement:plotall.m plotall('noise.dat')], you will see similar output:

  1. Transmitter and Receiver at 1MHz The transmitter sends out waveform at 1MHz, and the receiver receives at 1MHz as well. At the transmitter (node1-1):
        ./usrp_siggen_multiple_sine.py -f 1e6 -w 10k -a 1000 -m 1 --sine
    

  • '-f 1e6': tells the USRP to modulate the baseband waveform to 1MHz.
  • '—sine': the type of the waveform that will be sent out is a sine wave.
  • '-w 10k': set the original baseband frequency to 10k.
  • '-a 1000': set the amplitude to 1000.
  • '-m 1': only transmit one sine wave, instead of multiple sine waves.

At the receiver node1-2:

   ./usrp1_rx_cfile.py -f 1e6 -N21000 -g 10 rx_1m.dat
  • '-f 1e6': tells the GnuRadio to listen to the frequency band centered at 1MHz.
  • '-N21000': write 21000 data points to file.
  • '-g 10': set the gain to 10.
  • 'rx_1m.dat': set the file name that will store the data samples.

Using the matlab script plotall('rx_1m.dat'), you can get the following figure:

What we observe in the above plot is not a perfect sine wave. There are some high frequency components around the 10KHz sine wave. This is because that we set the target frequency as 1MHz, which is out of the working range of BasicRX and BasicTX. Recall that the working range of BasicRX and BasicTX is from 2MHz to 200MHz+. Now let’s try to set the correct frequency.

  1. Transmitter and Receiver at 10MHz The transmitter sends out waveform at 10MHz, and the receiver receives at 10MHz as well. At the Transmitter node1-1:
        ./usrp_siggen_multiple_sine.py -f 10e6 -w 10k -a 1000 -m 1 --sine
    

At the receiver node1-2:

   ./usrp1_rx_cfile.py -f 10e6 -N21000 -g 10 rx_1m.dat

The resulting plot is :

This time the received sine wave is indeed a regular sine wave.

Note: the first 1000 data in rxXXX should be discarded. Since the receiver is starting up, the first 1000 data points are not correct.

Example: Visual Outputs

Before you try these examples, you should have imaged nodes on sandbox 5 using gnuradio_visual.ndz OR manually installed x-window-system and wx-python on the node. Also be sure to have an x-server running on the local machine:

$ startx

and make sure to use -X option when logging to the node with GNU radio:

$ ssh -X root@node1-1

In the previous example, the received signal could only be viewed after it has been moved onto a machine running plotting software. With visual outputs, the researcher can analyze transmitted and received waveforms in real-time.

Some interesting visual applications included with the gnuradio software:

  • usrp_fft.py — real-time fft
  • usrp_oscope.py — real-time oscilloscope

They can be found in gnuradio/gnuradio-examples/python/usrp directory.

fft

In order to use the GNU Radio Companion (GRC), you can run it with the

gnuradio-companion

command, assuming the -X option was enabled. To run the GRC directly from a host Linux console, try running the following command:

ssh -X console.sb5.orbit-lab.org ssh -X root@node1-1 gnuradio-companion

Potential applications:

  • Visual spectrum analyzer
  • GNU Radio Companion (GRC)

Example: Audio Outputs

  1. Even though there is no sound card on the nodes, it is possible to send the audio to a NAS server. You must use the gnuradio-svn image
    console$ imageNodes [1,1..2] gnuradio-svn
    

if you intend to get the NAS client software from the ORBIT APT respository.

  1. Install nasd on machine with sound hardware.
$ apt-get install nas

and run nasd on the machine with the sound making device. Start nas daemon on the local machine:

sound$ nasd -aa

or configure nasd.conf like a sane person and run it from init.d. Make sure sshd is running as well.

  1. Install nas clients on node. NOTE: You must be using the gnuradio-svn image for this to work.
node$ apt-get update
node$ apt-get upgrade
node$ apt-get install nas-bin

If you're using a console in the ORBIT control room, you may find you can reach the console from the node on port 22, but not on port 8000. In this case start an ssh tunnel and set the AUDIOSERVER shell environment variable as follows.

node$ ssh -fN -L 8000:localhost:8000 <user>@<control room console>
node$ export AUDIOSERVER=localhost:0

(<user> is probably 'native' and <control room console> is probably '10.50.0.61'.) On the off chance you can actually get to port 8000, you can simply set the environment variable to the machine with sound.

node$ export AUDIOSERVER=<machine with sound>:0

Now run auinfo (client) on the node. There should be an output describing all potential audio outputs on the local machine running nasd. You can also try "auplay FILE" to actually play sounds remotely.

  1. Run your gnuradio programs on the node under audiooss.
node$ apt-get install audiooss
node$ audiooss gnu_radio_example.py

Troubleshooting

  • Have you picked the right node as the transmitter and receiver?
  • Have you run the correct Python script at the transmitter?
  • Have you tune the frequency within the Radio Front’s working range?
  • Have you matched the receiver’s frequency to the transmitter’s?
  • Have you set the gain properly? If you fail to set the gain correctly, chances are the device will run on the saturated mode, and the result will not be pretty.
Last modified 6 years ago Last modified on May 20, 2015, 2:49:09 PM

Attachments (10)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.