HackRF Tools — HackRF documentation [Link]
html
/ HackRF Tools
HackRF Tools
Great Sco� Gadgets provides some commandline tools for interac�ng with HackRF.
• hackrf_info Read device informa�on from HackRF such as serial number and firmware
version.
• hackrf_transfer Send and receive signals using HackRF. Input/output files are 8-bit signed
quadrature samples.
• hackrf_sweep, a command-line spectrum analyzer.
• hackrf_clock Read and write clock input and output configura�on.
• hackrf_operacake Configure Opera Cake antenna switch connected to HackRF.
• hackrf_spiflash A tool to write new firmware to HackRF. See: Upda�ng Firmware.
• hackrf_debug Read and write registers and other low-level configura�on for debugging.
hackrf_sweep
Usage
[-h] # this help
[-d serial_number] # Serial number of desired HackRF
[-a amp_enable] # RX RF amplifier 1=Enable, 0=Disable
[-f freq_min:freq_max] # minimum and maximum frequencies in MHz
[-p antenna_enable] # Antenna port power, 1=Enable, 0=Disable
[-l gain_db] # RX LNA (IF) gain, 0-40dB, 8dB steps
[-g gain_db] # RX VGA (baseband) gain, 0-62dB, 2dB steps
[-w bin_width] # FFT bin width (frequency resolution) in Hz, 2445-5000000
[-1] # one shot mode
[-N num_sweeps] # Number of sweeps to perform
[-B] # binary output
[-I] # binary inverse FFT output
-r filename # output file
Output fields
date, time, hz_low, hz_high, hz_bin_width, num_samples, dB, dB, ...
Running hackrf_sweep -f 2400:2490 gives the following example results:
Date Time Hz Low Hz High Hz bin width Num Samples
1 of 2 7/6/2024, 10:32 PM
HackRF Tools — HackRF documentation [Link]
Date Time Hz Low Hz High Hz bin width Num Samples
2019-01-03 11:57:34.967805 2400000000 2405000000 1000000.00 20
2019-01-03 11:57:34.967805 2410000000 2415000000 1000000.00 20
2019-01-03 11:57:34.967805 2405000000 2410000000 1000000.00 20
2019-01-03 11:57:34.967805 2415000000 2420000000 1000000.00 20
2019-01-03 11:57:34.967805 2420000000 2425000000 1000000.00 20
2019-01-03 11:57:34.967805 2430000000 2435000000 1000000.00 20
Each sweep across the en�re specified frequency range is given a single �me stamp.
The fi�h column tells you the width in Hz (1 MHz in this case) of each frequency bin, which you
can set with -w . The sixth column is the number of samples analyzed to produce that row of
data.
Each of the remaining columns shows the power detected in each of several frequency bins. In
this case there are five bins, the first from 2400 to 2401 MHz, the second from 2401 to 2402
MHz, and so forth.
2 of 2 7/6/2024, 10:32 PM