Thursday, 16 April 2015

SDR: Software Defined Radio

Having read a couple of articles on SDR (Software Defined Radio) I seem to have accidentally clicked the "Add to Basket" button, and ending up with some cheap hardware.

The required software is even cheaper than cheap. Its free!

So instead of doing important stuff like fixing the car or protecting our blue tits from sparrowhawks, I've allowed myself to be distracted.

I'm going to describe how to start playing with SDR for 10 quid or less using a Linux based system: Lubuntu 14.10


Using some freely available software, it is possible to use a cheap USB TV dongle as an SDR to cover a wide frequency range.

In my case I paid £10 for a Keedox DVB-T USB TV stick. Which gives me a frequency range from 24MHz to 1.766GHz.

The Hardware

My Keedox kit included a Windows software disk, a remote controller, an aerial and cable, in addition to the important bit, the USD dongle.


Clearly the Windows disk is no use for Linux.

There are 4 tasks involved in preparing a Lubuntu computer:-
  • Installing software: SDR application GQRX v2.2.x
  • Identify USB device: using lsusb
  • Disable the driver
  • Create udev rules

Install software
Using Synaptic will help with dependencies, and give you a record of what has been installed (and when) via the History feature.

Select and install:-

... and accept all dependencies.

Identify Device
Plug in your TV dongle.
In a terminal type:-

...which should give you something like this:-

steve@steve-X401A1:~$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 04f2:b2e3 Chicony Electronics Co., Ltd
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Note the Vendor and product ids  for the DVB-T, which in my case are 0dba:2838

Disable the driver
Open file manager as root by typing in a terminal:-
sudo pcmanfm

Naviagte to:-
...and add these 2 lines at the end of the file:-

blacklist dvb_usb_rtl28xxu

Create udev rules
Navigate to:-

Either create a new file or (as I did) open an existing file then save it with a new name: 30-sdr.rules

Now edit this file to look like this:-
ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", SUBSYSTEM=="usb", GROUP="adm", MODE="0666", SYMLINK+="rtl_sdr"

...where the idVendor and idProduct matches those found by you using lsusb.

Now reboot.

Let's test it!

Connect the short antenna to the USB dongle, and in a terminal type:-

..which should (after a few seconds) load your gqrx sdr receiver.

Click on the power icon to run the receiver, and then tune in a station on the 88-108MHz FM broadcast band (e.g. click on a digit to select, then use up/down arrows to change frequency, and left/right arrows to select another digit).

BBC Radio 2
You may need to advance the LNA Gain (via "Input Controls" view) to approx 30dB and set Mode to WFM (via "Receiver Options" view).

If you are in a very poor reception area, another test is to set the receiver to around 433MHz and operate the buttons on your car keys.

You can also tune into any nearby airport traffic by searching the internet for the appropriate frequencies.

We live a few miles from Gatwick, so by setting the SDR to 124.225MHz I can listen to the control tower. But the short aerial supplied is not great at this frequency.

Size matters

A radio wave is a bit like the wave on a pond.

A frequency represents the number of complete cycles which occur in one second. So for Gatwick tower the frequency is 124,225,000 cycles per second, which is the same as 124,225,000Hz or 124,225kHz or 124.225MHz.

Since the speed of light (and radio waves) is approximately 300,000,000 metres/second, we can calculate the distance (say) between the peaks of this wave:-

300/124 = 2.4m the wave length at 124MHz is 2.4m

Simple "stick" aerials work best when their length relates to the wavelength of the signal of interest. This means that an aerial works best when its length is 1 wavelength, 1/2 wavelength or 1/4 wavelength. In the case of 124MHz (2.4m) this means: 2.4m, 1.2m, or 0.6m.

So to give my SDR the best chance of pulling signals from Gatwick Tower out of the ether, I cut a 600mm length of stout wire and connected it to the aerial lead.

there is a slight frequency error: 124.2199MHz rather than 124.225MHz

Notice that the mode is now set to AM as this service uses amplitude modulation, rather than frequency modulation.

Listening to aircraft traffic does not float-my-boat. But I left this running for a few hours to gauge frequency stability, and it looks very stable.

SDR on Raspberry Pi

These instructions should work on any recent Debian system, such as a Pi-2 running Raspbian Jessie. However, although I could get the interface to display, the SDR crashed due to problems with Pulseaudio.

I'm sure this is fixable, but I wasted a couple of hours looking at it, but got nowhere.

SDR on the internet

Another way to use SDR is via the internet. There are a number of sites which allow you to operate a remote you don't even need your own dongle!


This web SDR can be used to listen to the 160m amateur band (also known as Top-Band)...
...which is what fired up my interest in electronics and communications, way back in the early 1960s.

No comments:

Post a Comment