Tuesday, October 29, 2013

Techy Tuesday: Software Defined Radio

H/T to WRSA who links to a cheap little SDR from Adafruit. So what's an SDR?  What makes it different than a regular radio?  Are they better? 

Before we start, I'm going to try to limit myself to explaining terms that aren't in my Least You Should Know series, especially AC Electricity and Basic Electronics.  I'll try to use those terms and define new ones.

A Software Defined Radio is one in which the major functions of the radio are performed by software.  That's a pretty broad description and exactly where a radio crosses the line into officially being an SDR is more often determined by marketing than technology.  In the beginning when DSPs (Digital Signal Processors - a type of microprocessor optimized for math operations) were slow, only demodulation - extracting the intelligence from a signal - was done in software.  As DSPs and other parts have gotten faster, more and more functions are done digitally, with pure numbers.  That's the main difference between an SDR and a conventional radio, like the radios you grew up with.

The heart of any SDR today is the ADC, or Analog to Digital Converter.  These convert the smoothly varying analog voltage from the antenna, or a lower, internally generated signal in the radio, to numbers.  One of the most important things to know about converting any signal to digits is how fast you have to sample it, and the most important relationship is the Nyquist limit, which simply says you must sample the signal at least twice as fast as the frequency of the signal.  In the case of that little Adafruit radio, since it says it receives 24 MHz to 1850 MHz, that implies you would need to sample it at 3700 MHz.  I can guarantee that you won't be able to find an ADC that fast that you can put into a $25 receiver!  I'm not even aware of one on the market that would work that fast. 

So how can an SDR receive a frequency way above their clock?  An aspect of Nyquist's limit that is often overlooked is that the ADC only needs to be clocked at twice the rate of the modulation.  Since most modulation in radios is slow - think voice systems at 5 kHz or less; FM broadcasters that are 100 kHz wide, and digital modulations at less than a few MHz, a clock need only be twice the modulation frequency.  If an ADC clocks at 10 MHz, for example, how can it receive 115 MHz?  ADCs are subject to a phenomenon called aliasing. An example of aliasing everyone has seen is in movies or TV when a car's wheels appear to be turning the wrong direction or slowing and reversing as the car speeds up.  The sampling of the video or movie film shutter is aliasing with the image of the moving spokes. 
In a sampled radio, aliasing causes the sampled bandwidth to repeat over and over, almost forever, like this picture.  In this example, imagine we're sampling at 10 MHz.  The first band, on the far left, is DC to 5MHz.  But a signal just over 5 MHz is indistinguishable from one just under 5 MHz, and as you tune higher, the signal goes down from almost 5 down toward zero.  A signal at 11 MHz is indistinguishable from one at 1 MHz.  Same for 21, 31, 41 and so on, forever.  The alternating slopes on those bands in the picture is intended to convey that they tune opposite each other.  (In this case, "forever" means until the ADC stops "hearing" the signal.  I tested a converter rated for a 60 MHz clock once, or DC to 30 MHz.  I started at 15 MHz and kept increasing the frequency by 30 MHz to find when I couldn't see the signal on the software that decoded the ADC.  I never found the limit on the ADC.  I ran out of signal generators at almost 10,000 MHz - 10 GHz.  The recovered signal was weak but it was the 166th alias.)  In a "professional grade" SDR, there are many filters to prevent aliases from causing problems. 

If you follow the links on that Adafruit page, you'll find these systems were initially intended for TV reception and some folks found they could be used for other things.  Their input clock appears to be 28.8 MHz.  These radios, achieve their range through a combination of tuning in the TV chip with aliasing, so they're quite a bit better than just an ADC with an antenna on the front.  Unfortunately, they aren't capable of the performance you'd need in good receiver because they weren't designed for this use.  This user, for example, writes about local paging systems wreaking havoc on the receiver, and includes a plot that shows their effects.  The pagers are essentially aliasing throughout the range of the receiver.  When that happens, you won't know what frequency you're receiving because of the aliases.  Still, they will allow you to listen to a wide spectrum with a simple, cheap receiver. 

Naturally, a software defined radio isn't going to be much good without software.  This piece appears to allow you to tune and choose your demodulator.  There appear to be other applications out there, including ham radio apps, that allow you to demodulate and tune.    

Are SDRs better than conventional radios?  They have strong points and weak points (like the alias issue, and that they often consume more power for the same performance as a conventional radio).  The answer to "is it better?" should always be, "better for what?"

I'm going to grab one to experiment with, but I'm a radio geek.  If I looked hard, I could probably find 3 or 4 radios around the house that tune that range. 


5 comments:

  1. I've got both the "FUNcube Plus" dongle, and one of the $20 "eBay specials".

    The FUNcube runs rings around the eBay special, but at 7 times the price, it should!

    There are several software packages out there, "SDR#" is for Windows, and Linrad, GNURadio, and one other one I forget the name of for Linux.

    The cheap ones *really* need a preselector in front of them, as they have about zero rejection of frequencies they're not tuned to.

    But for $20, and few $$ worth of front-end filter parts, they can be remarkably versatile.

    ReplyDelete
    Replies
    1. It reminds me a lot of the 70s and 80s era scanners. Bearcat, Regency (RELM), Radio Shack - those guys. Cheap and dirty RF. It will receive a signal if conditions aren't too rough.

      The advantage here is completely in the SW. If the users can code different demods, it should be able to listen to anything. I would guess that it's possible to write trunk tracking software for it - or add another one to listen to the trunking commands, if need be. (I think some trunking systems need a second receiver channel, while others don't).

      I ordered one right after posting this. Probably be here next week, since it's Wednesday already.

      Delete
    2. I think there's a project to do trunking with a pair of these as you suggest.

      The last I heard it was still "pre-release alpha" software, so I didn't look any further.

      Delete
  2. It's "vweird" how Nyquist theory works for audio as well.

    ReplyDelete
    Replies
    1. Yes. Yes it does.

      "Nyquist. It's not just a good idea; it's the law!"

      Delete