An SDR Dongle

I actually could afford a new radio! A whole $20!

I've been drooling over software defined radios for a few years. I'm glad I waited instead of spending hundreds of dollars on technology that is still in its infancy. Somebody in the Jove group mentioned these and someone else bought something similar from somebody selling on Amazon. This comes from NooElec who also sells on eBay, but anyway it was only $19.95 with an antenna and a remote.

Things are changing fast so there's a lot of misinformation out there. It took me about a week to get it working at all, and so far it's only working in Windows. I've had $20 worth of fun with it already, but I'm not sure how practical it is for daily use mostly because it ties up a computer. My newest computer is 8 years old and it's the only one I've got with USB2.

Here's a screenshot of it running through SDR# on the 2 meter ham band. I'm listening to a QSO on a local repeater (where the red cursor line is) but another repeater in the opposite direction is seriously overloading the front end. Most of the peaks you see here go away when there's a break in the conversation and it unkeys. I was about ready to contact somebody about the spectral purity of the repeater until I considered how strong it is. I can see the mountain it's on about 20 miles away and it comes in on an HT with no antenna plugged into it. I'm listening on a 2 meter Slim Jim antenna in the attic so there's some gain there too.

I'm not having any trouble with the interference being close because I can turn down the filter width. I've already seen intermod happen several times from broadcast band FM transmitters though. It could use a preselector, but the frequency coverage is 24 to 1700 MHz, so it will need to be custom designed. Also the frequency is off a little: the repeater I'm listening to is on 146.985, not 146.97 MHz. I hear they drift too, but I haven't experienced that yet.

The biggest problem I've had is with RF trash from the computer(s) since I'm running 3 computers within about 5 feet. The dongle is plugged into a 6 foot USB exension cord, which let me move it about 4 feet away from the computer and stuff it into a coffee can for some RF shielding. On somebody's suggestion, I took the antenna that came with it and cut the plug off so I could solder on a chassis mount BNC jack to connect to remote antennas. The connector going into the dongle isn't anything I can match easily. I'm using antennas in the attic.

These dongles were designed to receive TV on, which they probably still do but I haven't any idea what to use for a driver or software in general. I don't care about that: I haven't watched anything on TV in months. Above is a screenshot from SDR Sharp which doesn't drive the dongle directly. There's a little command line program called rtl_tcp which is directly driving the USB connection and sending data out a TCP/IP connection. Most of this stuff could work with the dongle in one computer and controlled from another over a network.

But of course listening to the radio on them is just another use for them, and here's another. An increasing number of aircraft transmit position information by a system called ADS-B, which is easy to receive. It's transmitted on 1090 MHz and I'm using my 2 meter Slim Jim again here to receive it. The program doing the receiving is called ADSBSharp and it transmits over a TCP/IP connection to another program called Adsbcope that actually displays and plots on the screen. If you want to download Adsbcope, it's contained in a file labeled something like "ZIP-File with all relevant data", just get the latest one listed. ADSBSharp is by the same guy who writes SDR# and it requires the same .NET framework 3.5 from Microsoft, which is a 200+ meg download. I really wish he had steered clear of Microsoft products. And the .NET frameworks aren't interchangeable: if you've got 4.0 that isn't good enough, you have to have 3.5. There's another program called RTL1090 which will also interface to the dongle and output AVR over a TCP/IP connection to drive Adsbcope. I think it's Microsoft-free.

The simple way to start rtl1090 and adsbscope is to double-click on the rtl1090 exe file (later make shortcuts), then double click on adsbscope to open it. In adsbscope, go to other -> Network -> Network Setup, click the BEAST preset button then the Close button. Then click other -> Network again and check the "RAW data client active" box. Then click the Start button in rtl1090. Rtl1090 outputs BEAST format by default, and adsbscope understands it.

It's also possible to start rtl1090 with an /AVR flag on its command line and fiddle in adsbscope until you get it seeing the AVR (text) format (not binary) from rtl1090, but somewhat less predictable in starting.

Either method has to be done each time you start the programs up since they don't store this setup.

ADSBSharp sends AVR and Rtl1090 can, but if you want to check that they're working you can telnet to the IP address and port number like "telnet 127.0.0.1 47806" or in a web browser visit http://<ip>:<port>like http://127.0.0.1:47806. You should see something like this (at 5 - 15 or more lines per second):

