GNU Radio fundamentals: flowgraphs, samples, sample rate, and time/frequency-domain visualization.
Basic GNU Radio.
- SDR
- Lesson
SDR Learning Module — Lesson 1
GNU Radio Fundamentals: Flowgraphs, Signals, and Visualization
Prerequisite: Lesson 0 — WSL2 + Ubuntu + GNU Radio Setup
Environment: WSL2 + Ubuntu + GNU Radio Companion (GRC)
1. Learning Objectives
After this lesson you should be able to:
- Explain a GNU Radio flowgraph and the role of blocks.
- Distinguish Source, Processing, and Sink blocks.
- Explain sample rate, signal frequency, amplitude, and complex samples.
- Build a software-only signal-generation flowgraph.
- Use QT GUI Time Sink and Frequency Sink.
- Interpret basic time- and frequency-domain behavior.
- Perform controlled experiments with frequency, amplitude, sample rate, negative frequency, two tones, and noise.
2. Core Concept: GNU Radio Processes Samples
GNU Radio is a signal-processing framework. The basic data is a stream of numerical samples.
Signal Source -> Processing -> Visualization/Output
A simple SDR flowgraph is:
Signal Source
|
v
Throttle
|
+-----------------> QT GUI Time Sink
|
+-----------------> QT GUI Frequency Sink
3. Source, Processing, and Sink
Source: generates or receives samples. Examples: Signal Source, File Source, RTL-SDR Source, USRP Source.
Processing: transforms samples. Examples: Multiply, Add, Filter, FFT, Resampler, AGC, Quadrature Demod.
Sink: displays, saves, or outputs samples. Examples: QT GUI Time Sink, Frequency Sink, File Sink, Audio Sink.
4. Samples and I/Q
For a complex SDR sample:
x[n] = I[n] + jQ[n]
where I is in-phase and Q is quadrature. I/Q representation is fundamental to modern SDR baseband processing.
5. First Experiment
Target:
- Sample rate =
1e6(1 MHz) - Tone frequency =
100e3(100 kHz) - Amplitude =
1.0 - Output type = Complex
Create the project:
mkdir -p ~/sdr-course/lesson-1
cd ~/sdr-course/lesson-1
gnuradio-companion
Save the flowgraph as:
lesson_1_basic_signal.grc
6. Add Variable
Add a Variable block:
ID: samp_rate
Value: 1e6
Using a variable keeps related blocks synchronized.
7. Add Signal Source
Configure Signal Source:
Waveform: Sine
Sample Rate: samp_rate
Frequency: 100e3
Amplitude: 1.0
Offset: 0
Output Type: Complex
8. Add Throttle
Add Throttle and set:
Sample Rate: samp_rate
Throttle is useful for software-only simulations because it prevents the flowgraph from running as fast as the CPU permits. A real hardware source normally establishes its own sample rate.
9. Add QT GUI Time Sink
Configure:
- Number of Inputs = 1
- Sample Rate =
samp_rate
Connect:
Throttle -> Time Sink
The Time Sink shows waveform amplitude versus time/sample index.
10. Add QT GUI Frequency Sink
Configure:
- Number of Inputs = 1
- Sample Rate =
samp_rate - Center Frequency = 0
Connect another branch:
Throttle -> Frequency Sink
The Frequency Sink shows spectral content. A 100 kHz complex tone should appear near +100 kHz.
11. Complete Flowgraph
+--> QT GUI Time Sink
/
Signal Source -> Throttle
+--> QT GUI Frequency Sink
Run the flowgraph from GRC.
12. Time Domain
The time domain answers: What does the waveform look like over time?
For a sinusoid:
x(t) = A sin(2πft)
For f = 100 kHz:
T = 1/f = 10 µs
Changing amplitude changes waveform height. Changing frequency changes how rapidly it oscillates.
13. Frequency Domain
The frequency domain answers: What frequency components exist?
For an ideal single tone, a strong spectral component appears at the tone frequency. Frequency-domain analysis becomes essential for modulation, filtering, interference, bandwidth, and spectrum monitoring.
14. Negative Frequency
With complex I/Q samples, frequency can be represented on both sides of zero:
-500 kHz -------- 0 -------- +500 kHz
for a 1 MHz complex sample rate.
Set the Signal Source frequency to:
-100e3
The spectral component should move near -100 kHz.
15. Experiments
Experiment 1 — Frequency
Change 100 kHz to 200 kHz. The spectral peak should move accordingly.
Experiment 2 — Amplitude
Change amplitude from 1.0 to 0.5. The waveform and spectral magnitude decrease, while frequency remains unchanged.
Experiment 3 — Sample Rate
Change samp_rate from 1 MHz to 2 MHz and update Signal Source, Throttle, Time Sink, and Frequency Sink. The tone remains 100 kHz while the displayed frequency span changes.
Experiment 4 — Negative Frequency
Set frequency to -100e3 and observe the peak move to the negative-frequency side.
Experiment 5 — Two Tones
Create two Signal Sources at 100 kHz and 200 kHz. Combine them with Add:
Signal A ---- +--> Add --> Throttle --> Frequency Sink
Signal B ----/
You should see two spectral peaks.
Experiment 6 — Noise
Add a Noise Source and combine it with the tone using Add. Observe the noise floor and the reduction in spectral clarity. This introduces SNR concepts.
16. Sample Rate vs Signal Frequency
Do not confuse these quantities.
Sample rate = 1 MHz
Signal = 100 kHz
means the system processes 1 million samples per second representing a 100 kHz signal.
17. Nyquist Concept
For a real-valued sampled signal, the classical condition is:
Fs > 2B
where Fs is sample rate and B is the highest frequency component. Complex I/Q sampling requires a more careful interpretation, which will be covered in Lesson 2.
18. Reading Any GNU Radio Flowgraph
Ask:
- Where does the data come from? → Source
- What happens to the samples? → Processing
- Where does it go? → Sink
- What is the sample rate?
- What is the stream data type?
- What frequency and bandwidth are represented?
19. Common Beginner Mistakes
- Inconsistent sample-rate settings across blocks.
- Forgetting Throttle in software-only simulations.
- Connecting incompatible stream data types.
- Confusing baseband frequency with RF carrier frequency.
- Treating a Frequency Sink as an RF spectrum analyzer regardless of its input.
20. Mini Project
Build a two-tone signal monitor:
Fs = 1 MHz
Tone 1 = 100 kHz
Tone 2 = 250 kHz
Amplitude = 1.0
Combine the tones with Add, then connect to Throttle, Time Sink, and Frequency Sink.
21. Challenge
- Change Tone 1 to -100 kHz.
- Change Tone 2 to +250 kHz.
- Add noise.
- Reduce Tone 2 amplitude.
- Change sample rate from 1 MHz to 2 MHz.
- Record observations.
22. Deliverable
Save:
~/sdr-course/lesson-1/
├── lesson_1_basic_signal.grc
├── observations.md
└── screenshots/
In observations.md, record what changed during each experiment.
23. Completion Checklist
- [ ] Open GRC and create a flowgraph.
- [ ] Use Variable, Signal Source, Throttle, Time Sink, Frequency Sink.
- [ ] Change frequency and amplitude.
- [ ] Change sample rate.
- [ ] Generate negative frequency.
- [ ] Combine two tones.
- [ ] Add noise.
- [ ] Explain sample rate versus signal frequency.
24. Preview — Lesson 2
Lesson 2 will cover:
- Discrete-time signals
- Sampling theory
- Nyquist theorem
- Aliasing
- Complex numbers
- I/Q representation
- FFT
- Bandwidth
The goal is to understand why the GNU Radio displays look the way they do, not just which blocks to connect.
References
- GNU Radio Documentation: https://wiki.gnuradio.org/
- GNU Radio Tutorials: https://wiki.gnuradio.org/index.php/Tutorials
- Signal Source: https://wiki.gnuradio.org/index.php/Signal_Source
- QT GUI Frequency Sink: https://wiki.gnuradio.org/index.php/QT_GUI_Frequency_Sink
- QT GUI Time Sink: https://wiki.gnuradio.org/index.php/QT_GUI_Time_Sink