C++/Qt desktop spectrum analyzer for HackRF SDR devices with real-time FFT processing and spectrum visualization.
HackRFSpectrumAnalyzer is a desktop application for working with HackRF SDR devices.
The application connects to a HackRF device, receives IQ samples, performs FFT-based spectrum calculation and displays the result in real time using a Qt Widgets interface.
The project demonstrates practical C++/Qt development for hardware-oriented software: device initialization, callback-based data receiving, signal processing, GUI controls and real-time plotting.
- HackRF device initialization and configuration
- Real-time IQ sample receiving through
libhackrf - FFT-based spectrum calculation using
FFTW3 - Spectrum visualization with
QCustomPlot - Center frequency, span, RBW/VBW and gain settings
- Power calculation and frequency axis scaling
- Qt Widgets-based desktop interface
- Separation between device-processing logic and GUI layer
- C++17
- Qt Widgets
- Qt Core
- Qt PrintSupport
- CMake
- pkg-config
- QCustomPlot
- libhackrf
- FFTW3
- libusb-1.0
- Linux / Unix-like systems
The project is divided into two main layers:
HackRFDevice— encapsulates HackRF initialization, parameter setup, RX callback handling, IQ sample processing, FFT calculation and spectrum data preparation.MainWindow— provides GUI controls, connects user actions with the device layer and updates the spectrum plot.
General data flow:
HackRF SDR device
↓
libhackrf RX callback
↓
IQ sample buffer
↓
FFT processing
↓
Spectrum / power calculation
↓
Qt signal
↓
QCustomPlot visualization
.
├── docs/
│ └── images/
│ └── spectrum_analyzer_ui.png
├── qcustomplot/
│ ├── qcustomplot.cpp
│ └── qcustomplot.h
├── CMakeLists.txt
├── hackrfdevice.cpp
├── hackrfdevice.h
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
└── README.md
Required dependencies:
- Qt 5 or Qt 6
- CMake
- pkg-config
- libhackrf
- FFTW3
- libusb-1.0
- C++ compiler with C++17 support
sudo apt update
sudo apt install cmake build-essential pkg-config \
qtbase5-dev qtbase5-dev-tools \
libhackrf-dev hackrf \
libfftw3-dev \
libusb-1.0-0-devbrew install cmake pkg-config qt hackrf fftw libusbIf Qt is installed through Homebrew and CMake cannot find it automatically, pass the Qt prefix manually:
cmake .. -DCMAKE_PREFIX_PATH="$(brew --prefix qt)"Clone the repository:
git clone https://github.com/Unsainted38/HackRFSpectrumAnalyzer.git
cd HackRFSpectrumAnalyzerCreate a build directory:
mkdir -p build
cd buildConfigure the project:
cmake ..Build:
cmake --build .Run the application:
./HackRFSpectrumAnalyzerThe exact binary path may depend on the generator and build directory used by your environment.
Real spectrum acquisition requires a connected HackRF SDR device.
To check that HackRF is detected by the system, run:
hackrf_infoIf the device is not detected, check:
- USB connection
- HackRF drivers and firmware
- user permissions for USB devices on Linux
- installed
libhackrfpackage - whether another application is already using the device
The source code, architecture and GUI layout can be reviewed without a connected HackRF device.
Real IQ data acquisition, spectrum calculation from live samples and hardware testing require a physical HackRF SDR device connected to the system.
- Designed and implemented the Qt Widgets GUI for spectrum analyzer control.
- Implemented HackRF initialization and configuration through
libhackrf. - Implemented real-time IQ data receiving using the
libhackrfcallback model. - Added FFT-based spectrum calculation using
FFTW3. - Implemented spectrum plotting and frequency axis scaling with
QCustomPlot. - Added basic power calculation and real-time graph updates.
- Structured the application into a device-processing layer and a GUI layer.
- Migrated the project build system from qmake to CMake.
The primary build system is CMake.
The project uses:
CMAKE_AUTOMOCfor Qt meta-object compilationCMAKE_AUTOUICfor processing.uiformspkg-configfor external native libraries- C++17 as the required language standard
External libraries are expected to be available through pkg-config:
libhackrffftw3libusb-1.0
- Hardware acquisition requires a connected HackRF SDR device.
- Some platform-specific dependency installation may require manual setup.
- The project is intended as a desktop engineering tool and portfolio example, not as a full replacement for professional SDR software.
- Current focus is on basic spectrum visualization and hardware interaction rather than advanced SDR processing features.
- Add a mock signal generator for full demo mode without hardware.
- Improve error handling and user-facing diagnostics.
- Add configuration file support for default device parameters.
- Add export of spectrum data to CSV.
- Add GitHub Actions build check.
- Add release builds for Linux.
- Add CMake install rules.
- Add unit tests for DSP/helper logic.
- Add more advanced spectrum processing modes.
This project was developed as a practical C++/Qt application for SDR-based spectrum analysis and hardware interaction.
It demonstrates experience with:
- desktop GUI development;
- Qt Widgets applications;
- hardware device APIs;
- callback-based data processing;
- FFT calculations;
- real-time visualization;
- CMake-based C++ project configuration;
- integration of native system libraries.
No license is currently specified.