*25C051721BEBDD;
*83019BAE5F1920860E95AC716C0C;
*96124C48E436555A50E0C4549AC4;
*92AE808EF680D7838E221FC22962;
*2000101F33FCC6;
*898C864389B9E010D3FCB88D4E4E;

If you want to listen to pilots talking to towers while you're watching this and you've got a scanner that covers aircraft frequencies (most do), see Airnav to get frequencies for airports in your area.

There's another program called Zadig which is actually a USB driver and you'll need it for either the SDR or the Adsb stuff. This is only under Windows, Zadig is actually libusb 1.0 with a Windows wrapper. You'll want the bigger (5 meg) Windows version probably. There are some instructions here.

Another organization you should be aware of is Osmocom which can be trusted since it's a non-profit organization, but they have feet in both the Unix and Windows worlds. There's also a list of compatible devices since there are so many that do almost the same thing. They all use the RTL2832U chip, but the tuner chips vary, so they work slightly differently from a software standpoint, and they cover slightly different frequency ranges. They were all made as TV tuners though so the middle part of the range is common to all.

Osmocom produced a set of low level command-line programs including rtl_tcp that feeds raw samples out over a TCP/IP connection. That's not the same thing that RTL1090 and Adbharp do. Those output the AVR protocol for tracking planes which looks like a bunch of hexadecimal. There are two degrees of this information and so far most planes in the US don't transmit enough to be tracked. Notice that there are 49 planes in the table at the right above but only 10 in the position plot at the left. I think when the tracking line turns to a dotted line it's a projected position based on the last known position, speed and heading. The osmocom package now includes rtl_adsb, I haven't experimented with it.

The left picture above is a recommended antenna for monitoring ADSB transmissions on 1090 MHz. It's a collinear, usually made of wire. The coax center lead goes to the antenna, the shield goes to the base, which can be a disc like a base or just more wires in a circle, like a ground plane. 130 mm is about 5-1/8 inches, so this is about 16 inches tall. Image stolen from Sprut. The right picture is the dongle, image stolen from the seller.

Oh, and in case you're curious, this is all moving so fast that nobody has made any efforts to block cell phone reception. But it's almost all trunked, which means that you might hear a couple seconds of a conversation then it jumps to another frequency. There's really nothing to hear anyway.

Well, that's it so far, just Windows. I'm really hoping to get this going in Gnuradio but I'm stuck on wxPython and pyqt4. Without at least one of them I'll have no GUI interface. Gnuradio is really the most flexible application, since it's a framework within which you can define your own decoding schemes. For example GPS is also within the frequency range covered. There's a lot of math involved though. I've been spending too much time playing in Windows, which is pretty much a dead end.


Gnu Radio (unix)

Gnu Radio is easily the most versatile application imaginable because it's a toolkit for building applications. Most don't really require any coding since that's all been neatly packaged. You just drag blocks onto the screen, set the properties you want, connect them together, and save. When you click Generate it creates a program written in Python that you can run within Gnu Radio Companion (an IDE) or outside it.

I've got my installation mostly working, although I'm having trouble getting sound out of it. I can see by the scope that it's making sound, but nothing's coming out of my speakers. I've started doing a tutorial, but stopped when I found nothing coming out, and added things to it to try to diagnose.

At the left side of the screen is the main area for building things. At the right, under Blocks, are the building blocks you can choose from. You expand the category you're looking for, find the block you want, then drag it into the left side where you want it. Double -click on it to set properties. Next click on an "out" tab then click on the "in" tab you want to connect to and a line appears. The tabs are color-coded by variable type, the orange ones here are floats. Many blocks can use different types, or there are conversion blocks available too if you need them.

One nice thing about all this is that you don't have to know what you're doing. There are published examples, so it's perfectly possible to download one and use it or start experimenting from there. You can download a radio. Just make a backup before you start changing it in case you break something.

This is the flow diagram in the last picture actually running. Notice that the audio_sink there is grayed out because I set it to disabled. If I enable it this doesn't run because there's a sound problem. I'm generating an audio signal as a 1 KHz cosine wave, feeding it through a throttle block so it doesn't cause overflows by going too fast, then I feed it to a scope, an FFT, a wave file, and (disabled) to the speaker (the audio_sink).

From the tree of blocks at the left side of the screen I expanded all the branches and copied out the names of all the blocks below so you can see what there is to work with. One advantage of getting as much stuff working as possible when you start is so that there's a better chance of downloaded examples having everything they need to work.

