Operate the HackRF One software-defined radio for scanning, capture, analysis, and demodulation.
hackrf_sweep and hackrf_transfer CLI tools installedVerify: hackrf_info should show device info.
Default LNA=20 VGA=20 provides a good balance — noise floor is visible but not saturating, and real signals stand out clearly in the waterfall (blue background, yellow/red for signals).
When in doubt, start with LNA=20 VGA=20. Adjust if the waterfall is too hot (all yellow) or too cold (all dark blue).
The waterfall script has two modes. IQ mode is the default and produces high-resolution, artifact-free waterfalls.
python3 scripts/waterfall.py --start 420 --end 440
This automatically:
hackrf_transfer (5 seconds, appropriate sample rate)Options:
--duration 5 — capture duration in seconds (default: 5)--fft 4096 — FFT size, controls frequency resolution (default: 4096 ≈ 4.9 kHz at 20 MSPS)--lna 20 --vga 20 — gain settings--start / --end — frequency range in MHzFrom existing IQ file:
python3 scripts/waterfall.py --input capture.raw --freq 430e6 --rate 20e6
Why IQ mode over sweep mode:
For a quick low-resolution preview using hackrf_sweep:
python3 scripts/waterfall.py --mode sweep --start 420 --end 440
Use hackrf_sweep directly for quick signal discovery:
hackrf_sweep -f <start_mhz>:<end_mhz> -l 20 -g 20 -w 1000000 -N 50
-w 1000000: 1 MHz bins for wide scans (200 kHz effective resolution)-N 50: 50 sweeps for averagingNote: hackrf_sweep truncates sub-bins when bin width is too narrow (e.g., -w 50000 reports 404 bins but delivers only ~101 per row). Use -w 1000000 for reliable sweeps, or use IQ mode for detail.
Record raw IQ samples for detailed analysis:
hackrf_transfer -f <freq_hz> -s <sps> -l 20 -g 20 -n <samples> -r /tmp/iq_capture.raw
-s): 20M for 20 MHz bandwidth, 10M for 10 MHz, 2M for narrow-n = sample_rate × seconds (e.g., 20M × 5s = 100000000)Always delete IQ captures after analysis — they are large (~200 MB for 5s at 20 MSPS).
Analyze captured IQ data for modulation type, bandwidth, SNR:
python3 scripts/analyze.py /tmp/iq_capture.raw --freq <center_hz> --rate <sps> --outdir <dir>
The script:
Demodulate audio from IQ captures:
python3 scripts/demod.py /tmp/iq_capture.raw --mode <fm|am|usb|lsb> --offset <hz> --out <file.wav>
--offset: signal frequency offset from center (from analyze.py output)After analysis, delete IQ capture files:
rm -f /tmp/iq_capture.raw
analyze.py is the offset from center — add to center freq for absolute freqreferences/frequency_bands.md for band allocations and modulation classification共 2 个版本