In radio communications, a lot of components are implemented in hardware. This is due to the almost instantaneous behavior of such components. Unfortunately, hardware components have dedicated functions and can’t generally be modified once they are designed. For this reason, RF front-end systems are mainly designed for specific protocols at specific frequencies.

However, since computer processing power keeps evolving, the advantage of using hardware for its instantaneous behavior is becoming less important. Computers can now keep up with the data rate of the received and sent signals, in addition to doing the processing on these signals. When a computer is used, the protocol and the frequency can be easily be modified. Software Defined Radio (SDR) enables fast development of new radio protocols, allowing the application to handle various protocols and frequencies, and permitting real-time adaptive algorithms.

GNU Radio is an open source project designed to ease the development of SDR. Due to its open source license, developers can share their processing cores and make them available in the GNU Radio installation. Because many signal processing cores have already been developed and tested, complex waveforms can be created very quickly. This makes it easy to reconfigure your application and tune it during real-time execution.

The GNU Radio Environment

GNU Radio is based on the Python interpreted language. This language makes it easy to create connections between processing blocks. By linked processing blocks with each other, you create a flow graph which allows you to design complex waveforms.

The GNU Radio environment is designed to do real-time signal processing. To achieve the high throughput and high performance needed for SDR applications, processing blocks are written in C++, a compiled language. These modules perform specific functions like mixing, filtering, modulation, fast Fourier transforms (FFT), equalization and so on. In addition, many modulations protocols (AM, FM, GMSK, PSK, QAM, OFDM, and so on), as well as error correction algorithms (for example, Viterbi, trellis, PCCC, SCCC, Reed-Solomon, turbo codes), are already implemented.

Blocks written in C++ can be included in Python projects with the use of SWIG (Simplified Wrapper and Interface Generator). Once SWIG has generated the interface between Python and C++, it can be used in GNU Radio environment with no effort.

To learn how to create your own GNU Radio block, you can follow the RadioWare tutorial available here.

Data Types and Sample Rates

Processing blocks communicate with each other using data stream connections. A stream is composed of many samples. A sample can be expressed in Byte (8 bits), Short (2 byte integer), Int (4 byte integer), Float (4 byte floating point number), Complex (a pair of Float number), or in other derived types. In order to connect two blocks together, their ports need to have the same data type. Stream Type Conversion blocks can be used to make the glue logic between two processing blocks with different data types.

The GNU Radio architecture is made for developing real-time signal processing, but the processing blocks are not aware of the time elapsed. They simply run as fast as they can to process their input data stream and send the result to their output. For example, even if the Sampling Rate parameter is assigned to a Signal Source block, the signal source block will generate as many samples as the CPU will permit every second. This parameter value is only used to compute the corresponding digital frequency depending on the sampling rate and frequency requested. In order to limit the processing power or to set a real sample rate, you use either a Throttle block or a hardware driver sink. The Throttle block will allow only a certain number of samples to pass through it in a given time, causing all blocks in the same data stream to run at the specified sample rate. When a hardware driver sink is used, like the Audio Sink block or the Radio420 GigE: Sink block (present in the Radio420X GNU Radio plug-in), it’s the hardware sample rate that limits the GNU Radio stream’s sample rate.

GNU Radio Companion

A few years ago, a graphical interface was developed to quickly connect processing blocks together. This graphical interface is called GNU Radio Companion (GRC).

With its graphical interface, GNU Radio Companion creates an XML file that describes the locations and connections of the processing blocks.

GRC graphical interface creates an XML file

When you click the Generate button (shown in the figure below), GRC generates the corresponding project file in Python.

GRC generates the corresponding project file in Python

You can connect block processing ports with other blocks having the same data type port. The data type is indicated by the color of the port, as shown below.

GNU Radio Companion Color Mapping

Also, in addition to processing blocks, you can add Variables to the design to facilitate future modifications.

GRC - Adding variables to the design to facilitate future modifications

For example, as shown in the figure above, you could assign the sampling rate value to the variable “samp_rate”. All blocks that require a sampling rate input value can use the “samp_rate” variable. Later, if the sampling rate needs to be changed, you need to update only the variable value, not all of the blocks that use it.

You can also use GRC to create a simple Graphical User Interface (GUI) for the user project. You can drag GUI Widget blocks directly into the GRC window, and GRC will automatically generate a GUI when executing the project.

There are many GUI widgets available: slider, text, check box, scope, FFT scope, and so on. The following figure shows a simple GUI project:

simple GUI project

A Signal Source block, a direct digital synthesizer (DDS), generates a tone that has the frequency specified by the WX GUI Slider value at a rate specified by the “samp_rate” Variable block. Then, the generated data stream goes into a Throttle block to limit the data flow to the sampling rate frequency. Finally, the data stream ends in the WX GUI FFT Sink block. When the project is executed, a GUI is displayed that includes every WX GUI block present in the project. The slider is displayed at the top of the window. It allows the user to dynamically modify the DDS frequency. The FFT Plot displays in real-time the data received at its input port.

In GNU Radio, streaming the data to a hardware peripheral like the PicoSDR can be done without adding significant complexity, as shown in the following diagram.

Streaming the data to a hardware peripheral in GNU Radio

A Radio420 Sink can replace the FFT Sink and the Radio420 global configuration block must be added. The Throttle block is no longer required, since the radio sink will throttle the data stream according to the hardware data frequency. We now have a radio transmitter sending a sinusoidal signal at a dynamically programmable frequency.

We can add the receiver section of the radio to this project:

Adding a receiver section of the radio to a project in GNU Radio

We can bring the FFT Sink back into the workspace to display the received data from the radio peripheral. The Radio420 Source doesn’t need a Throttling block because the data stream at the block output is generated at the same rate as the samples received from the radio peripheral.

Where to Learn More

GNU Radio is a powerful software environment that simplifies the development of complex waveforms and gives its users access to various tools and processing blocks provided by the open-source community. The real-time reconfiguration of parameters, high processing power, and fast development time of applications are only few of the benefits GNU Radio offers to SDR researchers.

To learn more about GNU Radio, check out the GNU Radio Tutorial Series on the balint256 YouTube channel, and the many GNU Radio Companion tutorials on Sharlene Katz’s webpage.