For example I've got an RTL dongle, but if the flow diagram I downloaded uses a FunCube, there's a blank spot where the FunCube would appear because I didn't install that driver. I can drop in either OsmoSDR or RTLSDR sources and connect them instead.

Most of the working low level code inside the blocks is written in C++, but clicking Generate in the Gnuradio-companion generates Python which ties them all together. You can find one set of tutorials here, written by Sharlene Katz at csun.edu. Don't ask me questions about the math involved, I don't understand any of it, yet at least. You can probably get this to work under Windows, but you'll need compilers, and almost everything for Windows costs money. For unix it's free. If you're new to unix, try Ubuntu Linux. I got frustrated with it and replaced it in a week because it keeps you away from all the nitty-gritty details. Debian's a good step up if you find yourself in that boat, but I don't really like Linux at all, I prefer OpenBSD. It's all free.

Building Gnuradio under Windows is "not officially supported", but see this wiki page if you're interested in trying. If you're using a UHD (Ettus hardware) you can get a prebuilt executable for XP, Vista, 7 at Ettus. But much of Gnuradio is done in Python, so you'll want the right version of that too. It's a mess I'd rather stay away from. It isn't one program, it's maybe hundreds of them and they all have to work together. It's hard enough under anything non-Linux. You can use a viariety of compilers, there's an effort to build it with tools that are native to Windows. I'm glad to be retired from the Windows world.

But of course building or just installing things under unix isn't easy. I like to build everything from source code, then I can study bits of the source to see how things are done. Almost nothing is a stand-alone program: almost all programs use routines in libraries that may be part of other programs. In the long run once you've got enough libraries installed it isn't so bad, so I typically install a few big messy programs like The Gimp and Firefox first, that gets a lot of it over with. If something needs a language like Python you can find yourself installing database or imaging libraries for what seems like forever and it's nothing close to what you're trying to do. Get a big hard drive, accumulate lots of stuff, and try hard to not upgrade more than every few years. When a hard drive's warranty runs out is a good time to replace it and upgrade. Put the old one on the shelf in case you need to hook it back up and copy off something you forgot. Once you haven't needed anything from it in a few years, make it part of a RAID.

There's an archive of Gnu Radio projects at CGRAN and Gnuradio itself is at gnuradio.org. gr-air-modes Does ads-B.

