Sunday, May 5, 2019

Radio Sunday #6 - Software Defined Radios

Before getting started for #6, something I didn't say last time needs to be said and emphasized.  I measured one frequency in one band on one radio.  That really doesn't say much.  It could be typical of what you measure everywhere, it could be better than most frequencies and it could be worse.  A different brand could be better or worse.  What I measured is really the first step of what should be done before using a radio in a situation where you're really concerned about being monitored while leaving a radio in receive mode for long periods. 

On the other hand, the “near/far problem” is a much bigger problem.  Your weakest transmit signal is going to be many times stronger than this LO leakage.  I go through an example here where I attenuate the transmitter by a factor of one million – 60 dB.  That meets a link budget to a friend two miles away.  That signal, at about 1 microwatt leaving the transmitter is still 50 dB stronger than the leakage I talked about before.



Let's get to the subject at hand: software defined radio or SDR.  The problem with the subject is that it's so broad, it's hard to simplify.  It's really just “radio” but built a different way.  The most common definition is a radio in which some of the functions normally performed in hardware are done by software.  It's hard to say exactly when the first radio that could be called an SDR hit the market for hams and hobbyists.  They were certainly out in the mid 1990s, and I'm sure they were experimented with before that.

The most important thing to point out is that an SDR can't do anything that an analog radio can't do, but it generally does them in more repeatable ways, and in ways that can be miniaturized more easily.

An important example is the IF filter we've seen in every superheterodyne block diagram.  While intricate inductor capacitor (LC) filters, crystal filters, and mechanical resonator filters have been available for all of radio history, they all require effort by skilled technicians to align.  Buying filters from a company that specializes in building them outsources the alignment to another factory, arguably one better at building and optimizing those filters, but they're the same hardware.

On the other hand, once the signal has been digitized – converted to numbers – the signal can be mathematically filtered in software, what's often called “the digital domain”.  The software filters need to be designed and coded once, and there is never another alignment.  They're always perfectly identical.  In that sense, SDRs are a bigger boon to the manufacturers than to the users.  They need to inventory fewer parts, the radios need less alignment time during manufacturing, and the manufacturers have to invest less time in one of the major headaches all manufacturers face: components going obsolete.


A simplified block diagram of the Icom 756, introduced in 1996.  The area circled in red, a “DSP” module taking the fourth IF at 15.625 kHz and providing software defined filters and demodulation, makes this an SDR.

Before the signal can go through those filters, it has to be converted into numerical representations of the signals; it has to be digitized.  The heart of any SDR today is the ADC, or Analog to Digital Converter, usually just called “the A to D”.  These convert the smoothly varying analog voltage from the antenna, called direct sampling, or from an IF, 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 highest frequency of the signal.

There's something vitally important hidden here.  Let's pretend we're converting an analog radio to digital filtering and demodulation (among the first applications we call SDR).  The radio's final IF where the current analog filtering and demodulation is occurring is 5.000 MHz.  I don't need to sample at 10.000 MHz (twice the IF); I can just sample at twice the bandwidth of the IF I want to process.  Let's say I want to maintain 15 kHz wide  NBFM signals.  I only need to sample at higher than 30 kHz, not 10 MHz and 30 kHz A/D converters are an entirely different price class than 10 MHz converters.

This is called undersampling.  Instead of using a 10 MHz clock for the A/D converter, I can use a 50 kHz, or 100, or whatever is convenient (convenient = a frequency I can generate in my radio from a clock I have already).  Undersampling is taking advantage of 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 backward 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 100 kHz.  The first band, on the far left, is DC to 50kHz, which is one half the sampling frequency (fs/2 in the figure).  But a signal just over 50 kHz is indistinguishable from one just under 50 kHz; that is, 51 kHz is indistinguishable from 49 kHz, 52 from 48 and so on – it's tuning “backwards”.  When we get higher than the sampling frequency, a signal at 101 kHz is indistinguishable from one at 1 kHz, 102 from 2, 103 from 3 and so on.  When we get above 3fs/2 the tuning direction reverses again. This goes on forever because it's pure math.  In reality, the parts get less efficient and we read back lower voltages than are really there at the A/D.

