Nothern Utah WebSDR Logo - A skep with a Yagi Northern Utah WebSDR
Receiving equipment
An AGC system for RTL-SDR "wideband" receivers
operating in "Direct" (Q-branch) mode.


Figure 1:
An"RTL-SDR.com" USB-based receiver - one of the better, "cheaper" options out there.
This unit has been programmed and marked with its own, unique (to the system) serial number.
Click on the image for a larger version.
RTL-SDR Blog USB receiver, used for HF through UHF

A quick description of RTL-SDR dongles:

The so-called RTL-SDR dongles are ubiquitous and versatile because they can cover (more or less) from a few hundred kHz to over 1.3 GHz using various on-device signal paths - but all of these signal paths have in common one important limitation - The A/D converter is only 8 bits.  Despite these limitations, they are attractive because they are cheap - from $4 for the "bottom end" and cheapest devices (which are far noisier than they could be) to well over $50 for units with frequency converters and a few other bells and whistles - including band-pass filters.  The devices that we are using are just $20 and are the RTL-SDR dongles sold by "RTL-SDR Blog":  These units have thoughtfully-designed circuit boards that minimize extraneous, spurious responses and include 1ppm TCXOs for decent frequency stability as well as providing separate signal branches for "direct" and "quadrature" signal paths for frequency ranges below 30 MHz and above around 60 MHz, respectively.

Ideally, the maximum range represented by an 8 bit A/D converter is around 48dB - and this is approximately what can be expected from these devices - but as with most things in the real world, the actual answer to the question of "what is the dynamic range" is more complicated.  In reality, noise considerations of the device reduce the number of usable A/D bits and thus the dynamic range, this noise coming from the device itself and other devices in the signal path - but due to what amounts to oversampling and the contribution of the noise that is always present on HF which can effectively "dither" the A/D converter, the apparent dynamic range can "seem" to be somewhat greater - perhaps well in the 50dB range, under some circumstances - but having 50 dB or so of usable dynamic range is not nearly enough for reasonable performance on the HF bands under a wide variety of signal conditions.

"But the Dongle already has an AGC!"

One advantage of using a dongle with an upconverter - a device that would, say, converter 0-30 MHz to the range of  125-155 MHz - is that it then places these signals within the range where the R820T chip can operate - and this chip does have RF filtering and a sort of AGC - at least by way of being able to have its gain adjusted by software.

Aside from the frequency drift issues related to this frequency up-conversion mentioned elsewhere, the problem with this is that the R820T chip really isn't that "strong" in terms of  its ability to handle widely disparate signal levels.  While the RTL2832 chip does have an AGC or sorts, the gain of both chips in the signal path must be carefully controlled to maximize performance.  Unfortunately, the precise nature of how these all work together isn't well documented and the general consensus seems to be that at HF, it doesn't work all that well.

While the built-in AGC can work, we decided to avoid combining the somewhat marginal performance of the R820T signal path and the unknown nature of the AGC operation with the already-marginal 8 bits of A/D conversion in favor of an external AGC system operating within the well-defined limits of the dynamics of these devices when they are operated in "direct" mode.

The problem:

In this specific case, we are using the "Q" branch of the RTL-SDR dongle for direct reception of HF signals:  For the purposes of this discussion, we'll limit the frequency range to 30 meters (10.15 MHz) and lower - a range that encompasses what are, in the current sunspot cycle, the two most popular HF bands:  40 and 80/75 meters.  Operating in this range avoids the issues with aliasing mentioned above:  Read the page RF Downconverter for RTL-SDR receivers for a more thorough description of the issues.

In some circumstances and with careful adjustment of RF levels, the limited dynamic range of the RTL-SDR dongles is "almost enough" - but because HF conditions widely change the "optimal" amount of signal getting into the dongle goes all over the map:  During the daytime on 40 meters, noise can be very low and there are very few truly strong signals, but in the evenings or mornings there can be very strong signals from high-power shortwave broadcast stations.  These disparate situations cause some problems:
As mentioned before, the A/D converter's 8 bits do provide roughly 50dB of overall signal-handling range, but using one of these devices on HF soon makes it clear that one must constantly adjust the input level to assure that that 50dB "window of usefulness" is in the right place.  Using 60 meters as an example again, a "quiet" band in a good location may yield around -107dBm of noise in an SSB bandwidth, but a powerhouse shortwave broadcaster's signal can be into the -35dBm range - nearly 70dB higher than the noise (and there may be more than one of these strong signals!) which represents a range of at least 70dB.  What's worse, taking into account the need to provide 10-15% of A/D deflection just on the background noise on a quiet band for the dongles to work properly (to avoid serious issues with quantization-related distortion) roughly half of the 50dB or so available to us is already "used"!
Figure 2:
Inside the 4-channel filter and AGC gain block module.  The individual band-pass filters may be seen at the far end of the lid-mounted PCB ground plane while the actual detection and control circuitry is on the prototype boards in the foreground near the bottom of the picture.
Click on the image for a larger version.
Inside the 4-channel filter and AGC module


