What Is GNU Radio
Introducing GNU Radio
Creating and Modifying Python Blocks
What is GNU Radio?
GNU Radio is a free & open-source software development toolkit that provides signal processing blocks to implement software radios. It can be used with readily-available low-cost external RF hardware to create software-defined radios, or without hardware in a simulation-like environment. It is widely used in research, industry, academia, government, and hobbyist environments to support both wireless communications research and real-world radio systems.
Below shows an example flowgraph within the GNU Radio Companion visual editor:
GNU Radio is a framework that enables users to design, simulate, and deploy highly capable real-world radio systems. It is a highly modular, "flowgraph"-oriented framework that comes with a comprehensive library of processing blocks that can be readily combined to make complex signal processing applications. GNU Radio has been used for a huge array of real-world radio applications, including audio processing, mobile communications, tracking satellites, radar systems, GSM networks, Digital Radio Mondiale, and much more - all in computer software. It is, by itself, not a solution to talk to any specific hardware. Nor does it provide out-of-the-box applications for specific radio communications standards (e.g., 802.11, ZigBee, LTE, etc.,), but it can be (and has been) used to develop implementations of basically any band-limited communication standard.
Why would I want GNU Radio?
Formerly, when developing radio communication devices, the engineer had to develop a specific circuit for detection of a specific signal class, design a specific integrated circuit that would be able to decode or encode that particular transmission and debug these using costly equipment.
Software-Defined Radio (SDR) takes the analog signal processing and moves it, as far as physically and economically feasible, to processing the radio signal on a computer using algorithms in software.
You can, of course, use your computer-connected radio device in a program you write from scratch, concatenating algorithms as you need them and moving data in and out yourself. But this quickly becomes cumbersome: Why are you re-implementing a standard filter? Why do you have to care how data moves between different processing blocks? Wouldn't it be better to use highly optimized and peer-reviewed implementations rather than writing things yourself? And how do you get your program to scale well on a multi-core architectures but also run well on an embedded device consuming but a few watts of power? Do you really want to write all the GUIs yourself?
Enter GNU Radio: A framework dedicated to writing signal processing applications for commodity computers. GNU Radio wraps functionality in easy-to-use reusable blocks, offers excellent scalability, provides an extensive library of standard algorithms, and is heavily optimized for a large variety of common platforms. It also comes with a large set of examples to get you started.
The remainder of this page provides a brief intro to DSP, feel free to skip to the next tutorial if you are already familiar with DSP.
Digital Signal Processing
As a software framework, GNU Radio works on digitized signals to generate communication functionality using general-purpose computers.
A little signal theory
Doing signal processing in software requires the signal to be digital. But what is a digital signal?
To understand better, let's look at a common "signal" scenario: Recording voice for transmission using a cellphone.
A person physically speaking creates a sound 'signal' - the signal, in this case, is comprised of waves of varying air pressure being generated by the vocal chords of a human. A time-varying physical quantity, like the air pressure, is what is defined as a signal.
When the waves reach the microphone, it converts the varying pressure into an electrical signal, a variable voltage:
Now that the signal is electrical, we can work with it. The audio signal, at this point, is analog - a computer can't yet deal with it; for computational processing, a signal has to be digital, which means two things:
It can only be one of a limited number of values. It only exists for a non-infinite amount of time.
This digital signal can thus be represented by a sequence of numbers, called samples. A fixed time interval between samples leads to a signal sampling rate.
The process of taking a physical quantity (voltage) and converting it to digital samples is done by an Analog-to-Digital Converter (ADC). The complementary device, a Digital-to-Analog Converter (DAC), takes numbers from a digital computer and converts them to an analog signal.
Now that we have a sequence of numbers, our computer can do anything with it. It might, for example, apply digital filters, compress it, recognize speech, or transmit the signal using a digital link.
Applying Digital Signal Processing to Radio Transmissions
The same principles as for sounds can be applied to radio waves:
A signal, here electromagnetic waves, can be converted into a varying voltage using an antenna.
This electrical signal is then on a 'carrier frequency', which is usually several Mega- or even Gigahertz.
Different types of receivers (e.g. Superheterodyne Receiver, Direct Conversion, Low Intermediate Frequency Receivers), which can be acquired commercially as dedicated software radio peripherals, are already available to users (e.g. amateur radio receivers connected to sound cards) or can be obtained when re-purposing cheaply available consumer digital TV receivers (the notorious RTL-SDR project).
A modular, flowgraph based Approach to Digital Signal Processing
To process digital signals, it is straight-forward to think of the individual processing stages (filtering, correction, analysis, detection...) as processing blocks, which can be connected using simple flow-indicating arrows:
When building a signal processing application, one will build up a complete graph of blocks. Such a graph is called flowgraph in GNU Radio.
GNU Radio is a framework to develop these processing blocks and create flowgraphs, which comprise radio processing applications.
As a GNU Radio user, you can combine existing blocks into a high-level flowgraph that does something as complex as receiving digitally modulated signals and GNU Radio will automatically move the signal data between these and cause processing of the data when it is ready for processing.
GNU Radio comes with a large set of existing blocks. An index to all of them can be found in Block Docs. Just to give you but a small excerpt of what's available in a standard installation, here's some of the most popular block categories and a few of their members:
- Waveform Generators
- Constant Source
- Noise Source
- Signal Source (e.g. Sine, Square, Saw Tooth)
- AM Demod
- Continuous Phase Modulation
- PSK Mod / Demod
- GFSK Mod / Demod
- GMSK Mod / Demod
- QAM Mod / Demod
- WBFM Receive
- NBFM Receive
- Instrumentation (i.e., GUIs)
- Constellation Sink
- Frequency Sink
- Histogram Sink
- Number Sink
- Time Raster Sink
- Time Sink
- Waterfall Sink
- Math Operators
- Complex Conjugate
- Channel Models
- Channel Model
- Fading Model
- Dynamic Channel Model
- Frequency Selective Fading Model
- Band Pass / Reject Filter
- Low / High Pass Filter
- IIR Filter
- Generic Filterbank
- Decimating FIR Filter
- Root Raised Cosine Filter
- FFT Filter
- Fourier Analysis
- Log Power FFT
- Goertzel (Resamplers)
- Fractional Resampler
- Polyphase Arbitrary Resampler
- Rational Resampler (Synchronizers)
- Clock Recovery MM
- Correlate and Sync
- Costas Loop
- FLL Band-Edge
- PLL Freq Det
- PN Correlator
- Polyphase Clock Sync
Using these blocks, many standard tasks, like normalizing signals, synchronization, measurements, and visualization can be done by just connecting the appropriate block to your signal processing flow graph.
Also, you can write your own blocks, that either combine existing blocks with some intelligence to provide new functionality together with some logic, or you can develop your own block that operates on the input data and outputs data.
Thus, GNU Radio is mainly a framework for the development of signal processing blocks and their interaction. It comes with an extensive standard library of blocks, and there are a lot of systems available that a developer might build upon. However, GNU Radio itself is not software that is ready to do something specific -- it's the user's job to build something useful out of it, though it already comes with a lot of useful working examples. Think of it as a set of building blocks.