Your First Flowgraph: Difference between revisions
Mattcarrick (talk | contribs) No edit summary |
Mattcarrick (talk | contribs) |
||
Line 39: | Line 39: | ||
== Adding Blocks == | == Adding Blocks == | ||
GNU Radio comes with a | 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 <span style="color:red">red</span>): | ||
[[File:SearchBlockLibrary.png|500px]] | [[File:SearchBlockLibrary.png|500px]] | ||
Line 51: | Line 51: | ||
[[File:UnconnectedFlowgraph.png|500px]] | [[File:UnconnectedFlowgraph.png|500px]] | ||
The ''Signal Source'' block will create a complex sinusoid, ''QT GUI Frequency Sink'' will display the magnitude of the frequency spectrum | 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 <span style="color:red">red</span>) and then click the input to the ''Throttle'' (highlighted in <span style="color:orange">orange</span>). | The blocks need to be connected. First click the output of ''Signal Source'' (highlighted in <span style="color:red">red</span>) and then click the input to the ''Throttle'' (highlighted in <span style="color:orange">orange</span>). | ||
Line 57: | Line 57: | ||
[[File:MakeFirstConnection.png|500px]] | [[File:MakeFirstConnection.png|500px]] | ||
The ''Signal Source'' block text changed from <span style="color:red">red</span> to black. The <span style="color:red">red</span> 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: | |||
[[File:ConnectedFlowgraph.png|500px]] | [[File:ConnectedFlowgraph.png|500px]] |
Revision as of 17:01, 10 March 2022
Beginner Tutorials
Introducing GNU Radio Flowgraph Fundamentals
Creating and Modifying Python Blocks DSP Blocks
SDR Hardware |
This tutorial guides you through creating and running your first flowgraph in GNU Radio.
This guide assumes you have already installed GNU Radio. You can find the installation instructions 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 assembling 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:
In the terminal, type:
$ gnuradio-companion &
The GRC window will open:
Double click the Options block on the upper left and name your flowgraph by editing the Id and Title entries:
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 your changes.
Click File : Save to save your GRC Flowgraph.
Enter sineWaveGRC.grc as the name for your .grc file to distinguish it from the .py flowgraph.
The GRC file is now named and saved. Blocks can be added to create your first flowgraph.
Adding Blocks
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 so the flowgraph looks 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 will pop-up displaying the signal in the time domain and frequency domain:
Success! Your flowgraph is now running.
Opening your file browser shows that that there are two files, sineWaveGRC.grc which is a file that contains the information for the visual display of the flowgraph in GRC, and sineWaveFlowgraph.py which contains the actual Python-based flowgraph code.
Continue onto the next tutorial, Python Variables in GRC, which describes how Python data types are used in GRC.