Applying an AGC (Automatic Gain Control):

Any RF-based digital direct-sampling (or analog!) receive system - to maintain optimal performance - must have its input levels constrained, which is to say that one must take into account both the lowest and the highest signal levels.  In some cases it is simply enough to amplify/attenuate the input levels so that the expected signals will always fall in that range - and this may be practical on VHF/UHF or microwave, but it is certainly not the case at HF.  Even if we were to use a higher resolution A/D converter, we would still want to do this to keep all of the input signals within the "sweet spot":  Direct sampling HF transceivers such as the Icom IC-7300 and IC-7610 must apply both "strong" band-pass filtering and input gain control to maximize the performance.  In general, the more signal we throw into the A/D converter, the better - as long as we don't overdrive it and cause "clipping".

Such is the case with the RTL-SDRs:  For best performance, one must have BOTH "strong" input filtering centered around the frequency range of interest (the narrower the better!) and keep the signals in the "sweet spot":  A properly-designed AGC can do this.

In short, the signal path and method is like this:
In short, the above system prevents the combination of all signals from getting to the dongle from consistently exceeding a pre-set level.  In this way, one can run a bit of "extra" gain to get the best weak-signal performance, but prevent the system from being hopelessly overloaded when very strong signals appear.

A practical implementation:

To maximize performance of the RTL-SDR dongles used for HF reception at the Northern Utah SDR, a "prototype" module consisting of four bandpass filters and four AGC gain blocks was constructed - see Figure 2.

Bandpass filters for 90-80 meters, 60-49 meters, 41-40 meters and 31-30 meters were constructed "Manhattan Style" pieces of glass-epoxy circuit board material as individual filter modules which were then secured to the main ground plane - a larger piece of PC board material mounted in the lid of a Hammond 1590D aluminum enclosure.  Three dividers - also made of circuit board material - provide shielding between each of the band modules.

Constructed on small pieces of phenolic prototype board are the circuits that detect the RF and derive a control voltage for the electronic attenuators.  These devices are mounted, elevated above the ground plane and attached to the shield walls which provides good RF grounding and a DC return path:  Two smaller "walls" are located at the far ends to provide the two boards at the ends with solid attachment points.
Figure 3:
Schematic of the gain control block.
Click on the image for a larger version.
Schematic diagram of the AGC control block

Circuit description:

Figure 3
shows the gain control block schematically.

The input signal passes through the band-pass filter (shown as a block) with its output connected to a doubly-balanced modulator module, U3.  These devices are nearly identical to standard diode-ring doubly-balanced mixers, except that they are optimized for operation as an attenuator or baseband modulator:  The attenuation through them is inversely proportional to the logarithm of the current applied to the "CTL" (control) port.  In this case I used the Mini-Circuits LRAS-2-75 modules, originally designed for 75 ohm systems, but they work just fine at 50 ohms as well - being chosen because they are some of the lowest-cost components of this type offered by Mini-Circuits Labs.  The "official" specifications of the LRAS-2-75 gives specifications down to just 10 MHz, but it works fine at at least 3 MHz with just an extra dB or two of insertion loss.

Figure 3 gives a list of other suitable devices - some of which are rated down to lower frequencies than the LRAS-2-75.  Figure 3 also mentions the use of a standard doubly-balanced mixer such as the Mini-Circuits SRA-1:  A standard mixer will also work acceptably in this role if that is what is available.  If a standard doubly-balanced mixer is used, make sure that it has a port that provides a direct connect to its internal diodes to which the bias may be applied:  While this is usually the "IF" port, some devices have this particular port otherwise designated.  The presence of the diodes can be easily checked by using the "diode" function of a DVM between the device ground(s) and the control pin, observing a 0.2-0.3 volt drop in both directions/polarities of the meter.

The output of the attenuator (U3) goes two places:  To the RTL-SDR dongle being used for reception, and to the input of U2, an Analog Devices AD8307 logarithmic amplifier.  This device's input impedance is quite high, so a 470 ohm series resistor (R6) is used to lightly "tap" the RF coming out of the U3.  Included across the input pins of U2 is a low-value capacitor - typically in the 33-56pF range (as noted on the diagram) that is connected very close to the device to quash its response at VHF/UHF while minimally affecting HF signals:  Without this capacitor, U2 can easily detect any local FM or VHF/UHF TV broadcast signal and be somewhat "desensed".  Practically speaking, this may not be a problem - particularly when it is placed inside a shielded container - but this can be distracting when the circuit is on the workbench being tested.


