Monday, December 1, 2014

Quick FM Radio Receiver with RTL-SDR Dongle, Gqrx, and Kali Linux

This tutorial is an introduction to the RTL-SDR dongle and some hints using it with Gqrx software.  I was able to buy one recently off of Amazon for ~$8-12.  For the amount of functionality you get with this dongle, that is a huge return on investment.  I highly recommend getting one (I may get a few more for different purposes) and get receiving.  Getting up and running is unbelievable simple and fast compared to other ways of connecting computers and radios.

For this tutorial, you need:
--RTL-SDR RTL2832U DVB-T Dongle (these things have a million names, some call them R820T. Mine has frequency range 24MHz-1766MHz) and of course its antenna
--Kali Linux (1.0.6 64-bit) LiveCD running on computer with 4GB RAM with Gqrx software
--Headphones or speakers to listen

1)  Boot up Kali Linux. Attach and setup antenna before plugging into USB port to prevent damaging USB port.  Insert RTL-SDR dongle into a USB port.  Kali should already have drivers needed for it.

2) Open up Gqrx by going to clicking on Applications tab up top, then -> Kali Linux -> Wireless Attacks -> Software Defined Radio -> gqrx.  We aren't doing any attacks here, you can use Gqrx on other Linux distros too if Kali isn't your cup of tea, Kali just happens to be a favorite of mine (I like Debian) to pentest/probe my own computers and network.

3) So Gqrx should auto-detect your dongle, Device should be "Generic RTL2832U SN" then it will be a big number.  Device string "rtl=0".  Sample rate "1500000".  LNB LO "0 MHz".  Audio Output "Default".  Sample rate "48kHz".

All these are default settings, and they work completely fine.  Don't change them unless you know what you're doing; the goal here is to get up and running as quick as possible.

4) Now you can start receiving, no GNU Radio receiver blocks to be made, this is sufficient to receive A LOT.  Click on the little power button below 'File', it should start somewhere around 144MHz (the 2 meter band for Ham radio).

5) Changing the frequency was a little tricky at first, you hover the mouse pointer over frequency number then type in what frequency you want, it then goes to next digit.  So if you're on 143.899.302 MHz and want clean 144.000.000MHz, put your mouse over the 3, type '4', then press 0 until the end.  You can use the mouse to click the frequency and lower it, but I didn't really like that feature.

You can use the mouse to grab the scanner to move it across the bandwidth on the screen (can't scroll across without changing frequency at top, at least haven't figured that out yet).  You can enable "full screen" mode at top near the save button.  On Audio tab on bottom right, main thing is to change the gain (basically volume) or record samples.  You can change the demodulation mode on the right too (main ones are AM, Narrow FM, and Wide FM; USB/LSB is more for HF frequencies which need a special up-converter to receive and same with CW modes).  You can leave the Filter setting at Normal and AGC on Fast, they both "work good"; of course tinker if you desire.  The Squelch and Noise Blanker settings I didn't mess with either as we're doing simple receiving here.

On the FFT settings, you have to be careful, I had the program crash when I was playing around with them.  You can change the color of the waterfall display and fill in the colors.  You can increase averaging so to pinpoint signals even better.  But most importantly, you can increase the Frames per Second (FPS) and the FFT size up to a max of 16384 FFT points being calculated.

##### WARNING #####

You can make the application crash if you crank these settings too high, so it's highly dependent on your system CPU and the RAM.

6) That's mostly it, all the hard work has been done for you, and this is very fun and easy!  Here's a listing of all the signals I was able to receive so far:

--Scattering of AM reception around 25MHz (near lower limit of RTL-SDR), need better antenna for them.
--My car key fob on 313.795MHz with AM, was able to see the quick burst of the protocol.  Will probably have a tutorial on capturing these signals in the future.
--Another van key fob on 307.9MHz with AM, had a weird waveform.
--NOAA weather station for my locality on 162.541MHz on Narrow FM.
--Unidentified signal on 454.3MHz using AM, UHF business band and Family Radio Service "walkie talkies"
--Unidentified signal on 480MHz using AM, TV channels
--Unidentified signal on 869.5MHz using AM, Public safety or commerical 2-way
--Pagers on 931.29MHz using AM, very pronounced signal and can be decoded, haven't done that *yet*
--Unidentified signal on 940.218MHz using AM, commerical 2-way radio
--Unidentified signal on 960MHz using AM, mixed studio-transmitter links

So there is PLENTY to do, just overwhelming amounts of things you can do with this receiver.  Have fun!

Useful Links:
https://wiki.installgentoo.com/index.php?title=Software-defined_radio
www.rtl-sdr.com
www.sigidwiki.com/wiki/Signal_Identification_Guide
gqrx.dk
http://distrowatch.com/?newsid=08246

Making the D-Link FR300 Wifi USB Dongle work in Kali Linux

Remembered I had this wifi USB dongle, and it wouldn't work before on my Linux systems, I believe it is primarily intended for Windows PC's.  Put it off for a while as I had a couple other dongles I could use but I got a sudden urge of curiousity.  Luckily I was able to find how to get it connected, looks like all that's needed is to add an ID number to a file.

[chili555] on Ubuntu Forums had the solution, which is as follows:

1) Plug in device.  Open up a terminal and type "lsusb" then enter.  You should see a D-Link wireless adapter with ID #: 07d1:3304.  After the 'd' is a number one, not a lowercase "L".  This is what we need.  For reasons unknown to me now, this ID # wasn't included in the r8712u driver file.  So we can add that.

2) Before we do that, check that you have the r8712u driver on your computer.  Kali Linux should have it, but other Linuxes might not.  Type: "modinfo r8712u" and enter.  You should get something like this and you have the driver:

 3) So let's get this done, if you aren't root, type: "sudo -i" then enter.  If you are root you don't need sudo, and type in the quotation marks of course!  Then "modprobe r8712u" and enter.  Modprobe is a pretty low level program that edits the kernel, so you have to be careful with these commands. 

Next type: "echo -n "07d1 3304" > /sys/bus/usb/drivers/r8712u/new_id" then enter.  Then exit the terminal by typing "exit" and enter. 

Now you should get life!  The LED should begin blinking, so great to see life! And even better this dongle has a very good bit rate (72 Mb/s) so is faster than my other wifi dongles.  :)

I was able to connect to my access point after this.  If problems still persist for you there may be either potentially a hardware problem or not the right driver.  It could be a really tiny, yet hard to find problem.  Don't give up!

Link to solution thread (skip to page 4 for solution):
ubuntuforums.org/showthread.php?t=2211911