This can be used to our advantage, like in sampling the IF with a low frequency clock.  I should point out that a 100 kHz clock won't work if the IF is exactly at 5.0000 MHz because the IF is centered at zero, or 0 + 15 kHz, not going from zero to 30 kHz.  The clock would need to have a multiple with a sampling band that completely contains the IF bandwidth.

The alternating slopes on those bands in the picture is intended to convey that they tune opposite each other.  In this case, “repeating forever” means until the ADC stops responding to the signal.  How high is that?  I tested a converter rated for a 60 MHz clock once, or DC to 30 MHz.  I started at 15 MHz (fs/4) 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 to test with 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.

There's now a big handful of hobbyist SDRs on the market, at any price point you'd like to play with from $20 to thousands.

What are the differences?  The lowest end, like the RTL-SDR, are typically parts developed for some other use (TV reception in the case of the RTL-SDR) and hacked by dedicated hobbyists to develop ways of getting their data streams out.

Typically, these radios have 8 bit A/D converters with a tunable RF front end and wideband frequency synthesizer for the LO.  The tunable front end helps reduce aliases but doesn't eliminate them.  Basically, frequency selectivity performance in a filter comes by the cubic inch and these radios just don't have enough cubic inches for the filters to be very useful.  Filtering is the most frequent addition to make low end SDRs better. 

The RTL-SDR block diagram, derived by one of the early experimenters is in two parts.  Analog:


The digital portion looks like this:


The block diagram is all digital after the A/D on the left.  The left hand box is an I/Q downconverter, just like the one in part four's installment with some additions.  The abbreviation DDC is “Digital Down Converter”.  DI and DQ are Digital I and Q, a FIR is a type of digital filter (Finite Impulse Response) with addition downconversion.  Decimation (done in a decimator) is a way of reducing the frequency by intelligently throwing away samples.  In both boxes, the down arrows denote this downsampling, reducing the sampling rate from the 28.8 MHz data originally coming out of the ADC.  The output of the digital module is the decimated I&Q data streams for demodulation by the PC software.

What distinguishes the thousand dollar SDR from the $20 kind?  First, I've mentioned filtering, but there's more.  A limitation of the low end radios is that they have low resolution A/D converters.  The RTL-SDR shown here has an 8 bit converter.  Higher end radios have 10, 12 and even 16 bit A/D converters.  What's the big deal?  The SNR in a converter never gets better than just over 6 dB/bit: that means an 8 bit converter can give a 48 dB SNR while 12 bit converter can give 72 dB and the 16 bit converter can give 96 dB.  While a 48 dB SNR signal is fine to listen to, the world brings wide ranges of signals into a radio and the 8 bit converter is more prone to overload on stronger signals.  More bits perform better, but the converters cost more and they impose more costs on the systems because more data is spewing out of the converter making the digital circuitry much harder.

Another issue is that these low cost SDRs are also low power radios and the only way to get good linearity (that is, minimum distortion) out of an RF amplifier is to run higher current.  You'll read of interference problems with pagers and FM broadcast stations with these radios and there would be fewer of these problems if the front end was designed for higher level signals.

Think of these lower end radios as equivalents of low cost scanners and other “beginner radios”.  They introduce you to listening to things you couldn't hear otherwise, but they may also introduce you to problems, too.


