Showing posts with label RTL SDR upconverter. Show all posts
Showing posts with label RTL SDR upconverter. Show all posts

Thursday, February 15, 2018

Managing HF signal dynamics and preventing overload with the RTL-SDR (and KiwiSDR) receivers

Note:  This article was inadvertently posted for a few days before it had been finished.  This is the "completed" version of that article.

The Kiwi SDR:

The Kiwi SDR is a stand-alone network-connected multi-user "SDR in a box" device with its own web interface that allows one to tune from (nearly) DC to at least 30 MHz.  Using a 14 bit A/D converter, it is more robust than the RTL-SDR mentioned below, but it can still be overloaded by strong AM broadcast stations - so what follows can be applied.

The "RTL-SDR":

The so-called "RTL-SDR" dongles are devices that have become quite popular owing to their low cost (anywhere between $10 and $100, depending on features) and their ability to cover a wide frequency range - typically from a few hundred kHz to nearly 1GHz, depending on the device.  There are two separate signal paths on these devices:
  • Via the Raphael R820 chip.  This has an onboard synthesizer, mixer and band-pass filters and it converts signals in the (approximately) 24-1300 MHz range to a lower frequency.  This is the "normal" signal path used in these RTL-SDR dongles when used as they were originally designed for reception in the VHF and UHF bands.
  • Direct, into the RTL2832 chip.  This (typically unused) input may be made available via another connector, or via a frequency-splitting filter network as is done on the "RTL-SDR Blog" dongles.  This input can work from a few 100 kHz to 10s of MHz, more or less in conjunction with this chip's tuner/synthesizer.
It is the RTL2832 that has the A/D converter - which is just 8 bits - and that is the main limit of these devices when used in environments with both strong and weak signals.
Receiving HF with an RTL-SDR dongle:

If we want to receive the HF spectrum - which we'll call 500kHz-30 MHz (we'll include MF here...) we have to work around some issues.  The most obvious is that the R820 chip can typically tune down to something in the 20 MHz range (it can sometimes be coaxed to go even lower) but it certainly cannot be relied on to work well in the 1-5 MHz range.

The "direct" input has the advantage that is uses an 8-bit A/D that is sampling at 28.8 MHz followed by some DSP logic that allows signals in that stream to be internally converted to "baseband" samples - but the nature this chip poses a few problems.  To receive the entire HF spectrum, we have two methods that may be used, but each of these has their own sets of quirks, advantages and disadvantages:

The "direct" method:
  • It is very simple to implement in that it uses would would normally be an unused input.  Many dongles already include this modification - but if not, it may be easily added (instructions may be found on the web.)
  • The frequency stability can be better than the "upconversion" method since it is always lower - and there is only one oscillator that must be kept stable.
  • This has the disadvantage that the sample rate is about 28.8 MHz meaning that signals above 14.4 MHz will be aliased.  For example, a signal at 21.25 MHz will also appear at (28.8 - 14.4 = ) 7.55 MHz.  This can usually be mitigated by the addition of band-pass filtering around the frequencies of interest if "fixed frequency" operation is expected.
  • The "direct" input is typically quite "deaf", often requiring a bit of amplification if it is to be used for microvolt-level signals.  In testing, it took about 7 microvolts (-90dBm) for a CW signal to become audible, about 15 microvolts (-84dBm) for an SSB signal to be readable and around 25 microvolts (-79 dBm) for an AM signal to become listenable.  In other words, the sensitivity of this unit in direct mode is 20-30dB worse than a modern receiver.  The RTL-SDR dongles used happen to have a built-in amplifier so their sensitivity is "reasonable".
The "up-converter" method: 
  • In this method there are two oscillators that can contribute to drift:  The (typically) 100 or 125  MHz oscillator used for the up-conversion and the clock reference in the receiver itself.  Because both of these oscillators are operating at a rather high frequency - and because there are two of them - drift can be exacerbated.
  • The "image" problem associated with "direct" method is largely avoided.
  • The mixers used for frequency conversion can, in some cases, be overloaded by strong signals meaning that signals may be degraded before they get to the receiver.
No matter the configuration, there is one limitation intrinsic to these "RTL" devices:  The 8 bits of A/D conversion.

The "dynamic range" problem:

With 8 bits one can only attain an overall dynamic range of about 48dB (the actual amount is actually harder to calculate owing to oversampling, thermal and circuit noise, external noise, etc.)  The problem arises from the fact that a "weak" signal at, say, 160 meters may be on the order of 1 microvolt (-107dBm) but a nearby AM broadcast transmitter may be presenting a signal that could be 500 microvolts (-53dBm) or even much more!  In our example, we can see that this could pose a signal difference of 54dB - greater than the range that can be represented using an 8 bit converter.  In other words, assuming a 48dB dynamic range of our A/D converter, if we adjusted our levels so that a 1 microvolt signal (-107dBm) just barely registered on the A/D, any signal(s) that were 48dB above this (-59dBm) would "max out" our converter - again, ignoring oversampling, etc.

In other words, if we were to carefully adjust our signal level to our RTL-SDR (using an attenuator) such that we were just below the signal level that "maxed out" our A/D converter, our weak signal would be below the signal level represented by the lowest bit and it would (probably) be lost in the noise.  Conversely, if we tried to bring the weak signal up to the point where it was out of the quantization noise of the A/D converter, we'd be overloading our A/D, causing distortion and making it work very badly.

The importance of band-pass filters:

Whether you are using the RTL-SDR dongle in the "direct" mode with with a converter it would be a very good idea to limit the signals arriving at its input to only those of interest as much as possible.  This need contradicts the desire of many users of this device to cover from "DC to Daylight" - but if one attempts to put such a large frequency range into the antenna, performance will suffer imensely:  If the unit doesn't just overload, there will likely be issues with trying to receive weak signals in the presence of strong ones - and with just 8 bits of A/D conversion, if that difference is greater than 40dB, you may see significant degradation.

When used in the "normal" mode where the R820 chip is acting as frequency converter, the A/D converter in the RTL2832 chip sees a somewhat limited spectrum owing to filtering in the R820 chip - but despite this filtering there is still the problem of "weak versus strong" signals that are within this passband - not to mention the fact that it just doesn't take a lot of signal to overload the R820 outright.

If you are using "Direct sampling" mode on HF, the program is more severe:  The entire HF spectrum being applied at the RF input is being digitized by a measly 8 bits which means that even if you are running the RTL2832 in the 2048ksps mode where you can "see" 2 MHz of spectrum, signals from the rest of the spectrum are still being digitized by that 8 bit converter.  If you consider that the signal-handling capability of the 8 bit A/D to be a limit to the total RF power being applied, you may be "wasting" much of this A/D capability at frequencies that are of no interest to you at all!

Images in the "direct" mode:

A worst-case example:  20 meters

If you are running "direct" mode, the problem is worse, still:  As noted above, the sampling rate of the A/D converter is 28.8 MHz, which means that signals above the Nyquist limit at half this frequency - 14.4 MHz - will "reappear" elsewhere.  For example, if you were listening at 14.300 MHz on the 20 meter band - which is 100 kHz below the 14.4 Nyquist limit - you would also hear signals at 14.500, which is 100 kHz above the Nyquist limit.  Similarly, if you were tuned to an AM broadcast station at 1.0 MHz - 13.4 MHz below the Nyquist limit - you would hear signals that were at 27.8 MHz - 13.4 MHz above the Nyquist limit.

In the second case it's pretty easy to filter out the 27.8 MHz signals:  A simple low-pass filter will do, but in the first case - using the RTL-SDR Dongle at 20 meters - things are quit different as it is difficult to build a filter that will pass signals at 14.35 MHz with little attenuation but block signals at 14.45 MHz - the "image" of 14.35 MHz - sufficiently.  What this means is that if you are several MHz away from this 14.4 MHz limit, you can probably get away with filtering in the "direct" mode - but the closer you get (say, within the 13-16 MHz range) the more difficult it will be to remove the image.

The typical work-around for this is to convert the HF range to a higher frequency - typically by mixing it with a local 125 MHz oscillator, so instead of 20 meters being tuned in at 14.0-14.35 MHz in direct mode, it would be at 139.0-139.35 MHz.  This works pretty well, although oscillator stability - both in the RTL-SDR dongle's synthesizer and in that added 125 MHz oscillator - is much more of a concern as the frequency at this 139 MHz frequency could drift hundreds of Hz between the two oscillators whereas in direct mode - with only one oscillator - the absolute frequency is much lower (about 1/10th) along with the amount of drift.

Even with the "upconverting" technique, you are not excused from needing to have front-end filtering:  The limits of the 8 bits of A/D conversion and those of the circuitry still apply!

Another approach for 20 meter coverage:

Taking our 20 meter example, while we could upconvert - which would be the easiest approach if  you happened to buy an RTL-SDR with an upconverter - another approach would be to convert the frequency band from 14.0-14.35 MHz down to, say, 4.0-4.35 MHz by using a mixer and a 10 MHz oscillator:  This lower frequency would imply higher stability and the filtering requirements would be greatly relaxed as compared to up-converting by 100 or 125 MHz:  An example of such a circuit may be seen below in Figure 1.
Figure 1:
20 meter converter for an RTL-SDR Dongle used in "direct" mode.  This mixes the incoming (filtered) 20 meter signals with 10 MHz to produce a 4.0-4.35 MHz output.  Originally, I'd planned to use an inexpensive 10 MHz TCXO, but it was unavailable at the time of construction.  In the upper-right corner is an representation of the circuit layout.
Click on the image for a larger version.
In the diagram above we see the signals coming in and being applied to a 2-pole bandpass filter for 20 meters.  I "borrowed" this design from QRL Labs' bandpass filter (link) - so if you don't wish to build your own, you may order a kit of parts for the band of your choice from them.

This filter is not nearly "sharp" enough to pass the top end of the 20 meter band (14.35 MHz) and sufficiently block its nearest image frequency (14.45 MHz) if we were to use "direct" mode with the 14.4 MHz Nyquist limit so we down-convert the 20 meter band from 14.0-14.35 to 4.0-4.535 MHz, instead - well away from from the image response.  The bandpass filter limits the number of signals that get converted and provide enough filtering to minimize an image response that could occur due to the converter itself - that of the sum frequency (e.g. 24.0-24.35 MHz).  Transistor Q1 boosts the HF signal somewhat to overcome the loss of the filter and of the mixer and low-pass filter following it.

The local oscillator that I used was a 10 MHz OCXO (Oven-controlled Crystal Oscillator) that I had kicking around and its output was at TTL levels - a 5 volt square wave, so R5 was placed in series to knock this down to about 1 volt peak-peak at the "LO" input of U1, a diode-ring mixer.  I had originally intended to use an inexpensive 10 MHz TCXO (Temperature-controlled crystal oscillator - Digi-Key PN:  1664-1262-1-ND) but this turned out to be unavailable at the time I constructed it:  Had this part been on-hand I would have included a 3.3 volt regulator for the TCXO and would have omitted R5.  In a pinch, a "crystal can" 10 MHz computer-grade oscillator could have been used, but these - unlike the TCXO that I would have used - are not particularly accurate in frequency or stable with temperature (e.g. they would be within "only" 100ppm or so - which could be about 1 kHz at 10 MHz.)

