SDR Radio

Software Defined Radio - Ubuntu Linux

What is SDR Radio?


SDR (Software Defined Radio) is a system whereby components of a radio that are normally implemented with physical hardware (modulators/demodulators amplifiers etc..) are instead implemented by means of software running on a computer. A simple and cheap way of creating a SDR is to use a DVB-T dongle. DVB-T dongles that are based on the Realtek RTL2832U chip can be used. These dongles can then be used to receive and decode a very wide range of frequencies. In the example below we will install "gqrx" which is a SDR front end "dump1090" which is used for processing ADS-B aircraft signals
(see SDR Radio Hardware ).



What do you need?


Basically all that is required is a computer, decoding software and a DVB-T+DAB+FM USB dongle


PC - Computer


In the example that follows I have used a laptop running Ubuntu 13.10 as the base for installing the decoding software:



$ uname -r
3.11.0-19-generic

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 13.10
Release:    13.10
Codename:    saucy

Installation Packages


Before we begin installing our decoding radio software we will need to install the following components. Simply issue the following command from the command line:

sudo apt-get install git cmake libboost-all-dev libusb-1.0-0-dev python-scitools portaudio19-dev -y


gqrx - Software Defined Radio


"gqrx" is a Software Defined Radio that supports a wide range of devices. In this example we will be using the low cost RTL2832U based DVB-T dongles.

gqrx has the following features:

  • Discover devices attached to the computer.
  • Process I/Q data from the supported devices.
  • Change frequency, gain and apply various corrections (frequency, I/Q balance).
  • AM, SSB, FM-N and FM-W (mono and stereo) demodulators.
  • Special FM mode for NOAA APT.
  • Variable band pass filter.
  • AGC, squelch and noise blankers.
  • FFT plot and waterfall.
  • Record and playback audio to / from WAV file.
  • Spectrum analyzer mode where all signal processing is disabled



Installing gqrx


To install "gqrx" we need to add a "ppa" (Personal Package Archive) to our system. To do this we simply issue the following commands:

sudo add-apt-repository ppa:gqrx/releases
sudo apt-get update
sudo apt-get install gqrx

Once the relevant packages/software have been installed, you now insert your USB dongle. You can run a quick test to confirm that your system can see the USB device. Issue the command :

rtl_test -t

If you see the statement "Kernel driver is active, or device is claimed by second instance of librtlsdr", then don't panic, simply issue the command:

sudo modprobe -r dvb_usb_rtl28xxu

Basically the newer kernel that comes with Ubuntu already contains a DVB driver, however, we do not want to use this. The above "modprobe -r" command unloads this from the kernel, however for a permanent solution you will need to create the following file:



$ cd /etc/modprobe.d/
$ vi ban-rtl.conf

Now add the following line:

blacklist dvb_usb_rtl28xxu

Save your changes. This change will come into effect when the system is re-booted. The name of the ".conf" file is not important as long as the file ends with ".conf".



sdrradio@sdr-radio:~$ rtl_test -t
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM

Kernel driver is active, or device is claimed by second instance of librtlsdr.
In the first case, please either detach or blacklist the kernel module
(dvb_usb_rtl28xxu), or enable automatic detaching at compile time.

sudo modprobe -r dvb_usb_rtl28xxu

sdrradio@sdr-radio:~$ rtl_test -t
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 
Sampling at 2048000 S/s.
No E4000 tuner found, aborting.

From the above we can see that our USB dongle has been recognised. (Found Rafael Micro R820T tuner)


Starting gqrx - Software Defined Radio


To start "gqrx" simply type gqrx at the command line. Hopefully now you should see a screen similar to the one below:


Linux gqrx config device

Your device should normally be found automatically. If not, select it from the pull down list. In this example the device in use is a "Realtek RTL2838U". Simply click "OK" to activate the main control screen (see below)


Linux gqrx control screen

In the above example I have selected a frequency of a local radio station on the FM band. The spike is an indication that a signal is present. The image below the spike shows a "waterfall" view of the transmission. A waterfall display is a graphical representation of received signals across a frequency range. The signals are colour coded giving an indication of amplitude or strength over a period of time. A waterfall display is useful for spotting weaker signals. The frequency can be changed by clicking on the numbers. Modulation mode can be changed by clicking on the "mode" menu" (AM/FM/WFM/NBFM/USB/LSB/CW).


What can I receive?