10 comments:

  1. You also have to beware of "Specsmanship" in these extremely low cost SDR radios. I bought one that advertised "16-Bit Conversion!!", but what they didn't tell you was that it was 8-bits on the I-Channel, and 8-Bits on the Q-Channel.....

    ReplyDelete
    Replies
    1. Oh, that is evil! I wonder why they didn't include power on/power off and call it 17-bit?

      Delete
    2. I think I know which SDR you're talking about, but would you like to leave that here so that readers can know to avoid them?

      To echo Malatrope, that's pretty awful. Dishonest at best, outright fraud at worst.

      Delete
    3. I'm pretty sure it was $5~$10 USB 'dongle' from eBay or Amazon. It was an early one I bought when I started learning about SDR. I've had (quite literally) a dozen different 'dongle' receivers, and ALL of the cheep ones ($25 and under) are pretty crappy for general purpose use. Living in the SoCal "RF Alley" environment caused the cheap ones no end of grief. You had to go into the control panel for the app you were using, and cut back the RF gain or they'd go nuts from things like pagers, close by two-way radios, and probably your microwave oven if the door seals were bad.

      As of two years ago, the best one on the market IMHO was the AirSpy. It offered real 12-bit conversion, some extra hardware filtering on the front-end, a nice TCXO, and it came in an aluminum enclosure.

      The best of the 'consumer' dongles were the RTL-SDR branded ones. They came with a TCXO, filtering, and were in an aluminum case to help keep their temperature more stable.

      The "Fun Cube Dongle Pro" and "Pro+" units are also pretty good, but also pretty pricey at ~$200. I don't want to name the 'worst' one for liability reasons, but it didn't "Play" very well, and wasn't an effective "Signal Processor".

      And their software was unbelievably BAD.....

      Delete
    4. Ah Ha! Glad I didn't mention it because I thought it was that "Signal Processor" one.

      I have one of the unbranded RTL-SDR types that I got from Adafruit a few years ago. It overloads in my FM broadcast band and this is a small city. I can hardly imagine intermod alley where you were. I haven't tuned around the pagers looking for trouble.

      I was thinking of picking up one of the branded RTL-SDR V3 units, since it's $30 with a nifty antenna. If nothing else, I can monitor my local police and sheriff with trunk tracking SW.

      It's not a great receiver, but more versatile than ones like the old Bearcat scanners.

      Delete
    5. Yup....that's the one. It stunk as a radio, regardless of the eHam.net reviews!

      I've wondered about the trunking software out there. I remember it being quite primitive some years ago, requiring TWO dongles to be usable; one for the control channel, and one for the talk groups.

      I've got several high-end Uniden digital trunking scanners, and they're wonderful at what they do.

      Delete
    6. SiG, you sent me off on a little quest to find more. Analog Devices has an interesting paper that I glanced over and will jump into at a later point. It is here:

      https://www.analog.com/en/technical-articles/basics-designing-digital-radio-receiver.html

      The marketing that DrJim pointed out is interesting. And thanks for the fill in on different products. I have not had time to mess with the actual hardware in the past but may. My previous job, moving, getting a house built, moving in, more clearing of the land, etc. has seemed to get in the way of radio fun.

      Please keep these articles going. They are either a quick refresher of what I know; often with a nugget or two of things I didn't know.

      Delete
    7. Yeah, Analog Devices is the Go To place for this kind of information. Especially since they bought up Linear Tech - who made the absolute best 16 bit A/D on the market (at least through 2015 or so, last time I did a thorough search), the LTC2207 (and family). 100 MHz clock and an honest 105 dB (to full scale) spurious free dynamic range.

      Last full receiver I designed used that converter to sample the entire HF spectrum at just under 100 MHz and did almost everything else in the digital domain. It was also used to undersample the 118 to 152 aviation band.

      That paper seemed very familiar, and I have it on my PC - dated 2002.

      It's always difficult for me to tell which articles are going over well. These don't attract anywhere near the number of comments as pieces that I think are pretty innocuous get, so it's especially hard to know if I'm being helpful or useful.

      Let me know if there's anything in particular you're curious about. I might know a thing or two.

      Delete
    8. Interesting. I think you do know a thing or two or three (as my late father would add). AD is still producing the LTC2207.

      Most want to comment on the other subjects. As I said before, I know some of this but as I wasn't a designer, I didn't learn a lot of the nuances. That is why you are good to read.

      Delete
  2. Good old Linear Technology! I've used many of their products. They made some really good wide-band op amps, too.

    ReplyDelete