The output of the mixer is passed to a low-pass filter to remove the "other" image resulting from the mixing product (24.0-24.35 MHz) as well as "bleedthrough" of the 10 MHz local oscillator - the presence of which could degrade the performance of the RTL-SDR.

This entire device was constructed "Manhattan Style" on a piece of copper-clad circuit board using "Me Squares" (from QRP-ME - link) which was mounted in the lid of a die-cast aluminum enclosure.

Is "Direct mode" worth the trouble?

Why use the "direct" mode at all?  When the frequency is converted, drift can be a concern, and this is significantly reduced  in "direct" mode - and it is quite simple to implement in hardware:  Many dongles - like the "RTL-SDR Blog" dongle have a diplexing filter (and amplification on the "direct" branch) that make it easy to use - provided that one be aware of the limitations!

In cases where the frequency is quite low - say, below 12 MHz - it is pretty easy to apply band-pass filters that will remove the image response above 14.4 MHz.  Above the Nyquist frequency we can actually use this effect to our advantage and directly tune in the 17 and 15 meter bands, using band-pass filters to limit the input to only those frequency ranges.  We again hit another Nyquist response at 28.8 MHz, but by then the low-pass filter built into the dongle is starting to take effect.

Whether or not you use direct mode, you will want to apply a bandpass filter to the input to limit the signals to those of interest - that is, if you really want to minimize the possibility of overload.

In short:  Is the "direct" worth the trouble?  In those instances specified above, it can be, owing to its relative simplicity and improved frequency stability as compared to the "upconverter" method.

Extreme case:  Receiving both the AM broadcast band and 160 meters


