How to capture from an SDR on the Command Line

A few blog posts ago, I wrote about how I wanted to make a portable interface for my HackRF One. This device is known as an SDR, or software-defined radio. This device allows me to listen to a wide range of frequencies, such as 8MHz shortwave broadcasts, all the way up to 5 GHz WiFi communication! Granted, I have to use the right antenna for each case.


Anyways, last I had left off, I was in the process of trying to get a command line tool to capture from the SDR, so that I can run it on the minimal Linux interface provided on a handheld game console I bought on Aliexpress a while ago. I finally got around to finding the right command line tools for the job, and I think I found it:


I installed rx_tools, SoapySDR, libhackrf, and sox all to my Pinebook Pro. These are all on GitHub, and more importantly, build just fine with minimal dependency on the Arm64 architecture I experimented on. SoapySDR is an interface with all USB SDRs, and libhackrf gives SoapySDR the libraries needed to interface with my HackRF One. Then, rx_tools does the capturing, while piping the output to sox, to decode into an audio file:


./rx_fm -d driver=hackrf,lna=40 -M wbfm -f 99.3M -s 2048000 -r 48000 | sox -t raw -r 48000 -e signed -b 16 -c 1 - capture_99_3MHz.wav


This command will write to a .wav file, which you can then look at in something like Audacity, to process and clean up.


Now, the tricky part is going to be compiling these to a bare-bones Linux target that has libraries five years out of date. Hopefully I will have it running next week, but anticipate this task may be a little challenging…

Previous
Previous

Learning how Phone Antennas work!

Next
Next

Using breakout boards is easy with qwiic connectors!