Scanning the Spectrum at 8GHz per Second with the new HackRF Update

Recently Mike Ossmann, creator of the HackRF released version 2017.02.1 of the libhackrf, hackrf-tools and firmware on the HackRF Git. The update was developed together with the help of Dominic Spill. The full release text is pasted below:

To upgrade to this release, you must update libhackrf and hackrf-tools on your host computer. You must also update firmware on your HackRF. It is important to update both the host code and firmware for this release to work properly. If you only update one or the other, you may experience unpredictable behavior.

Major changes in this release include:

Sweep mode: A new firmware function enables wideband spectrum monitoring by rapidly retuning the radio without requiring individual tuning requests from the host computer. The new hackrf_sweep utility demonstrates this function, allowing you to collect spectrum measurements at a sweep rate of 8 GHz per second. Thanks to Mike Walters, author of inspectrum, for getting this feature working!

Hardware synchronization: It is now possible to wire the expansion headers of two or more HackRF Ones together so that they start sampling at the same time. This is advantageous during phase coherent operation with clock synchronized HackRFs. See the -H option of hackrf_transfer. Thank you, Mike Davis!

A new utility, hackrf_debug, replaces three older debug utilities, hackrf_si5351c, hackrf_max2837, and hackrf_rffc5071.

Power consumption has been reduced by turning off some microcontroller features we weren’t using.

There have been many more enhancements and bug fixes. For a full list of changes, see the git log.

Special thanks to Dominic Spill who has taken over much of the software development effort and has helped with nearly every improvement since the previous release!

One of the most interesting updates is the upgrade to hackrf_sweep. The new firmware allows you to make huge wideband scans of the entire 0 – 6 GHz range of the HackRF in under one second (8 GHz/s). In comparison the Airspy is currently capable of scanning at about 1 GHz/s (although the Airspy author has mentioned that a sweep mode could also easily be added on the Airspy).

To update the drivers and flash the new firmware in Linux:

  1. Download the new release tar at https://github.com/mossmann/hackrf/releases/tag/v2017.02.1
     
  2. Extract the tar.xz file into a folder.
     
  3. Build and install the host tools using the instructions
    at https://github.com/mossmann/hackrf/tree/master/host
     
  4. Flash the new firmware with hackrf_spiflash -w firmware-bin/hackrf_one_usb.bin (or the bin file for the Jawbreaker if you have that version of the HackRF)
     
  5. Disconnect then reconnect the HackRF.

To install Mike Ossmanns fork of QSpectrumAnalyzer which supports the new hackrf_sweep:

  1. sudo apt-get install python3-pip python3-pyqt4 python3-numpy
     
  2. git clone https://github.com/mossmann/qspectrumanalyzer
     
  3. sudo pip3 install ./qspectrumanalyzer
     
  4. This gets installed to ~/.local/bin

To generate a wideband waterfall image sweep with hackrf_sweep and Kyle Keen’s heatmap.py software:

  1. git clone https://github.com/keenerd/rtl-sdr-misc. Take note of heatmap.py inside rtl-sdr-misc/heatmap.
     
  2. Scan from 1 MHz – 3 GHz, with a bin size of 100k, LNA gain of 32 and VGA gain of 8: ./hackrf_sweep -f1:3000 -w100000 -l32 -g8 > output_data.csv
     
  3. Generate the heatmap (can take some time to complete if you have a large data file from a long scan): python heatmap.py output_data.csv heatmap_image.png

We’ve uploaded an 0-6 GHz example waterfall scan image over about 30 minutes which is available at filedropper.com/op4. The png file is 90 MB. A sample of the sweep from 400 – 600 MHz is shown below. Trunking, various telemetry and DVB-T signals are visible.

hackrf_sweep 400 - 620 MHz sample
hackrf_sweep 400 – 620 MHz sample

Some GIF examples of QSpectrumAnalyzer running the new hackrf_sweep in order from 1) 0 – 6 GHz scan, 2) 0 – 3 GHz scan, 3) 0 – 1 GHz scan, 4) 500 – 640 MHz scan, 5) 2.4 GHz WiFi Band are shown below.

 

Thanks to Robert Terzi for the initial submission.

10 comments

  1. Mario

    After about a week of trying I think (note “think”) I was able to update the firmware but it was not easy as there are no clear cut directions that seem to work. Am not that great with Ubuntu (16.04 LTS) Linux terminal mode so probably mostly my fault. Luckily I lived during the days of DOS so terminal commands are familiar, just the unique syntax takes getting used to.

    Was able to download the QSpectrum Analyzer and the wideband option, tried using it but when I hit “start” nothing happens and the RX light on the HackRF is not lit, so it’s back to the Internet for hints. Eventually the software Gods will smile down and make it work :). Feel like a mouse in a maze.

    Wondering if anyone has succeeded in getting the program to work? Thanks.

      • Rob T.

        Note the HackRF can deliver 20 million samples per second over USB which many regular intel based laptops and desktops can’t keep up with. The RPI’s USB bus is typically shared with other devices, so you will likely need to use a lower sample rate, possibly much lower, like 2 maps. Use hackrf_transfer to see what rates work without dropping samples.

        Also try watching the HackRF lesson of the series SDR with HackRF on greatscottgadgets.com/sdr

        • Bertie

          I fully agree. Whenever I see “HackRF + Raspberry Pi” (or any high throughput device) – I think about people buying a jet engine and trying to lash it onto a tricycle. I’m sure it can be done, it is just not an ideal configuration.

          If you have to drop the sample rate low enough to allow a keyboard + mouse + network + hackrf to work all sharing the one and only REAL USB 2.0 port through an internal 5 port hub builtin to the RPi. you may as well be using a RTL-SDR device.

    • Jaap

      This is great. Some things I had to do in addition to get it running:
      -hackrf_info libraries not found error solved by:
      –sudo apt-get install libhackrf-dev
      -hackrf_info: hackrf_open() failed: HACKRF_ERROR_LIBUSB (-1000) solved by:
      –disabling USB autosuspend, in my case set by TLP that’s installed on my laptop
      –edit “/etc/default/tlp”, change “USB_AUTOSUSPEND=1” to “”USB_AUTOSUSPEND=0”

      Cheers, Jaap

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>