To illustrate this problem, let us look at the signals present on an HF antenna located in the Salt Lake City area, below:
Figure 2:
Off-air signals of the AM broadcast band into a Carolina Windom designed for 80 meters and higher bands.  This spectrum analyzer plot's vertical axis is 10dB/division with the top bar being 10dBm.
The on-screen reading is for marker #4, which is a weak "local" station at -62dBm, but the strongest signal is marker #1 which is a bit stronger than 0dBm which means that this signal literally has a million times more power at the antenna input than the weaker one!
Click on the image for a larger version.
In Figure 2, above, we see the plethora of signals that are intercepted by a typical HF antenna in a metropolitan area.  The strongest signal (marker #1) is at 1160 kHz (KSL) a local 50kW "clear channel" station which is producing a power level of about +3dBm - which is nearly 1/3 volt of RF!  In contrast we can see another signal indicated by marker #4 which is another local, low-power station with a signal level that is about 60dB (a factor of 1000000!) weaker.

The "top" end of this plot (far right) includes the entirety of the 160 meter band and at this (rather noisy) site location we can see that the background noise is presenting us with a signal level of about -80dBm (about 22 microvolts) of noise.  In a truly "quiet" location, away from power lines and other urban QRN this noise floor would be 10-15dB lower during daylight hours, or in the area of -95dBm (about 4 microvolts.)

From this plot we can see several problems that arise if we want to use an RTL-SDR:
  • The strongest signal (marker #1 at 1160 kHz) is about enough to case the front-end static-protection diodes built into good-quality dongles to conduct and cause intermodulation distortion on their own.
  • The signal level differences between the strongest local signal (marker #1) and the weakest (marker #3) is nearly 40dB below that of the strongest signal - which is almost all of the range of our A/D converter.  There are "nearby" stations located farther away that are even worse off - such as the station located at marker 4 that is about 60dB down (1-millionth) of the signal level of our strongest.
  • If we wanted to listen to local AM broadcast signals and be able to receive signals on 160 meters we would need manage the fact that there is about 80 dB difference (a factor of 100 million!) between the strongest signal and the noise floor!  What's worse is that this -80dBm (ish) noise floor at 160 meters isn't all that much higher than the noise floor of the RTL dongle itself.
To be sure, the magnitude of these disparate signals can be a challenge even for a modern communications receiver which, when connected to this same antenna, may well experience overload unless a significant amount of attenuation is added, but coupled with the limited dynamic range of the RTL dongle, being able to receive both sets of signals poses a challenge.

"Squashing" the signal levels

Clearly, if we want this system to work in both environments we need to reduce the levels of the strong broadcast band signals while boosting the weak signals on the 160 meter band and the way to do this is with some filtering.  If we design a "band stop" filter that will attenuate only the broadcast band signals we can prevent the dongle from being overloaded as badly.

Let's design a hypothetical band-stop filter that will reduce signals in the broadcast band by 30dB (1000-fold) but leave those outside the band alone:  Will this help?

Taking the strongest signal (1160 kHz) and reducing it by 30dB means that instead of +3dBm it will now be -27dBm - better, but this is still about 53dB above our 160 meter noise floor.  What about the other signals on the band?  That signal at marker #4 (1230 kHz) will be reduced from -36dBm to about -66dBm - quite weak, but still audible, albeit a bit noisy.  What about those other stations that are weaker-still?  Those will get submerged reduced as well, getting down near the -79dBm "minimum signal level" for the RTL dongle.  Even by reducing this level, we still haven't done anything to bring up the 160 meter signals at all.

To make it work we will need to do more.  One way to do this is to apply selective (notch) filters to the strongest signals to reduce just those signals.  Looking at Figure 2, again, we can see that if we were to reduce the strongest signals by 20-30dB, we'd "compress" the range between the strongest and weakest signals and allow us to be able to deal with them with our range-limited RTL dongle.  They cyan (blue-ish) trace in Figure 3, below, shows what the AM broadcast band looks like once we have done this:
Figure 3:  
The AM broadcast band - and the 160 meter band, with the YELLOW trace showing the signals before filtering and the CYAN trace after we have applied broadband attenuation to the AM broadcast band, selective attenuation to the strongest signals and some amplification overall.  As can be seen the range between the weakest and strongest signals is significantly reduced with the signal levels in the 160 meter band being increased enough to be above the dongle's noise floor.
Click on the image for a larger version.
In Figure 3 we can see the result of our work:
  • The strongest signals are reduced by about 20dB
  • The weaker signals are reduced a bit overall, but not as much as the strong ones owing to our attempts to selectively reduce only those that are strong.
  • The noise floor at 160 meters has been increased by 20dB.
  • The difference between the strongest broadcast band signals and the 160 meter noise floor is now around 40dB - within the (theoretical) usable range of the 8 bit converter in our RTL dongle.
In other words we have reduced the strongest signals by over 40dB, the weaker signals by 20dB and then brought everything back up by about 20dB.  Because our filter had little effect on the signals above and below the broadcast band, they came up by about 20dB as well.

How this may was done:

After using the Elsie program (there's a "free", somewhat cripped student version that's adequate for this task) and perusing my "Filter Design Handbook" by A.B. Williams I designed a "band stop" filter that was designed to cover the AM broadcast band - that is, provide at least 30dB of attenuation from about 540 to 1725 kHz.  Within this range, the attenuation can be much higher - greater than 60dB - but I was (theoretically) guaranteed that the minimum would be 30dB - and I ended up with the circuit, below:
Figure 4:
Diagram that includes a splitter to provide an unfiltered signal path along with the BCB reject filter and post-filter amplifiers.  Adjustable notch filters to attenuate strong, local stations are also included.
Click on the image for a larger version.

Circuit description:

Because one may want an "unadulterated" signal path for other purposes, a two-way signal splitter (L1/L2) is included:  The added 3dB loss is irrelevant with a decent HF antenna and modern receivers in terms of ultimate system sensitivity.  The splitter output that goes to the filter is passed through a resistive attenuator that helps set the source impedance to the band-reject filter and again, this added loss isn't much of a concern on a decent HF antenna.

The AM BCB filter was designed for a nominal center frequency of 950 kHz and each series and parallel L/C circuit is tuned to that frequency.  The capacitor and inductor values were juggled to attain the closest standard values (or permit parallel combinations of standard-value capacitors) - this variation from the "ideal" having negligible effect on performance.  The capacitors used are all 5% NP0 (a.k.a. C0G) types for stability and the inductors are wound on T50-1 toroids using 30 AWG wire:  The values of the inductors were checked and adjusted with a known-accurate L/C meter after winding and it was determined that the calculated number of turns typically yielded inductance that was 5-10% high - a direction preferable to the other as adjustment simply required the removal of a few turns. (Yes, I wound toroids:  Lots and lots of toroids!)

Across the output of the band-stop filter is a set of simple series L/C notch filters.  I happened to have on-hand some inductors that were adjustable from about 8uH to 15uH and number crunching indicated that with just three capacitor values, the entire AM broadcast band could (more or less) be covered with a bit of overlap.  The first three notch elements (those at the right side of the string) used just a single capacitor as it was anticipated that there would be at least one station in the low, middle and upper portion of the AM broadcast band that would need to be reduced in strength.  The remaining four notches use two capacitors with computer-type push-on jumpers that allow the smaller capacitor to be selected for the upper portion of the broadcast band, the larger for the middle and the two together for the lower portion - or complete removal of the jumpers would disable the notch altogether.

The specific value of the inductor used for the notch filters is not important - it could be anything from around 4uH to 33uH, values calculated using an equation like:  L*C = 25330/((Freq in MHz)^2), where "L*C" is the product of the inductance times capacitance:  One simply divides this number by the amount of capacitance in pF (or inductance in uH) to get the "other" value.

When choosing inductors it is very helpful if its tuning has a 2:1 adjustment range:  If this is the case, three selectable capacitor values ("A", "B", "A+B") as described on the diagram will allow coverage of the entire AM broadcast band.  Unfortunately, it is getting more difficult to find small, adjustable inductors, so one must keep an eye out for them at surplus outlets or be prepared to modify 455 kHz IF transformers/AM tuning inductors such as those available from Kits and Parts (link).

Ignored up to this point are R5 and R6 - the "bypass" adjustment that re-injects signals back into the filter's output.  It may seem strange to build a filter that removes signals in the AM broadcast band - only to put them back again - but it does make sense if you do want to be able to receive such signals, but be able to strictly control their levels at the receiver input terminals - more on this later.
Figure 5:
 The "as built" AM/BCB filter module depicted schematically in
Figure 4, above.  Along the left edge is the splitter and to the right
of it is the AM band-stop filter with the "bypass" control along the top.
In the lower-right is the 7-element tunable notch filter assembly.  The
remaining circuits are the amplifiers/splitters that are downstream from
the band-stop filter.
Click on the image for a larger version.

Following the filter is a broadband RF amplifier constructed using the venerable 2N5109 transistor - a rugged, low-distortion device that is readily available from many suppliers.  This amplifier provides a reasonably low noise figure for HF (in the 5dB range) along with about 12-14dB of gain, overcoming the losses of the front-end splitter, attenuator and filter with a bit of room to spare.  Theoretically, the system noise figure at this point will be on the order of 9 dB, but considering the nature of the HF spectrum and the fact that even at 28 MHz an "acceptable" system noise figure is around 15dB, we aren't really suffering due to the losses in this signal branch.

Following this amplifier is another 2-way splitter - and then another amplifier with splitter:  This second amplifier with splitter - which is probably a bit of overkill - is useful for some types of wideband SDR devices, such as the RTL-SDR dongles:  When these are coupled with filtering and an adjustable attenuator, a bit of "excess" gain is handy to be able to throw away when setting the RF levels into them.

A balancing act:

As mentioned above, there is a "bypass" adjust that is used to allow the reinjection of AM broadcast signals back into the signal path and with the components shown the usable adjustment range is from about -35 to -15 dB.  As it turns out only a few of the signals that one is likely to intercept will be strong enough to cause problems while the rest are quite low.  At night the cumulative signal power of the myriad stations arriving by "skip" can cause a receiver like an RTL-SDR to become overloaded, but by having 10-20dB of added attenuation we can keep this total signal power down to a more reasonable level.

As can be seen on the YELLOW trace of Figure 3, above, there are a few stations that stick way above the general level of the other stations and the trick is to knock these down so that they are still "strong enough", but not so strong that the receive system is overloaded.  By using the notch filters, the strongest of the stations can be reduced by 20-30dB, putting their signal levels on par with the rest as is demonstrated by the CYAN trace if Figure 3.

Comment:
There is a side-effect of such a simple notch circuit - that being that the signal a few 10s of kHz above the notch frequency can be boosted by 10dB or so.  Unless that signal is quite strong, this is of little importance - but if is a problem one can carefully park the notch between the two signals, attenuating the strong, lower signal adequately while moving the "peak" above the upper signal.

At this point the real balancing act occurs.  In the case of this filter assembly, the receiver itself was an RTL-SDR dongle that was intended to cover from about 460kHz to 2500 kHz which encompasses the entire AM broadcast band plus the 630 and 160 meter amateur bands.  This proved to be a bit of a challenge as the signals in the two amateur bands could be as low as a few microvolts while those in the AM broadcast band were noted to be in the hundreds of millivolts - a span of around 90dB, which would be a challenge even for a 16 bit A/D converter, not to mention the measly 8 bits of an RTL-SDR.

By knocking the strongest AM broadcast band signals down by 25dB with a notch and another 20dB with the band-stop filter we can get reasonably close to our goal.  Even with the overall AM broadcast band attenuated by 20dB, a reasonably sensitive and properly adjusted receive system can still receive some of the weaker stations during the daytime (which really aren't all that weak) and still yield a band full of signals at night!

The other part of the balancing act is to set the signal level at the input of our receiver - an RTL-SDR dongle:  We have "excess" signal coming from our filter/amplifier network which means that we can knock it down again with an attenuator - which for an RTL-SDR could simply be a 100-200 ohm potentiometer paralleled with a fixed resistor (to achieve something in the 50-75 ohm area - the actual impedance isn't really important) with the "wiper" side feeding into the receiver.  At this point one would increase the attenuation just to the point below where the RTL-SDR's A/D converter started to clip significantly - and this sort of adjustment would have to be done under various conditions.  In my case, it was checked during the daylight hours when a number of the local stations were running their full 50kW and again at night when these stations were running lower power - but there were many other stations of low-moderate strength being propagated via skip.

Also included in this balancing act is the adjustment of the "bypass" control:  Too little bypass, the weaker AM signals cannot be heard, but too much and the receiver will overload.  It need not be said that this set of adjustments is trial-and-error, but it is quite possible.

Real-world result:

Contained in Figure 6, below, is a trace captured from exactly the system described above as used on the Northern Utah WebSDR where you may see this filter in action, with the visible signals varying wildly depending on whether it is local day or night.  This receive system is connected to a large antenna (which is designed to work only down to 3 MHz, but still intercepts signals below this range quite will) and it passes through the splitter/filter/amplifier system depicted in Figure 4.
Figure 6:
An actual, off-air "waterfall" capture (during the local nighttime) from an RTL-SDR system that covers from about 460 to 2500 kHz - a range that includes the AM broadcast band and the 630 and 160 meter amateur bands.  As can be seen,
the band is packed with signals - most of them via ionospheric "skip".  Outside the range of 530-1750 kHz the
background noise can be seen with several signals being visible on 160 meters.
Click on the image for a larger version.

If you look at the larger version of Figure 6 you can see that there are quite a few signals present and their relative strength is indicated by the "brightness" of the traces.  A closer look will reveal something more:  You may notice that between the range of 550 and 1750 kHz, the deep background is rather "smooth", but outside this range it has a bit of granularity to it.  This is due to the attenuation of the BCB reject filter causing the background noise level within the 550-1700 kHz range to be below the sensitivity of the RTL-SDR dongle, but outside this range, the sensitivity is just high enough that the background noise on these frequencies is visible, allowing even relatively weak signals on the 160 meter band to be received.  Because of the limited dynamic range of the RTL-SDR, some of the weakest "local" AM stations aren't readily audible during the daytime - an inevitable consequence of the trade-off between strong-signal handling and weak-signal performance - but as can be seen in Figure 6 the spectrum is "chock full" of radio stations at night.

To achieve this result the RTL-SDR dongle is being run in "direct" mode and there is a 2.5 MHz low-pass filter and adjustable attenuator placed between it and the output of the BCB filter unit - the low-pass filter being used to remove the energy from those signals above the frequency range of interest.

Testing with the KiWiSDR:

The described filter was tested with a KiwiSDR as well and owing to its superior dynamic range and usable sensitivity, it could actually "hear" the ionospheric background noise through the filter - with the possible exception being frequencies immediately adjacent to the notches.

Without the filter, the KiwiSDR was on the "hairy edge" of overload during the daytime when several local AM stations are running 50 kW - and even if the A/D converter isn't being driven into clipping/overload, it could be argued that performance across the board could be subtly impacted.  The effects of the filter on the signal levels in the AM broadcast band and beyond can be seen in Figure 7, below:

Figure 7:
A screen capture of the waterfall and spectrum analyzer from a KiwiSDR showing signals/noise over the range of 400-2000 kHz.
As can be seen, the background noise is attenuated over the range of approximately 530-1750 kHz while the overall signal range of strongest AM broadcast band signals are pretty well-controlled.
Click on the image for a larger version.

Figure 7 shows the effects of the filter during the daytime.  The background noise can be seen "through" the filter which means that there are no stations that are being made inaudible because of it - but at the same time the signal levels of the strongest stations are "tamed" significantly, being reduced by 20-30dB via the tunable notches.


Conclusion:

As can be seen, it is possible to deal with wide signal ranges when using a receiving device that has intrinsically poor dynamic range - but it depends on several things:

  • The signal levels need to be fairly predictable.  In this case, the signal levels on the AM broadcast band are very consistent - at least during the the day when the majority of the local "powerhouse" daytime-only 50kW stations are on the air.
  • Outside the filter's range the signals are typically much weaker owing to the fact that they are being propagated via shortwave from relatively low-power transmitters.
  • The ability to manage the signal levels overall:  The "compressing" of the range of the signal strength of the "local" AM stations with band-reject and notch filters helps out a lot!
Admittedly, this method is quite complicated, but it is do-able and in spite of its complexity, it allows very inexpensive hardware to be used to cover a fairly wide frequency range - in fact, if the goal was to use an RTL-SDR dongle to cover just the AM broadcast band and there were any nearby AM stations, you'd have to apply at least some of the above techniques to make it work well if your goal was to allow the reception of both local and distant stations.

[End]

This page stolen from ka7oei.blogspot.com


Saturday, March 7, 2015

Using the "RTL.SDR" dongle (with HF port) as found on Ebay

Some months ago I was perusing the wares of a seller on EvilBay and having decided to purchase one of those all-purpose component testers, I was tempting myself with other items on sale.  One of the items that I could not resist was the "RTL.SDR" that was billed as having an onboard frequency upconverter to allow HF operation (it actually doesn't - see below) plus a more stable reference oscillator.

Figure 1: 
The EvilBay "RTL.SDR" with extra connector
for HF reception.
According to the pictures on EvilBay, the units
currently sold host different picture, with
 a graphical representation of the schematic
diagram showing the mixer.
Click on the image for a larger version.
"What are these 'dongles' of which you speak?"

Stepping back for a moment, the "RTL" SDR dongles have been around for a few years, so-called because they typically contain as one of their active devices the Realtek RTL2832U.  These devices - costing roughly $10 (more or less) also contain a device (a Rafael Micro R820T in the case of the one pictured) with an onboard frequency synthesizer, I/Q mixer and (8 bit) A/D converter that allows one to receive signals from 50 MHz (or lower) to well above 700 MHz - sometimes way above 700 MHz, just using a computer with reasonable horsepower and FREE software!

While the thought of an 8 bit A/D converter and its rather limited dynamic range (40-ish dB) might make it sound like these devices may be useless when connected to an antenna, the fact that they convert only a limited range of frequencies (approximately +/- 2.4 MHz at most) around the tuned frequency - plus the "oversampling" nature of the raw A/D sampling rate of the 8 bit converter means that relatively narrowband signals can have quite good ultimate quantization range.  What can suffer is when, within the sample-rate passband there are signals that range widely in signal strength:  Under such conditions it is recommended that one "finesse" the gain controls for optimum input signal levels to the A/D converter.  Another deficiency from which they suffer is quantization noise - that is, the inability to "see" weak signal that are down in the mud, plus the tendency for this noise to somewhat "spread" the energy of nearby, stronger signals around and raise that noise floor.

Perhaps the most popular software to do this is "SDR#" (a.k.a. "SDR-'Sharp'").  Easily found via a web search, this software is compatible with many software defined radio packages and it supports many modes and features, also offering many optional plug-ins.

These low-cost USB dongles were intended to allow the reception of digital TV and FM/Digital Audio broadcast (but not the sort of TV or digital audio broadcast that is used in North America) on a computer so they were designed to tune from something around the low-medium VHF range - say, 20's to 50's of MHz and up, almost completely leaving out the HF frequency bands.

Several schemes have been devised to allow the use of these handy devices to receive HF and these typically involve the use of some sort of upconverter to translate the HF frequencies from as low as the AM broadcast band up to a range that these devices will tune.  Another scheme - used here - is to feed HF directly into the "Q" input of the RTL chip - this input not normally being used with its frequency converter.

So, I soon found myself with the device pictured in Figure 1 in my hands.  Getting busy with life and other things, it was a few months before I got around to playing with it and while I quite easily got it working on the "UV" input which, on this particular unit tunes from just below 25 MHz to over 1 GHz (although I'm not sure exactly how far above 1 GHz...) but I was puzzled as to how to configure it operate at HF.

How to make it work on HF:

Back then, a web search didn't help as there was a plethora of hits on "RTL SDR Upconverter" so I removed the unit from its case and found the callsign "BA5SBA" on the board that you see in Figure 2 and got a hit with Google on a German page (this one - LINK - you may need to run it through a translator, so try THIS LINK which may or may not work...)  While this web page didn't describe exactly what I needed to do, it did provide enough clues to get it working!

Comment:
  • More recently, the some of the sellers on EvilBay are including in their postings some basic instructions on how to get these devices to work on their "HF" ports, but what follows below contains more information - and is hopefully easier to find and more permanent - than an EvilBay posting!

Figure 2: 
Inside the BA5SBA "RTL.SDR" with the "HF" port.
The jumper in the upper-left corner marked "A" and
"P" appears to be intended for putting 5 volts on
the "UV" antenna connector to power an external
RF amplifier.  ("A" = active, "P" = passive).
Click on the image for a larger version.
With a bit of reverse engineering I determined that the "HF" input was connected, via a transformer, some low-pass filtering and some protection, to one of the inputs of the RTL chip - specifically, the "Q" input - which not used in its normal role when converting from higher (VHF/UHF) frequencies.

Using a signal generator set to 5 MHz I connected it to the "HF" input of the device and, just for kicks, tuned SDR# to 5.000 MHz as well.  After a bit of fiddling about, I finally found how to configure the unit to receive at HF.

  • STOP the SDR receiver first by hitting the square "stop" button at the top.
  • Bring up "RTL-SDR Controller" window (accessible by clicking on the "gear" symbol)
  • Under "Sampling Mode" set it to "Direct Sampling (Q Branch)".  Note:  You cannot change the sampling mode without first STOPPING the SDR.
  • Restart the SDR by pressing the "start" button (the right-pointing triangle resembling a "PLAY" button)

Once I had done this I saw the 5 MHz signal on the display!


Comments: 
  • By default, SDR# will set the "RF Gain" setting in this same "RTL-SDR Controller" window (see Figure 6) to minimum gain (all the way to the left.)  If you leave it there, the SDR dongle will be EXTREMELY DEAF when it is in the normal "Quadrature Sampling" mode.  When you have it in either "Direct Sampling" mode this control is disabled.
  • I would suggest checking the box that says "RTL AGC" and moving the RF Gain control in either "Quadrature Sampling" or "Direct Sampling" modes:  If you do not do this your receiver may be very deaf!
  • I experimented with using this device with the "HDSDR" program and found that at HF, its sensitivity was noticeably worse than that obtained when using it with SDR#.  I'm not sure why this might be, but it seems to have something to do with the way the "ExtIO" driver - or HDSDR itself - handled the internal gain settings of the dongle.
Figure 3: 
A screenshot of SDR# showing the configured "Shift" for the mixer.
Click on the image for a larger version.

Now I am very surprised that I can tune SDR# to "5.0" MHz and see the 5 MHz signal that I am inputting as the chip on this dongle should not function at that frequency!  What I expected to have to do was as follows as shown in Figure 3:
  • Knowing that the onboard mixer uses the 28.8 reference oscillator, check the "Shift" button on SDR#.
  • Enter a frequency of "-28800000" (yes, negative 28.8 million) into the box as shown in Figure 3.
  • Note:  There is a bug in some versions of SDR# that, if you are already tuned to a frequency lower than the "shift" frequency, the tuning may not work properly until one sets a much higher frequency with the 100 MHz digit and tunes back down.
  • Having done this, one need not mentally add the desired HF receive frequency to 28.8 MHz:  The receive frequency is simply input to the main frequency tuning as one would any other frequency!
  • If the 28.8 MHz frequency reference oscillator is somewhat off frequency one must first set the frequency using the "normal" VHF/UHF mode and calibrate it in the "RTL-SDR Controller" window and THEN, after switching to HF mode as described above, one can input a frequency that is slightly different from 28.8 MHz as needed to correct the offset.  I did not have to make any correction at all!
Comments: 
  • The 28.8 MHz reference oscillator supplied with this unit appears to be quite good and stable and was only off a few PPM:  Your mileage may vary.
  • If you want to use the VHF/UHF input again, remember to reset the "Sampling Mode" back to "Quadrature Sampling" and UN-CHECK the "Shift" box that is visible in Figure 3.
Does it matter whether one uses the "0 MHz" method or the "-28.8 MHz" method with the offset?  Not really:  I could see no difference in the sensitivity of the SDR - but it is good to be aware of both methods just in case the "0 MHz" method doesn't work!


Comments on the design of the HF mixer and its limitations:

Sensitivity (or the lack of...)

Figure 4:
The low-pass filter in front of the mixer.
Click on the image for a larger version.
The very simple mixer on this SDR Dongle has its limitations, the first of which is that being entirely passive, the ultimate sensitivity at HF is not particularly good:  Using SSB (2400 Hz) bandwidth, signals down to around -90dBm were audible, but that was about it.  While this represents a signal of around 7 microvolts and may seem horrible (and it is, compared to modern HF receivers!) it should be remembered that if this is connected to anything resembling a full-sized HF antenna, it "hears" just fine since the background noise on HF bands - and thus the signals - will typically be above this level - at least on the "lower" bands of 10 MHz and below.

Nyquist rules!

The other problem is that the sampling rate on this input is 28.8 MHz.  What this means is that there is a Nyquist limit of 14.4 MHz - and that means that any signal above 14.4 MHz will reappear again as an "image" at a lower frequency, approaching Zero Hz as it approached 28.8 MHz.  In other words, if you were tuned to 7.1 MHz in the 40 meter band, you would also hear a signal at 7.1 MHz below 28.8 MHz, or 21.7 MHz!  This also means that if you were trying to listen on 21.1 MHz in the 15 meter band, you would hear a signal at its 7.7 MHz image!  The situation is worse on 10 meters since the 28.8 MHz local oscillator is nearly in the middle of this band:  An FM signal on 29.5 MHz would also appear on 28.1 MHz!
Figure 5:
The response of the low-pass filter depicted in Figure 4.
The bandpass response is the solid line.
Click on the image for a larger version.

If you look at the circuit board in Figure 2 you'll notice several components in the foreground, namely a number of inductors and surface-mount capacitors, all with the values marked on the silkscreen.  Presuming that the values of these components are as-marked, I drew the schematic in LT Spice that is shown in Figure 4 and simulated it with the result in Figure 5.  As can be seen, this low-pass filter effectively blocks signals much above 40 MHz or so, offering more than 40 dB of attenuation above 60 MHz.

Other than keeping signals from low-band TV and FM broadcast out of the "HF" input, this filter does not help us at all in our image problem.  Because this filter does not block signals immediately above 28.8 MHz, we have another set of images that occur which means that a signal that is at 33.8 MHz - 5 MHz above 28.8 MHz - will also show up at 5 MHz! 

If there are no signals (or noise!) on these "image" frequencies, there should be no problem, but this is likely not to be the case during the daytime on a large wire antenna - which means that if you really want to use this dongle for serious HF reception, you need some sort of filter in front of it, either a separate Low Pass (below 14.4 MHz) and High Pass (above 14.4 MHz) to be used individually, or you could use a tunable preselector to pass only the frequencies of interest.  (There would be a problem with 10 and 20 meters as these bands are close to or include the Nyquist frequency!)


Possible modifications:

If you look at Figure 2 you'll note that there are several small "prototype" areas on the circuit board.  These are large enough to allow the construction of some simple circuits, namely a bit of additional gain (amplifiers, filters) to improve the sensitivity of the receiver.

As mentioned before another useful modification - one external to this box - would be the addition of a preselector to filter a narrower range of frequencies.  Another would be to simply add another oscillator of a much higher frequency (say, 100-150 MHz) and feed it into the mixer to put the Nyquist limit completely above the HF band.

Is this "HF" input useful as-is?

In general, yes, with a good antenna.  Despite its flaws, when one casually tunes around the HF bands its problems do not immediately jump out, at least on the lower bands.

The biggest advantage of this particular SDR Dongle is that it seems to have quite a stable oscillator on board - much better than the $8 USB "stick" that I have experimented with previously:  This one seems to move only a few 100 Hz from cold start even at UHF frequencies whereas the very cheap ones seemed to move all over the place with temperature!

To be sure, one could probably get better HF performance by building (or buying) an upconverter for this sort of SDR that uses a much higher local oscillator frequency - say, 100 MHz -  but if one upconverts all of the HF frequencies en-masse, there are a few things that one must remember:
  • If you use a chip like the NE602, it may simply overload when connected to a full sized HF antenna unless you are prepared to add switchable attenuation to it and/or a preselector!
  • On a full-sized antenna, intercepting and converting the entire HF spectrum can represent quite a bit of signal energy.  If the HF upconverter that you are using does not, itself, overload, there is a good change the the converter chip in the RTL-SDR itself will overload with so much energy from such a wide variety of frequencies!  Remember:  The receiver chips in these dongles were intended to work with the relatively weak and sparse broadcast signals intercepted on small, indoor antennas, not the entirety of the HF spectrum when the bands are open!
  • If you use a separate upconverter circuit - say, to 100 MHz - the frequency stability will be dependent on that 100 MHz local oscillator and the reference used by the dongle itself for its normal operation.  With two oscillators, there is the greater potential for drift, a fact exacerbated by these oscillators effectively operating at rather high frequencies.
Figure 6: 
The screen for configuring the dongle's
hardware.
Click on the image for a larger version.

A few brief comments on using it at VHF/UHF:

Remembering to set it to the "Quadrature Sampling" mode when using the "U/V" input, there are a few things to know when using this device - and possibly others like it - with SDR#.

Clicking on the "gear" symbol will open a screen such as that depicted in Figure 6 that allows modification of settings related to the dongle's hardware.  In particular, note the check in the box for RTL AGC and the lack of a check in the Tuner AGC box:  The RTL AGC box is necessary in both the Quadrature Sampling mode to get the most gain out of the device.

The Tuner AGC box - which is only available when Quadrature Sampling mode is active - if checked, does not seem to work properly in the the version of driver and/or SDR# at the time of initial posting of this blog entry (March, 2015) as it seems to increase the gain too much, causing overload of the A/D converter and actually reducing performance - particularly if a decent antenna is connected!  (This is really where the deficiencies related to just having 8 bits of A/D conversion start to show up:  With higher resolution - and higher dynamic range - the "sweet spot" in which the performance would be good would be wider.)
Figure 7: 
 Top:  Properly adjusted RF gain setting
Bottom:  The degradation from too much RF gain!
Click on the image for a larger version.

Figure 7 demonstrates the problem.  The top half of the image shows an optimally adjusted amount of gain - a setting of 12.5 dB for this particular antenna (yours will vary!) while the bottom shows a gain setting of 37.0 dB.

Even though more signal is reaching the A/D converter in the bottom example, it is way too much and the converter is being badly overloaded, causing the noise floor to rise from below, submerging weaker signals!  If the RF gain is sett too low, degradation can also occur, but this time from too little signal.

The idea is to adjust the RF gain so that there is there is the maximum difference between the highest signal and the noise floor seen between stations - even if the absolute level of the signals may be lower, overall!



[End]

This page stolen from "ka7oei.blogspot.com".