The Standard Blocks
Sources
Constant Source, Signal Source, Noise Source, Vector Source, Random Source, GLFSR Source, Null Source, File Source, TCP Source, UDP Source, Wav File Source, Message Source, Message Burst Source, Pad Source, Virtual Source, Audio Source, OsmoSDR Source, RTLSDR Source
Sinks
Vector Sink, Null Sink, File Sink, TCP Sink, UDP Sink, Wav File Sink, Message Sink, Pad Sink, Virtual Sink, Tag Debug, Audio Sink
Operators
Add, Subtract, Multiply, Divide, Log10, Transcendental, Add Const, Multiply Const, And Const, Not, And, Or, Xor, Max, Argmax, RMS, Integrate, Complex Conjugate, FFT, Log Power FFT, Vector Insert, Endian Swap
Type Conversions
Complex to Arg, Complex to Mag, Complex to Mag^2, Complex to Real, Complex to Imag, Complex to Float, Float to Complex, Float to Int, Float to Short, Short to Float, Short to Char, Int to Float, Float to Char, Char to Float, Char to Short, Float to UChar, UChar to Float, Complex to IShort, IShort to Complex
Stream Conversions
Interleave, Deinterleave, Streams to Stream, Stream to Streams, Streams to Vector, Vector to Streams, Stream to Vector, Vector to Stream, Stream to Vec Decim, Stream Mux, Burst Tagger
Misc Conversions
Unpacked to Packed, Packed to Unpacked, Unpack K Bits, Pack K Bits, Chunks to Symbols, Map
Synchronizers
Polyphase Clock Sync, MSPK Sync, PLL Carrier Tracking, PLL Freq Det, PLL Ref Out, PN Correlator, Simple Correlator, Simple Framer, Packet Decoder, Packet Encoder
Level Controls
Detect Peak, Peak Detector, Peak Detector2, Sample and Hold, AGC, AGC2, Feed Forward AGC, Mute, Simple Squelch, Standard Squelch, Power Squelch, CTCSS Squelch, Threshold
Filters
Low Pass Filter, High Pass Filter, Band Pass Filter, Band Reject Filter, Root Raised Cosine Filter, Decimating FIR Filter, Interpolation FIR Filter, FFT Filter, Frequency Xlating FIR Filter, IIR Filter, Filter Delay, Channel Model, Synthesis Filterbank, Analysis Filterbank, Polyphase Resampler, Polyphase Channelizer, Polyphase Synthesizer, Single Pole IIR Filter, Hilbert, Goertzel, Rational Resampler Base, Rational Resampler, Fractional Interpolator, Keep 1 in N, Keep M in N, Moving Average, IQ Comp, DC Blocker, FFT Filter, Decimating FIR Filter, Filter Delay, Fractional Interpolator, Frequency Xlating FIR Filter, Hilbert, IIR Filter, Interpolationg FIR Filter, Polyphase Arbitrary Resampler, Polyphase Channelizer, Polyphase Decimator, Polyphase Interpolator, Polyphase Synthesizer, Rational Resampler Base, Single Pole IIR Filter, Channel Model
Modulators
VCO, Frequency Mod, Phase Mod, Quadrature Demod, CPFSK, Differential Phasor, Differential Encoder, Differential Decoder, WBFM Transmit, WBFM Receive, NBFM Transmit, NBFM Receive, AM Demod, FM Demod, FM Deemphasis, FM Preemphasis
Error Correction
Trellis
Trellis Encoder, Trellis Metrics, PCCC Decoder Combo, PCCC Decoder, PCCC Encoder, Trellis Permutaion, SCCC Decoder Combo, SCCC Decoder, SCCC Encoder, SISO Combo, SISO, Viterbi Combo, Viterbi
Encode CCSDS 27, Decode CCSDS 27
Line Coding
Scrambler, Descrabler, Additive Scrambler
Probes
Probe Avg Mag^2, Probe Density, Probe Signal
Variables
Variable, Variable Config, Function Probe, Parameter
Misc
Note, Import, Throttle, Delay, Repeat, Selector, Valve, Error Rate, Head, Skip Head, Kludge Copy, Copy, Nop, XMLRPC Server, XMLRPC Client
Digital
Additive Scrambler, Binary Slicer, Bytes to Symbols, Chunks to Symbols, Clock Recovery MM, CMA Equalizer, Constellaton Decoder, Constellation Receiver, Correlate Access Code, Costas Loop, Descrambler, FLL Band Edge, GLFSR Source, Kurtotic Equalizer, LMS DD Equalizer, Map, MPSK Receiver, MPSK SNR Estimator, Polyphase Clock Sync, PN Correlator, Probe Density, MPSK SNR Estimator Probe, Scrambler, Differential Decoder, Differential Encoder, Differential Phasor, Framer Sink 1, Packet Sink, Simple Framer
Digital Modulators
DPSK Mod, DPSk Demod, PSK Mod, PSK Demod, QAM Mod, QAM Demod, GMSK Modulator, Continuous Phase Modulation, GMSK Mod, GMSK Demod
OFDM
OFDM Mod, OFDM Demod, OFDM Cyclic Prefixer, OFDM Frame Acquisition, OFDM Insert Preamble, OFDM Sampler, OFDM Sync PN
FFT
FFT, Goertzel
Vocoders
Alaw Audio Decoder, g711 alaw Audio Decoder, CODEC2 Audio Decoder, CODEC2 Audio Encoder, CVSD Audio Decoder (Raw Bit-Level), CVSD Audio Encoder (Raw Bit-Level), CVSD Decoder, CVSD Encoder, g721 Audio Decoder, g721 Audio Encoder, g723_24 Audio Encoder, g723_24 Audio Decoder, g723_40 Audio Decoder, g723_40 Audio Encoder, Ulaw Audio Decoder, Ulaw Audio Encoder
HOWTO
Square2, Square
NOAA
HRPT Decoder, HRPT Deframer, HRPT PLL
WX GUI
WX GUI Notebook, WX GUI Check Box, WX GUI Chooser, WX GUI Slider, WX GUI Static Text, WX GUI Constellation Sink, WX GUI FFT Sink, WX GUI Histo Sink, WX GUI Number Sink, WX GUI Scope Sink, WX GUI Terminal Sink, WX GUI Waterfall Sink
Pager
FLEX Deinterleave, FLEX Synchronizer, 4-Level Slicer/DCR
QT GUI Widgets
QT GUI Check Box, QT GUI Chooser, QT GUI Entry, QT GUI Label, QT GUI Range, QT GUI Sink, QT GUI Tab Widget, QT GUI Time Sink

AB1JX / Toys