Raspberry Pi and SDR, Getting started

Due to the limited availability of free time I’ve had the raspberry pi has been sitting in a box unused, and unloved for a very long time. Looking for a project that was inexpensive and didn’t require a lot of loose wires hanging around I got involved in using SDR. SDR stands for Software Defined Radio and is where traditional radio components (tuners, clocks, modulators) are handled in software. Most popular SDR uses are USB TV Sticks such as this one.

After thinking long and hard about this (okay, 2 minutes) I put in an order for this USB DVB-T stick. It was even cheaper than the previous link and the reseller was a Prime reseller so it would get here quick. I should have done more research, according to the SDR wiki what I really wanted was a chipset that used the E4000 or R820T tuner chip. The RTL software lists mine as a Fitipower FC0013 which has half the range of the E4000. No worries, you learn and you learn.

So now that I’ve got the USB stick I needed to get the software that would interface with it. With the Raspberry Pi plugged in and fully booted I proceeded to install all the necessary files.

Here are the steps I used:
Step 0. Update and upgrade your system.
# sudo apt-get update; sudo apt-get upgrade

Step 1. Install the build tools
# sudo apt-get install git cmake build-essential libusb-1.0-dev

Step 2. Download the SDR files
# cd /tmp
# git clone git://git.osmocom.org/rtl-sdr.git

Step 3. Compile and install
# cd rtl-sdr
# mkdir build; cd build
# cmake ../ -DINSTALL_UDEV_RULES=ON
# make
# sudo make install
# sudo ldconfig

Step 4. Test
# rtl_test -t
Found 1 device(s):
0: Sweex DVB-T USB

Using device 0: Sweex DVB-T USB
usb_open error -3
Please fix the device permissions, e.g. by installing the udev rules file rtl-sdr.rules
Failed to open rtlsdr device #0.

Hmm, okay appears to be a problem. Let’s test with root permissions

# sudo rtl_test -t
Found 1 device(s):
0: Sweex DVB-T USB

Using device 0: Sweex DVB-T USB
Found Fitipower FC0013 tuner
Supported gain values (23): -9.9 -7.3 -6.5 -6.3 -6.0 -5.8 -5.4 5.8 6.1 6.3 6.5 6.7 6.8 7.0 7.1 17.9 18.1 18.2 18.4 18.6 18.8 19.1 19.7
No E4000 tuner found, aborting.

Yes, definitely permissions. I did everything correct in /etc/udev/rules.d so not sure why this doesn’t work with a normal account.

The radio is on and working with Raspberry Pi. Now I can try some other tests
# sudo rtl_adsb
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 000000041

Using device 0: Sweex DVB-T USB
Found Fitipower FC0013 tuner
Tuner gain set to automatic.
Tuned to 1090000000 Hz.
Sampling at 2000000 Hz.
Exact sample rate is: 2000000.052982 Hz
*9497464c0fd9e15ec13ac63495b4;

This pipes all ADS-B traffic to the screen. And if you have the right software you can decode the string to get position, aircraft.

Now that rtl_sdr is installed we have some alternatives that can use the USB stick now.

# git clone git://github.com/MalcolmRobb/dump1090.git
# cd dump1090
# make

Then start dump1090 to get a formatted ADS-B table
# ./dump1090 –interactive –enable-agc
Hex Flight Altitude Speed Lat Lon Track Messages Seen .
——————————————————————————–

The RTL library includes a basic server that can be accessed over telnet. Now you can stick your Pi and USB stick in a remote location and process the results elsewhere.
# sudo rtl_tcp
Found 1 device(s).
Found Fitipower FC0013 tuner
Using Sweex DVB-T USB
Tuned to 100000000 Hz.
listening...
Use the device argument 'rtl_tcp=127.0.0.1:1234' in OsmoSDR (gr-osmosdr) source
to receive samples in GRC and control rtl_tcp parameters (frequency, gain, ...).

For many other tutorials and information visit the project wiki