The Complete Magazine on Open Source

Getting Started with GNU Radio

, / 491 0

GNU Radion illustration

This article, which is targeted at scholars working in the area of digital signal processing and communication systems, gives an introduction to GNU Radio. It also covers the installation and a few uses of GNU Radio.

You must have listened to radio broadcasts from various radio stations. These stations send out radio waves, which are characterised by parameters like amplitude, frequency, phase, period, wavelength, etc, and need some kind of medium to travel through. Radio waves possess the maximum wavelength in the electromagnetic spectrum. Also, AM radio waves are longer in wavelength than television or FM radio waves.

Software Defined Radio
The term Software Defined Radio (SDR) was coined by Joseph Mitola in 1991. According to J. Bard and V.J. Kovarik (Reference 2), “SDR can be configured through the use of a personal computer equipped with a sound card, analog-to-digital converter, and some RF front end.” In short, a software radio is a communication device created partially or entirely by using software.
Software Defined Radio brings together radio functionalities and signal processing capabilities, which helps to achieve reconfigurability and portability as a replacement to conventional hardware based radio. This enables researchers and designers to make dynamic changes frequently in software programs. Software radios can be easily upgraded to new technologies by performing different software update downloads. They replace rigid hardware with flexible software based solutions.
Figure 3 depicts the tiered approach to transformation, from the conventional hardware based radio to the ultimate software based radio. Tier 0 (hardware based radio) is implemented using hardware components only, and does not offer any kind of portability. Tier 1 is configured using multiple hardware transceivers that support several protocols and software controllers, which are used to activate specific transceivers. A typical example of such type of radio is a dual SIM mobile phone, which implements both GSM and CDMA together. The second tier makes use of software to control various modulation techniques. GNU Radio and Universal Software Radio Peripheral (USRP) fall under this category. The next tier includes all the features of the previous tier, while offering analogue conversions to take place at the antenna mainly. The final tier is intended to have the intelligence to recognise traffic information and behave accordingly to optimise resources.
Many variants of SDR are available in the market. Some of them are commercial and others are open source. Cognitive Radio is an intelligent variant of SDR, which possesses machine learning capabilities. Ivan Seskar points out in his hands-on tutorial (Reference 4) that, “Cognitive Radio is an SDR that is frequency-agile, fully reconfigurable and able to sense its spectrum surroundings; it knows policies, rules and regulations, and is flexible enough to reconfigure itself to different air interfaces and/or protocols.”
Let’s now discuss GNU Radio, as it is one of the most widely accepted tools all over the world.

Figure 1 Radio waves in the lectromagnetic spectrum

Figure 1: Radio waves in the lectromagnetic spectrum

Figure 2 Block diagram of a conventional hardwae based radio

Figure 2: Block diagram of a conventional hardwae based radio

GNU Radio
The GNU Radio project was conceptualised by Eric Blossom. It is an open source toolkit, which is made of several signal processing and communication blocks written in C++ and mapped onto Python using a simplified wrapper and interface generator (SWIG). Figure 4 shows the typical architecture of GNU Radio. GNU Radio Companion (GRC) is a graphical user interface, which makes dealing with this tool a little easier. It automatically generates source code (in Python) as per the connections between various blocks. Appropriate connection of various signal processing blocks in a signal flow graph creates software radio. It enables users to generate and process waveforms in software with a rich interface.
Before dwelling into the domain of GNU Radio, it is expected that one should have sufficient knowledge of C++/Python, communication systems, digital signal processing and analogue digital hardware (Reference 3).

Figure 3

Figure 3: Software radio: A tiered approach

Installation guide
GNU Radio is available for Linux, Windows and Mac OS. However, it works best in a Linux environment. The installation process on Ubuntu Linux is illustrated in this section. There are three ways to install this toolkit. Because this is not a standalone application and requires many dependencies to work, one needs to make sure that all the necessary packages are also installed in advance.

Installation through repositories: This is the beginners’ first choice to install the gnuradio package from the Linux distribution’s standard repositories. Because GNU Radio is being developed rapidly, one must use the latest binaries to avoid any version related issues at later stages. The following commands install the basic components of GNU Radio and GNU Radio Companion, respectively.

$ apt-get install gnuradio
$ apt-get install gnuradio-companion

If you need a bootable DVD with GNU Radio preinstalled, follow to try out GNU Radio without installing it on any machine.

Figure 4

Figure 4: GNU Radio architecture

Installation from source: Marcus Leech (Reference 5) has contributed a very useful script (build-gnuradio), which can be used to install different versions of GNU Radio without much effort. For more information, users are advised to refer to

Installing manually from source: If you have the experience in Linux to install software packages manually from source, follow these steps:
1. Install the prerequisites.
2. Get the GNU Radio source code by downloading it as a tarball.
3. Configure, compile and install GNU Radio.
Interested readers can go to the link given in Reference 6, where all the steps for the complete manual installation are listed. If this approach is used, then several commands should be executed with care and the many dependencies should also be installed carefully.

Fig 5

Figure 5: Flow graph for dial tone example in GNU Radio Companion

Demo example 1 [dial tone generator]
Once GNU Radio is completely installed, it offers certain sample code examples. One such example is to generate a dial tone using two sine waves of different frequencies. Figure 5 presents the GNU Radio Companion interface to enable the dial tone implementation. Appropriate connections between various blocks generate a flow graph structure, and once the flow graph is executed, it generates the corresponding Python code in the same directory.
Executing either the generated Python code from the terminal or the flow graph directly from GNU Radio Companion will produce the output shown in Figure 6.

Demo example 2 [FFT representation]
Figure 7 shows a simple flow graph, which accepts a signal and displays its frequency domain representation through Fast Fourier Transform (FFT).

Signal processing block
There are basically three types of signal processing blocks in GNU Radio Companion. These are listed below.
1. Source blocks: These act as input providers and have only outgoing connections.
2. Sink blocks: These act as output seekers, and have only incoming connections or links.
3. Processing blocks: These perform some processing (such as modulation, filtering, etc), and can have both incoming and outgoing links.
Hence, every flow graph is characterised by minimum one source block, one sink block and some processing blocks.

Figure 6 Output of the dial tone example in GNU Radio

Figure 6: Output of the dial tone example in GNU Radio Companion

Figure 7 FFT plotting

Figure 7: FFT plotting

We have discussed only small examples as a beginner’s guide to readers, but one can also implement highly complex applications using GNU Radio. Typical applications include AM receiver, FM receiver, intelligent spectrum sensing, digital radio astronomy, and many more.

[1] Sapan H. Mankad and S.N. Pradhan. Application of Software Defined Radio for Noise Reduction using Empirical Mode Decomposition. In Advances in Computer Science, Engineering & Applications, pages 113–121. Springer Berlin Heidelberg, 2012
[2] Bard, J., Kovarik V.J. Software Defined Radio – The Software Communications Architecture. John Willey and Sons (2007)
[3] Kuntal Ray. An Introduction to GNU Radio
[4] Ivan Seskar. Hands-on-Tutorial, Future Internet Summer School 2009 Part 2, The State University of New Jersey
[6] Installing GNU Radio on Ubuntu