Your First Flowgraph
Introducing GNU Radio
Creating and Modifying Python Blocks
This tutorial describes how to create and run your first flowgraph in GNU Radio.
This guide assumes GNU Radio is installed. The GNU Radio installation structures are here: Installing GNU Radio. The next tutorial, Python Variables in GRC, describes how Python data types are used in GNU Radio Companion (GRC).
Starting GNU Radio Companion
The GNU Radio Companion (GRC) is a visual editor for creating and running flowgraphs. GRC uses .grc files which are then translated into Python .py flowgraphs.
Open a terminal by pressing CTRL + ALT + T or by right-clicking on the desktop and selecting Open in Terminal:
Type in the terminal:
$ gnuradio-companion &
The GRC window opens:
Double click the Options block and name the flowgraph by editing the Id and Title:
The Id is the filename of the Python flowgraph. Name it sineWaveFlowgraph.py. The Title is a description of the flowgraph. Click OK to save the changes.
Click File : Save to save the GRC Flowgraph.
Enter sineWaveGRC.grc as the name for the .grc file to distinguish it from the .py flowgraph.
The GRC file is named and saved.
Blocks are added to create the first flowgraph. GNU Radio comes with a library of signal processing blocks. The blocks can be browsed using the arrows on the right. Blocks may also be searched for using CTRL + F or by selecting the magnifying glass (highlighted in red):
Search for the Signal Source block and then drag and drop it into the GRC workspace:
Now search for Throttle, QT GUI Frequency Sink and QT GUI Time Sink. Drag and drop each of the blocks into the workspace. The flowgraph should like the following:
The Signal Source block will create a complex sinusoid, QT GUI Frequency Sink will display the magnitude of the frequency spectrum and QT GUI Time Sink will display the time domain. The Throttle block is used for flow control in the absence of radio hardware.
The blocks need to be connected. First click the output of Signal Source (highlighted in red) and then click the input to the Throttle (highlighted in orange).
The Signal Source block text changed from red to black. The red text means a block still has an input or output that needs to be connected before the flowgraph can be run. Connect the throttle output to the frequency sink and time sink:
Running The Flowgraph
Press the Play button (highlighted in red) to run the flowgraph:
A new window displays the signal in the time domain and frequency domain:
Success! The flowgraph is running.
Open the file browser. There are two files. The first file is sineWaveGRC.grc, containing the information for the display of the flowgraph in GRC. The second file is sineWaveFlowgraph.py, containing the actual Python flowgraph code.
Continue onto the next tutorial, Python Variables in GRC, which describes how Python data types are used in GRC.