GNU Radio is a software development platform for software-defined radios (SDR), enabling the design, simulation, and implementation of radio communication systems without the need for specific hardware, using a collection of modular signal processing blocks. GNU Radio is part of the SDR ecosystem, supporting researchers, engineers, and enthusiasts in wireless communication and signal analysis.

Installation

GNU Radio is distributed on numerous Linux distributions through their repositories. Installing it is very simple (for example, on an Ubuntu system):

sudo apt-get install gnuradio

Getting start

GNU Radio provides C++ libraries that implement signal processing methods and algorithms. These libraries can be utilized across several programming languages such as C or Python, and can also be accessed through a graphical interface for block programming called ‘GNU Radio Companion’ :

Gnu radio

To create a new project, simply click on ‘File > New > QT UI’. Projects can analyze real signals provided by dedicated hardware or simulated signals. The main interface displays blocks used for simulating signals or performing signal processing. Each block can be customized by double-clicking on it. On left of the core window, a menu show all blocks available.

Gnu radio

The ‘option’ block is used to define the current program. The ID paramater is the name of the program. The ‘variable’ block define here the variable “sample_rate” used on other blocks parameters.

Gnu radio

Here the first chain of signal treatment on GnuRadio.

  • The “Signal Source” block is used to generate signals of various shapes, frequencies, and amplitudes, commonly employed as a signal source for simulations or signal processing applications. To ease this first program, the “type” used on block is float.
  • The “Throttle” block is used to control the data rate of signal processing flowgraphs, preventing overflow and ensuring efficient resource usage. It’s usefull on simulation mode.
  • The “QT GUI Time Sink block” is used to visualize and plot time-domain data in real-time using a Qt-based graphical user interface (as an oscilloscope).
  • The QT GUI Frequency Sink" block in GNU Radio is used to display and visualize frequency-domain data in real-time using a Qt-based graphical user interface.

It is important to note that the color at the edges of the blocks allows you to see what type of data is being manipulated at each block. Here, orange indicates the “float” type. If two blocks are connected by ends of different colors, it will not work.

Analysis of an FM radio signal

The first step is to decimate the entries, meaning to reduce the number of points to propagate and process fewer data points while also reducing the spectral range. Without looking up how to do it on Google, it took me about 4 hours to complete. With a tutorial, it would have taken just a few minutes, but I believe it’s valuable to tackle the problem on your own to better understand and perform these operations on systems not documented on the internet. Here is the final result:

Gnu radio

Resampling

The “Rational Resampler” block in GNU Radio is used to change the sampling rate of a signal. It allows for resampling the signal using decimation and interpolation factors. This process is crucial in digital signal processing, where it is often necessary to adjust the sampling rates between different processing stages or to interface different systems. This helps reduce noise and allows for working with a cleaner signal. Performing sampling before the low-pass filter empirically reduces the number of “crackles” in the final audio. This makes sense, as changing the sampling rate provides a cleaner signal to the low-pass filter, thereby avoiding potential edge effects. For parameters, an interpolation coefficient of 1 and 4 or 5 for decimationyields quite promising results audibly (always through empirical methods!).

Low pass filter

The low-pass filter helps to narrow down our signal to a shorter frequency range centered around the signal of interest, ensuring a cleaner radio signal before demodulating it to decode the FM signal : (sample_rate /(2 * decimation)). It’s the same for the transition width with this value : (sample_rate /(20 * decimation)).

I tried performing decimation at the low-pass filter level, but the result is much less convincing than resampling first.

Demodulation FM

This blog is where the magic happens. Here, the FM signal demodulation extracts the audio signal. The quadrature_rate parameter corresponds to the sample_rate. It is also possible to perform decimation at this stage to reduce noise. Again, empirically, a decimation value between 6 and 10 seems to yield satisfactory results.

Audio Sink

I have deliberately not mentioned the sample rate configuration until now, because, as observed in this experiment, it was during the addition of the last block (Audio Sink) that I could properly set this parameter for all the preceding blocks.

Sample_rate

I have deliberately not mentioned the sample rate configuration until now, because, as observed in this experiment, it was during the addition of the last block (Audio Sink) that I could properly set this parameter for all the preceding blocks. To achieve 48 kHz at the Audio Sink, with a decimation of 6 at the FM demodulation block, the sample rate (referred to as quadrature_rate on this block) needs to be demodul_decimation * 48 kHz, which is 288 kHz.

For the low-pass filter, since there is no decimation, the sample_rate remains unchanged at 288 kHz.

For the radio source, in the meantime, we perform sampling with a decimation of 5. Therefore, we have a sample_rate of 288 kHz * 5, which is 1.44 MHz.

Futher more

To go further, I noticed that the “Rational Resampler” block allows for reducing the frequency of a signal quite simply by adjusting the interpolation and decimation parameters, which act as a frequency reduction coefficient = interpolation / decimation. For example, to reduce a signal from 35 kHz to 21 kHz, setting the decimation to 35 and the interpolation to 21 works very well.

Conclusion

This experiment was very enjoyable to conduct, with a concrete and audible result in processing a radio signal using SDR and GNU Radio software. In the complex field of radio, electromagnetism, and signal processing, GNU Radio enables interesting projects without requiring a deep understanding of all the underlying concepts. The result may not meet the expectations of a professional radio designer, but for RF hacking, these basics, combined with common sense and plenty of time to empirically test things, can be a lot of fun.