Gnuradio Mini Projects

This page presents a few miniature projects I've used to learn gnuradio. The gnuradio tutorials are first rate, but there's nothing like learning by creating something yourself.

Gaussian Noise

Using arbs (arbitrary waveform generators) in the lab, it is often necessary to play noise against a signal of interest. Because the captured signal is sampled at some rate and is of finite length, the noise waveform tones, or discrete frequencies, should coincide with them. Accordingly, it's convenient to generate noise by specifying a sample rate of the signal of interest, number of samples, center frequency of noise, and noise bandwidth.

There are probably more efficient ways of doing this in gnuradio, but as a learning exercise I wanted to see how easy or difficult it is to incorporate custom code in gnuradio. Having just started learning gnuradio in Feb 2015 (it is early Mar 2015 as of this writing), I don't yet know how to make custom blocks. So here is a rank amateur's attempt at using custom code!


Additive white Gaussian noise flow graph

And sample output:


Generated noise

After using an import block, the vector source simply calls a function in the imported code. If you're interested in this,

Multiband Gaussian Noise

Better than the above is to create a curve of multiband noise to play against different parts of the spectrum. Modifying the code slightly now offers that ability as well as working for scalars for single band noise.


Multiband additive white Gaussian noise flow graph

And sample output specifying center freqs of [20, 40, 70] Hz and corresponding bandwidths of [10, 10, 20] Hz:


Generated noise

Chirp

As with noise, it is sometimes useful to play a chirp signal against another signal. Again, it is convenient to generate a chirp by using sample rate of the signal of interest, chirp repetition rate and center frequency.

One of the gnuradio tutorials does this in a cleaner way using a probe. The probe follows a triangle wave level and modifies a sine wave's frequency with that value. Here, again as a learning exercise, I wanted to incorporate custom code in gnuradio. If you don't use the audio source in the flow graph, be sure to enable the throttle block.


Chirp flow graph

And sample output:


Generated chirp

After using an import block, the vector source, like in the noise example, calls a function in the imported code. Feel free download,

Morse Code Decoding

A more ambitious mini project currently has me stumped. I reached a point where I believe I can't use existing gnuradio blocks but must write my own demodulation block.

I used the following flowgraph

which resulted in this output where I added the yellow highlights and decoded text, which is my amateur radio callsign.

To decode I need to use timing of waveform edges, making me think now I must learn to write an out of tree block. This example shows a signal with no noise, no fading, no interference and perfect CW weighting - and I can't even handle that currently. :-) Advice is welcome!