The output of U2 is a logarithmic response of the total RF energy being applied to its input, the voltage increasing by approximately 250 millivolts for every 10dB of increase in signal:  If reasonable construction techniques are applied, signals well below -70dBm can be measured.  Because the maximum signal level (e.g. A/D converter clipping) of the "RTL-SDR Blog" dongle is in the range -40dBm, no additional RF amplification is necessary.
Figure 4:
Two of the gain control modules with U2, the AD8307s being partially obscured by the ferrite beads.  These beads are used to decouple any stray RF from the common 12 volt supply line powering the modules.
Click on the image for a larger version.
Close-up of two identical gain control boards

U1 must be an op amp capable of operating down to the negative rail in order for this circuit to function and the specified LMC660 is ideally suited.  The DC output of U2 is applied to U1a, one half of a dual op amplifier, wired as a unity-gain follower which is then applied, via R5, a 1 Megohm resistor to U1b, which is configured as an integrator by virtue of a 0.1uF capacitor placed in the feedback path with the threshold being set by R4, a 10 turn potentiometer.  If the integrated DC signal from U2 is above this threshold, the voltage output of U1b decreases, reducing the bias applied to attenuator U3 and increasing its loss, but if the signal is below the threshold, the voltage increases, decreasing the attenuation.  By this action, the combination of U1 and U2's action will prevent the average signal at the RF output from exceeding the threshold level set by R4.  Whereas a typical AGC found in a receiver will have a fast "attack" and a slow "decay", we want this AGC to be comparatively slow to respond so that it will (hopefully) not be completely deafened by the occasional static crash.  In reality, allowing the A/D converter to hit full-scale on occasional peaks will have minimal apparent impact on reception.  In the absence of broadband static crashes, the cumulative power within the bandpass filter's range will change comparatively slowly over time and it is this that we wish to track.

In the DC path between the output of U1a and the "CTL" pin of U3 is a series LED which provides both a bit of logarithmic current response intrinsic to semiconductor diodes as well as providing a handy visual indication of the state of the circuit:  If the LED is lit, attenuation is low, but if it is very dim or turned off, more attenuation is being applied.  In testing, the photosensitivity of LEDs was simply a "non issue" and ambient light had no discernible effect on circuit operation.  Resistor R3 provides current limiting to the diode while R2 provides a current sink:  The combination of R1 and C1 (located very close to U3) terminate the "CT" port (at high frequencies) at the nominal impedance of the RF portion - in this case, around 50 ohms.  Also included is U4, a 5 volt regulator:  This supplies power for U2 as well as provides a stable reference voltage for R4, the RF threshold adjustment:  It need not be exquisitely stable with temperature as several dB change of the AGC threshold is of no importance in this application.

Under normal "quiet" conditions the RF level going into U2 will be too low to exceed the threshold, causing the output of U1b to go to maximum voltage, biasing U3 to set minimum attenuation - it is only in the presence of stronger signal(s) that the gain reduction will occur.

Circuit calibration:

To calibrate the circuit, a signal generator is required, the procedure being as follows:

Figure 5:
Two bandpass + attenuator (U3) modules.  The inductors/capacitors of the filter may be seen in the middle of the individual boards while the attenuator (U3) is the white object seen in the lower-right corner of each board.  U3 is wired "dead bug" style in each case.
Click on the image for a larger version.
Two bandpass filter and attenuator modules
Observations in use:

So far, these devices seem to be working as intended.  Even with higher overall gain in the signal path than before (e.g. when band conditions are poor and/or there are no strong signals in the filter's passband) the RTL-SDR dongles have not been observed to show obvious signs of overload when extremely strong signals are present - this, having been a problem previously.  Initially, the AGC threshold was set for -6dBFS (1/2 A/D scale) using a CW signal.  In the weeks that followed, there had been no obvious problems, so the AGC threshold was later reset for -12dBFS (1/4 A/D scale) and an additional 6dB of RF applied to the receivers with no obvious degradation in performance in the presence of strong signals, but a slight improvement in weak-signal performance when the bands were "closed".

In looking at receiver stats, there are still instances of A/D "clipping" - but this is to be expected:  The AGC circuit integrates the level over time (perhaps a few seconds) and brief excursions well above the threshold level are to be expected, both from static crashes, but also coincident modulation peaks of several strong shortwave broadcast signals.  Because the "occasional" clipping typically has little apparent impact on the receive signals (particularly the narrowband signals on shortwave frequencies) this effect isn't noticed.

On some of the bands, a bit more RF signal is needed to optimize performance - that is, to "tickle" more A/D bits when signals are weak.  Previously, doing so would risk gross overload of that receiver when the band "opened" with strong signals, but the AGC block should minimize any such issues.




Pages about other receive gear at the Northern Utah WebSDR:
Go to the main "RX Equipment page.


Additional information:
 Back to the Northern Utah WebSDR landing page