Presentation

Download presentation PDF

- Built using Beamer version 3.10 and compiled using Latex version 3.1415926.

 

Programming Practices

Case Study 1: Quadrature Demodulator

Source code for gr::analog::quadrature_demod_fc.

Use the example fm_demod_example.py (updated for GNU Radio 3.7)

This reads in the file philly_93.3MHz_500ksps.32fc. This file was captured using a USRP N210 with a WBX board in Philadelphia on FM channel 93.3 MHz, a local rock station. The command to capture this using the latest GNU Radio with UHD is:

uhd_rx_cfile -a "addr=192.168.11.2" -g 25 -f 93.3M --samp-rate=500k -N 5000000 philly_93.3Mhz.32fc

The file is captured at 500 kHz sampling rate, single-precision complex float (the 32fc is an indicator of that).

The GNU Radio Python script provided here will read in the samples from the file, demodulate, filter, and resample the signal and output it to an audio sink so that we can listen to it.

Using the GNU Radio tool gr_plot_psd_c, which reads in complex binary samples and plots the PSD, we can see what the original signal looks like (gr_plot_psd_c -R 500k philly_93.3Mhz.32fc):

When viewing the file, this image has skipped ahead a few frames (using the bottom right arrow) to get away from initial transients present when starting up the hardware collection.

Notice that this is a very strong, clear signal. The PSD shows a fairly narrow FM modulated signal in the middle of the spectrum. When we listen to it, we'll see that it is because there is only the DJ talking at this point in time. Notice also the two flat signals at plus/minus 175 kHz. Those are the high definition digital stations that overlay the original analog signal and could be decoded separately.

Now, when we run the fm_demod_example.py, which has all of the variables hard-coded inside, we can hear the DJ talking about the last song played, a Green Day song apparently. This is only a 10 second capture.

Exercises

1. Add a visualization tool to see the audio output signal (from self.lpf). You can either dump the signal to a file and look at it with the gr_plot_* scripts, your own Python or Matlab code, or you can use a real-time GUI like the qtgui.sink_f block.

2. Add a visualization tool to view the output of the self.demod block. How does this compare to the signal in question 1?

The following values are hard-coded into this example program:

  • input sample rate (fs)
  • FM bandwidth or sample rate (fm_bw)
  • FM deviation (deviation)
  • Audio rate (audio_rate)
  • Audio passband width (audio_pass)
  • Audio transition width (audio_tw)
  • Audio stopband attenuation (audio_atten)

 

3. What happens when you change the input sampling rate?

4. What happens when you change the FM deviation (make it much larger and much smaller)? What is this doing and why does it seem to make sense to reduce it?

5. Increase the audio passband bandwidth. What is happening to the signal? Why does the quality get worse?

6. Adjust any other parts or values in the system to see what happens.

 

Case Study 2: Costas Loop

Can be found in source code at: gr-digital/examples/examples_costas.py

Source code for costas_loop_cc.

Source code for gr::blocks::control_loop.

Why it's of interest

  • A sync block with a loop.
  • Inherits from gr::blocks::control_loop; implements:
    • advance_loop <- from current error estimate.
    • sets and gets for all control values (including: damping factor, loop bandwidth, alpha and beta gains, current frequency and phase estimates).
  • Can be used with BPSK, QPSK, 8PSK.
  • Two loops if second output of frequency estimate is used.
    • Done for performance reasons: reduce branches in inner loop.

Running

  • Requires scipy and matplotlib Python modules
  • Can run without arguments for default settings: ./examples_costas.py
  • Use ./examples_costas.py --help for list of command-line options
  • Includes setting things like:
    • Number of samples in the simulation
    • Samples per symbol
    • Roll-off factor for the RRC filter
    • Loop bandwidth
    • Number of RRC filter taps
    • AWGN noise voltage
    • Initial frequency offset
    • Initial timing offset
    • Initial phase offset

Output

Produces a multi-subplot figure showing the frequency response, constellation, and input and output signals for comparison. The frequency response graph should resemble a standard control loop converging to a static frequency offset.

 

Exercises

1. Adjust the noise in the simulation. You can do this in steps from 0 to 1. What happens to the system behavior as the noise increases?

2. Adjust the loop bandwidth. How does this affect the convergence of the loop?

3. Set the initial frequency offset to 0.01. What happens?

4. What happens when you set the inital frequency offset to 0.1?

5. Set the initial phase to 1. What happens?

6. What happens when you set the initial phase to 0? Why?

 

COST-TERRA Summer School, Dublin, Ireland

Download Presentation

This tutorial is based off of GNU Radio 3.7. Please make sure you have a version of GNU Radio using the 3.7 API.

Make sure that at least the following components are to be build. The output of cmake will tell you this:

  • python-support
  • testing-support
  • volk
  • gruel
  • gnuradio-core
  • gnuradio-companion
  • gr-fft
  • gr-filter
  • gr-audio
  • gr-digital
  • gr-qtgui
  • gr-utils
  • gr-wavelet
  • gr-wxgui

Study Material

All of the following study material are .grc files that are meant to be opened and run inside of the GNU Radio Companion.

Filtering Example: creates a low pass filter to filter noise with adjustable bandwidth. 

Sources and Sinks: demonstrating the use of multiple sources and sinks in a flowgraph.

Representation of Bits: example that tries to demonstrate the idea of bit representation in multiple dimensions.

MPSK Receiver Development

The following files are various stages of developing an M-ary Phase Shift Keying (MPSK) digital modulation receiver. They go from simple to complex and robust against channel and system impairments.

Download the MPSK example scripts for GNU Radio version 3.6 (unsupported).

Download the MPSK example scripts for GNU Radio version 3.7.

(Note: due to some quirk in the web hosting service, you may not be able to untar these files directly using the standard 'tar xzf mpsk_script.tar.gz. Instead, first use gunzip and then untar them.)

Stage 1: using GNU Radio to create a MPSK-modulated signal and view the results in multiple domains.

Stage 2: Add a channel model to simulate noise, frequency and timing offsets, and multipath simulation.

Stage 3: Recover symbol timing (find the optimal sampling point for every symbol).

Multipath Simulation: A simple simulation for exploring multipath as modeled by a FIR filter.

Stage 4: Using the Constant Modulus Algorithm (CMA) equalizer for blind channel estimation and correction.

Stage 5: Correcting phase and fine frequency offsets using a digital implementation of a Costas Loop.

By the end of stage 5, we should have a receiver that will work with real transmitted MPSK signals under standard operating conditions. We did not look at correcting large frequency offsets, which can be done using a specific frequency locked loop or by estimating the coarse offset at the receiver and letting the Costas Loop pick up the slack.