|
| 1 | +# Lab 06 — Real SDR signal analysis |
| 2 | + |
| 3 | +## Purpose |
| 4 | + |
| 5 | +This lab closes the loop between the SDR course and the C++ DSP backend. |
| 6 | + |
| 7 | +The goal is to process a real or simulated SDR recording with the same engineering mindset used in production DSP systems: |
| 8 | + |
| 9 | +```text |
| 10 | +RF signal |
| 11 | + ↓ |
| 12 | +rtl-sdr / HDSDR / GNU Radio |
| 13 | + ↓ |
| 14 | +raw IQ recording |
| 15 | + ↓ |
| 16 | +C++ DSP analysis |
| 17 | + ↓ |
| 18 | +plots, metrics, validation |
| 19 | + ↓ |
| 20 | +future FPGA / Zynq acceleration |
| 21 | +``` |
| 22 | + |
| 23 | +## Learning outcomes |
| 24 | + |
| 25 | +After this lab, a student should be able to: |
| 26 | + |
| 27 | +- record or prepare an IQ file; |
| 28 | +- understand interleaved complex sample formats; |
| 29 | +- analyze amplitude level and RMS; |
| 30 | +- detect a tone or narrowband component; |
| 31 | +- compare C++ output with Python / MATLAB / GNU Radio; |
| 32 | +- identify what parts of the pipeline are suitable for FPGA implementation. |
| 33 | + |
| 34 | +## Supported input format |
| 35 | + |
| 36 | +The first practical format is interleaved signed 16-bit complex IQ: |
| 37 | + |
| 38 | +```text |
| 39 | +I0, Q0, I1, Q1, I2, Q2, ... |
| 40 | +``` |
| 41 | + |
| 42 | +Short name: |
| 43 | + |
| 44 | +```text |
| 45 | +ci16 |
| 46 | +``` |
| 47 | + |
| 48 | +Recommended file path: |
| 49 | + |
| 50 | +```text |
| 51 | +data/lab06_real_or_simulated_ci16.iq |
| 52 | +``` |
| 53 | + |
| 54 | +## Recording options |
| 55 | + |
| 56 | +### Option A — HDSDR |
| 57 | + |
| 58 | +1. Configure the SDR receiver. |
| 59 | +2. Select an appropriate sample rate. |
| 60 | +3. Record raw IQ data. |
| 61 | +4. Save/export as complex int16 if possible. |
| 62 | +5. Run the C++ analyzer. |
| 63 | + |
| 64 | +### Option B — rtl_sdr command-line tools |
| 65 | + |
| 66 | +Depending on the toolchain, rtl-sdr commonly produces unsigned 8-bit IQ. For this course track, convert or generate a ci16 file before using the current C++ analyzer. |
| 67 | + |
| 68 | +### Option C — simulated recording |
| 69 | + |
| 70 | +Use the helper script: |
| 71 | + |
| 72 | +```bash |
| 73 | +python tools/generate_lab06_ci16_tone.py |
| 74 | +``` |
| 75 | + |
| 76 | +It produces a deterministic ci16 IQ file for testing the pipeline without hardware. |
| 77 | + |
| 78 | +## Suggested parameters |
| 79 | + |
| 80 | +| Parameter | Recommended value | |
| 81 | +|---|---:| |
| 82 | +| File format | ci16 IQ | |
| 83 | +| Sample rate | 1.024 MSa/s for first SDR experiments | |
| 84 | +| Duration | 0.1–2 seconds | |
| 85 | +| Target tone | known offset frequency | |
| 86 | +| Analysis | RMS + Goertzel + optional FFT | |
| 87 | + |
| 88 | +## Example workflow |
| 89 | + |
| 90 | +```bash |
| 91 | +pip install numpy |
| 92 | +python tools/generate_lab06_ci16_tone.py |
| 93 | + |
| 94 | +cmake -S . -B build -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release |
| 95 | +cmake --build build --config Release |
| 96 | +./build/my_project/iq_analysis_demo data/lab06_simulated_ci16.iq 1024000 100000 |
| 97 | +``` |
| 98 | + |
| 99 | +Expected output includes: |
| 100 | + |
| 101 | +```text |
| 102 | +Samples: ... |
| 103 | +RMS: ... |
| 104 | +Goertzel power @ 100000 Hz: ... |
| 105 | +``` |
| 106 | + |
| 107 | +## Validation checklist |
| 108 | + |
| 109 | +| Step | Check | |
| 110 | +|---|---| |
| 111 | +| File generation/recording | file size is non-zero | |
| 112 | +| IQ interpretation | sample count is plausible | |
| 113 | +| Scaling | normalized values are within expected range | |
| 114 | +| RMS | non-zero and not clipped | |
| 115 | +| Tone detection | Goertzel power increases near target | |
| 116 | +| Reproducibility | same input gives same report | |
| 117 | + |
| 118 | +## Engineering discussion |
| 119 | + |
| 120 | +### Why start with files? |
| 121 | + |
| 122 | +File-based processing is easier to test, debug, and reproduce than live streaming. Once the DSP blocks are validated, the same logic can be moved to real-time input. |
| 123 | + |
| 124 | +### Why ci16? |
| 125 | + |
| 126 | +Complex int16 is common in RF pipelines because it is compact, efficient, and close to what ADC-oriented systems produce after digital downconversion. |
| 127 | + |
| 128 | +### What is missing for production? |
| 129 | + |
| 130 | +- metadata handling; |
| 131 | +- robust file format detection; |
| 132 | +- overload/clipping metrics; |
| 133 | +- streaming input; |
| 134 | +- FFT spectrum report; |
| 135 | +- multi-channel synchronization; |
| 136 | +- fixed-point test vectors. |
| 137 | + |
| 138 | +## FPGA / Zynq connection |
| 139 | + |
| 140 | +Potential mapping: |
| 141 | + |
| 142 | +| Stage | FPGA candidate? | Comment | |
| 143 | +|---|---|---| |
| 144 | +| IQ scaling | yes | fixed-point normalization | |
| 145 | +| FIR filtering | yes | DSP slices | |
| 146 | +| Goertzel | yes | narrowband detector | |
| 147 | +| FFT spectrum | yes | vendor FFT IP | |
| 148 | +| GCC-PHAT | yes | FFT + complex multiply + peak search | |
| 149 | +| Resampler | yes | polyphase FIR | |
| 150 | + |
| 151 | +## Course message |
| 152 | + |
| 153 | +This lab demonstrates the full educational and engineering chain: |
| 154 | + |
| 155 | +```text |
| 156 | +real signal → stored IQ → C++ reference → validation → optimization → FPGA candidate |
| 157 | +``` |
| 158 | + |
| 159 | +That is the bridge between theory, software DSP, SDR practice, and hardware implementation. |
0 commit comments