August 16, 2014

I finally got my HackRF and I have a Mac… Now what?

Categories: SDR

hackrf-mac

If you are reading this I can probably imagine what’s going on: You’ve been waiting for a year to get your HackRF and, now that you finally have it, you don’t know what to do with it. The problem is that you have  Mac and – surprise surprise – the only “easy to use” programs (SDR# anyone?) are unfortunately not available for your operating system.

Is there anything you can do? There surely is… Let’s get started.

First of all you need to install MacPorts. If you are already using Homebrew or Fink I’m sorry, you still need MacPorts. If, instead, you don’t even know what MacPorts is just ignore that for now. You will have all the time in this world to find out but, just for now, you don’t really need to know much about it.

After the install is complete, open up a Terminal and run the following commands in it:


sudo port install gr-osmosdr +full
sudo port install gr-fosphor

The install will take hours to complete, so you can open a beer. Maybe two. Hopefully the whole process should complete without incident (I tried on different Macs and so did a few friends and we never had a problem). Once finished, run hackrf_info:


hackrf_info
Found HackRF board.
Board ID Number: 2 (HackRF One)
Firmware Version: git-44df9d1
Part ID Number: 0x00594f49 0x00594f49
Serial Number: 0x00000000 0x00000000 0x4xx 0x2xx

If the output of the above command looks like mine (I censored my own serial number) that means your Hackrf is ready to be used. Let’s try:


osmocom_fft -F

After the application loads up, you have a nice looking Spectrum Analyzer that goes from 30 to 7GHz. Play with it. The very first test I have done with it was visualizing the invisible fight that goes on between you Microwave Oven and your Wi-Fi when you prepare Pop-Corn as you surf the net:

In reality, the minimum frequency that you can select (30 MHz) is erroneous. In facts, the HackRF has been reported to be working quite well all the way down to 1 MHz. In order to achieve that, you might patch line 333 of osmocom_fft

from:


minimum=self[FREQ_RANGE_KEY].start(),

to:


minumum=0,

The second thing I’d like you to experiment is some sort of a “copy and paste” of the radio spectrum. Let’s say you want to save whatever is going on between 431and 433 MHz, all at once. The hackrf_transfer utility can do that:


hackrf_transfer -r test.bin -f 432000000 -s 2000000

Subsequently you could retransmit the same content  on the same band (or on any other!):


hackrf_transfer -t test.bin -f 432000000 -s 2000000

Here is a demostration:

Another handy tool that is available on the Mac is obviously Gqrx. First you need to install it:


sudo port install Gqrx

Then you can launch it:


Gqrx

Unfortunately Gqrx it still is way less smooth and polished than SDR# or HDSDR but, at least for the time being, if you use a Mac that’s as close as we can get:

Gqrx

Finally, last but not least, GNU Radio.

GNU Radio is the most prominet Open Source SDR framework, an extremely powerful tool that allows you to create any sort of modulators, demodulators and (with the help of your handy HackRF One) also to transmit and receive basically anywhere you want. The possibilities are endless. Is GNU Radio difficult? Very. Is it a good opportunity to lean more? Extremely. As an example, I adapted a generic USB transmitter written by Alex OZ9OEC for the UHD (another SDR device) to work with the HackRF. Here is a screenshot of gnuradio-companion once my modified grc file has been loaded:

gnuradio-usb2

here is a screenshot of the actual transmitter while it is running:

gnuradio-tx2

And here is another demonstration:

This is as far as I could get in just two days. More to follow!

comments powered by Disqus