The range of frequencies that can be received by the dongle vary from model to model. The model I am testing here covers 24MHz through to 1.766GHz. The table below is a quick guide to what you may be able to receive (Voice). For a more comprehensive list of frequencies search for "scanner frequencies" or "Radio Frequency Guide" in the above search box:


Description - Mode Frequency
12m Amateur Radio (AM/FM/CW/USB/LSB) 24.890 - 24.990MHz
CB Radio (AM/FM/USB/LSB) 26 - 28MHZ
10m Amateur Radio (AM/FM/CW/USB/LSB) 28.400 - 29.700MHz
6m Amateur Radio (AM/FM/CW/USB/LSB) 50 - 52MHZ
Civil Airband (AM) 117.975 - 136.000 MHz
2m Amateur Radio (AM/FM/CW/USB/LSB) 144 - 146MHZ
Marine Band (FM) 156 - 163MHz
PMR (Private Mobile Radio) (NFM) 163 - 185MHZ
Military Airband (AM) 200 - 399MHZ
70 cm Amateur Radio (AM/FM/CW/USB/LSB) 430 - 440MHZ
PMR and Security (NFM) 440 - 470MHZ

Installing RTL_SDR components


Although the "gqrx" software installed many of the components. We still need to install the following components.

Issue the following command:

sudo git clone git://git.osmocom.org/rtl-sdr.git

This command will download the source files into a directory: "~/rtl-sdr"



sdrradio@sdr-radio:~$ sudo git clone git://git.osmocom.org/rtl-sdr.git
Cloning into 'rtl-sdr'...
remote: Counting objects: 1582, done.
remote: Compressing objects: 100% (676/676), done.
remote: Total 1582 (delta 1157), reused 1213 (delta 898)
Receiving objects: 100% (1582/1582), 340.30 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1157/1157), done.
Checking connectivity... done

Now that we have downloaded our source code, we will need to compile this code:

A directory called "rtl_sdr" will have been automatically created for us within our home area (/home/userid/rtl_sdr). Next we need to Change to the "rtl_sdr" directory below and build our resources:


Commands issued:


$ cd rtl-sdr/
$ sudo mkdir build
$ cd build
$ sudo cmake ../
$ sudo make
$ sudo make install
$ cd ~
$ sudo cp ~/rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/
$ sudo ldconfig

Installing Dump1090 - ADS-B Software


What is ADS-B?


ADS-B stands for Automatic Dependent Surveillance Broadcast. This technology is used by aircraft to transmit their location and speed to Air Traffic Controllers (ATC). For more information on ADS-B see the wiki page wiki ADS-B

Dump1090 is the software used for displaying a graphical representation of aircraft on a google map. The "1090" in the name relates to the frequency that aircraft transmit their positional information on (1090MHz).

First we need to issue the following command to download the source code:

$ sudo git clone git://github.com/antirez/dump1090.git



sdrradio@sdr-radio:~$ sudo git clone git://github.com/antirez/dump1090.git
Cloning into 'dump1090'...
remote: Reusing existing pack: 240, done.
remote: Total 240 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (240/240), 566.58 KiB | 293.00 KiB/s, done.
Resolving deltas: 100% (132/132), done.
Checking connectivity... done

Next issue the following commands:

$ cd dump1090/
$ sudo make

Output from above commands:



sdrradio@sdr-radio:~$ cd dump1090/
sdrradio@sdr-radio:~/dump1090$ sudo make
gcc -O2 -g -Wall -W `pkg-config --cflags librtlsdr` -c dump1090.c
gcc -O2 -g -Wall -W `pkg-config --cflags librtlsdr` -c anet.c
gcc -g -o dump1090 dump1090.o anet.o `pkg-config --libs librtlsdr` -lpthread -lm

Hopefully you would have seen some output similar to the above.


Testing ADS-B Decoding


To run our installed software we can issue the command:

./dump1090 --interactive

You should now see a screen similar to the one below:


Linux dump1090 ADS-B

The screen shows Aircraft flight information such as Altitude, Speed, Latitude and Longitude.

If you wish to view the above aircraft displayed on a google map, then we can run the following command instead. (To terminate the above process, CRTL + C):

./dump1090 --interactive --net

Open your browser and type in the following address: localhost:8080

You should now see an image similar to the one below. The number of aircraft will vary depending on how busy the traffic is near you and also how strong your reception is. Ideally, you would need to place your antenna close to a window or outside for best results. The small antenna that comes with the dongle should work quite well if you place it on a metal plate or metal tin. Generally you can track aircraft within a 100 mile radius (161 km).


Linux dump1090 ADS-B