Using commodity USB software-defined radio modules as an RF debug tool

using-commodity-usb-software-defined-radio-modules1

As detailed in a previous post, we are using a TV white space (TVWS) link for the Oxford Flood Network, and as a demonstrator for Nominet’s white space database (WSDB), as part of Ofcom’s TV White Spaces Pilot.

While we were setting up the TVWS links, we wanted to be able to quickly and easily take some measurements to check that our installation was likely to work, and in case we had to debug any problems.

I had at home a small USB stick software-defined radio module, based on the the Realtek RTL2832U chipset.  These are designed as digital television (DVB-T) receivers, although they also have a mode in which it is possible to get the raw I/Q sample stream.  There’s a nice introduction written in IEEE Spectrum.  They’ve been used to receive all sorts of signals, including ADS-B (aircraft positions), AIS (ship positions), and voice & slow-scan TV from the International Space Station.

I used a fairly recent Ubuntu release (14.04 LTS, running on an old Macbook Pro) for simplicity – the packages  (_librtlsdr_ & _rtl-sdr_) are prebuilt & can be installed by via package manager, and includes the udev rules for the USB device.

The USB dongle has an MCX connector, so I needed to get a couple of cables:
– as a prototype, an MCX to Belling-Lee (TV aerial) cable, to connect to FM radio / TV aerials.
– to connect to our antennas installed in the field, an MCX to SMA (female) cable, which connected to the SMA (male) to F cable that connects our TVWS radios to their antennas.
I also used an USB extension cable, to move the radio physically away from the laptop and improve the signal-to-noise ratio.

As a test that the SDR dongle, drivers & software were set up & working, I ran _rtl_fm_, tuned to our local radio station (BBC Radio Oxford) which has a good signal strength & I knew the frequency to tune it to.  I’m still impressed that it’s now easy just to digitise a radio signal and demodulate it in software.

I also tried out GNU Radio, configuring a suitable filter/demodulator/audio sink, to produce the audio, and a waterfall & real-time spectrum display.

Scanning TV / White Space spectrum

The SDR dongle samples at up to ~3.2Msamples/second, which is plenty for the ~200kHz bandwidth of an FM radio.  But this only gives us at most a 1.6MHz bandwidth.  This clearly won’t cover a single 8MHz TV channel, let alone the whole 470-700MHz band.  Fortunately the rtl-sdr project also comes with the _rtl_power_ tool which will scan an wide frequency range by tuning to a section, integrating that & storing it before moving on the to next one.

When first looking at the results, there was a noticeable artifact, equivalent to the width of each section;  this was caused by a roll-off in response at the upper and lower ends of the band.  Fortunately _rtl_power_ has a crop (“-c”) option which discards the ends and assembles the output from the good central parts of each spectrum.

The output of _rtl_power_ is a CSV file, this can be flattened to make single list of a frequencies -> powers, which can be loaded into a spreadsheet & graphed.  That’s not something I wanted to do repeatedly in the field, so I wrote a wrapper script to take a sample, store the result, and display; I used Perl’s GD::Graph library because it was quick for me to use and I didn’t need print-quality images.  So with a single command I could grab a spectrum, store it (timestamped), generate a graph & display it.  This turned out to be very convenient when trying to use the laptop outdoors in the rain, holding an umbrella to keep the laptop dry.

Results:

Below is a representation of the spectrum captured at one of our antenna locations.   There’s a strong signal received from the local TV transmitter (Beckley, Oxford) – not surprising since it’s a high-power transmitter & only 5 or 6 miles away.  You can see the Digital Terrestrial TV (DTT) transmissions on bands 29, 31, 50, 53, 55, 57, 59 & 60.  You can also nicely see the gaps between the TV channels – the “white spaces” used by the TVWS radios.
The vertical axis (labelled “dB”) is relative, and the channels labelled on the horizontal axis are approximate & based on the analogue TV channels.

using-commodity-usb-software-defined-radio-modules2

However, here is the output from another antenna location.  We had been having difficulty getting a stable link in this location, and in this image you can clearly see why; there is a lot of noise in the bands that ought to be free to use.

Having a “second opinion” from the software-defined radio helped us to understand the problem, and convinced us that it wasn’t a problem either with our white space radios or our configuration of them.  We eventually solved the noise problem by relocating / reorienting the antenna, and got a reliable link.  The SDR tool helped us with this, too, because we could quickly try different antenna positions and orientations.

using-commodity-usb-software-defined-radio-modules3

2nd April 2015

#DTT   #DVB   #Oxford Flood Network   #RF   #testing   #TVWS   #white spaces