Showing posts with label RTL-SDR dongle. Show all posts
Showing posts with label RTL-SDR dongle. Show all posts

Saturday, September 26, 2020

Revisiting the "Limited Attenuation High Pass" filter - again.

In several previous posts (See:  "A Limited Attenuation High Pass Filter" and "Revisiting the Limited Attenuation High Pass Filter" I described a "high pass" filter that offered low attenuation at high HF frequencies, but a controlled amount of attenuation at lower frequencies - this, to accommodate a fundamental fact about both HF propagation and direct-sampling Software Defined Radios (SDRs):  The two don't play nice with each other!

Note:

If you are using any direct-sampling Software Defined Radio to receive ALL of the HF spectrum simultaneously  - such as a KiwiSDR, Red Pitaya, RX-888, RX-666, TRX Duo to name but a few - you SHOULD read this page and understand why it is important to apply such filtering to maximize performance across HF.

In a typical receiver/antenna configuration, failure to reduce the lower HF frequencies with respect to the top of the HF spectrum (e.g. 10 meters) will result in comparatively poor performance.

As noted in the previous post(s), the problem is two-fold when it comes to broad-band SDRs that are intended to cover the entire HF spectrum all at once:
  • HF noise power and signal level is (generally) inversely proportional to frequency.  At lower frequencies - say, 2-8 MHz - the noise power is far higher than it typically is at around 20-30 MHz.
  • A direct-sampling SDR - or any receiver, for that matter - can tolerate only so much RF power on its front end.  Traditionally, this is a mitigated with the use of narrow-band RF band-pass filters, but this can't be done if one intends to be able to cover the amateur radio bands 160 through 10 meters (1.8-30 MHz).
With the aforementioned issues is yet another one:  Because the noise floor at 10 meters when it is "quiet" is so much lower than 80 meters (perhaps 40-50 dB during noisy nighttime conditions, 25 dB or so during quiet daytime conditions) there is an intrinsic disparity between the amount of sensitivity that is need to "hear everything" at the opposite ends of of the HF spectrum - but since a typical direct-sampling SDR is pretty much "flat", we end up with what might seem like a pair of intractible problems:
  •  To accommodate the very strong signals and high noise levels at lower HF frequencies, the RF signal gain in front of the A/D converter must be carefully set to prevent overload.
  • In order to "hear" the noise floor at 10 meters, the system gain must be set fairly high.

What these two factors, together, imply is that if we have enough gain to comfortably detect the noise floor at 10 meters, our receiver will be badly overloaded during strong-signal conditions on the lower bands.  Conversely, if we scale (e.g. attenuate) the input to accommodate the very large signal excursions, the receiver will simply be unable to detect signals at/near the "quiet" 10 meter noise floor.

Comments:
There will (hopefully) be the day that the upper HF propagation conditions improve greatly with the arrival of solar cycle 25 and at that time, strong signals will appear on the bands >=15 MHz.  When this happens, we will likely be faced with a problem similar to that which we are trying to solve here (e.g. very strong signals overloading the A/D converter).  At this time, the only recourse will likely be a means of using an external device to adjust the gain/attenuation in front of the receiver, probably using the existing I/O lines under receiver control.
Since the original posting of this blog entry I was made aware of an 1977 article on this very topic - you can read it HERE. (The article in question begins on page 3 of the PDF.)

A revised circuit:

Why talk about this issue a THIRD time?  I decided to make one that provided a better 50 ohm match across all frequencies than the previous versions.  This revised circuit may be seen in the figure below:

Figure 1:
Generic pre-emphasis network set for about 50 ohms.
Click on the image for a slightly larger version.


Some readers will recognize the topology of the circuit in Figure 1 as the classic pre-emphasis network found in the signal  path of FM video transmitters.  Whereas those circuits are typically designed for 75 ohms, this one is intended for a 50 ohm system - but careful observers will notice that 47 ohm resistors are used, instead:  For receive-only purposes, I have chosen the components in this article to be standard values at the expense of a slight increase in mismatch - but the VSWR of these circuits, when terminated at 50 ohms - is likely to be no more than about 1.1:1.

This circuit - compared with the previous versions - has the advantage that it presents a consistent source and load impedance across the frequency range, making it a bit more "friendly" in systems that may be impedance sensitive (e.g. following a band-pass filter, long coaxial cable runs, following/preceding conditionally-stable RF amplifiers.)  The obvious trade-off is that as compared to the previous version (which was based on a high-pass filter and some resistive bypassing) this circuit has definite limitations on how sharp and deep the "knee" may be at any given frequency as only a single inductor and capacitor are used.

By tweaking the values of R1, R4, C1 and L1 we can adjust both the amount of low-frequency attenuation and the frequency of the "knee" where the attenuation takes place - but for our purposes, we will be placing the center of that "knee" around 10 MHz to provide both the minimal loss at 30 MHz and adequate attenuation at and below 7 MHz.

Here are a few examples of values of R1, R4, C1 and L1 using standard-value components and approximate attenuation values at various frequencies:

R1 = 68 ohms  R4 = 39 ohms
C1 = 390pF  L1 = 1uH
DC attenuation:  7.3dB
@ 2 MHz: 7.0dB  @4 MHz: 6dB
@ 7 MHz: 4.6dB  @10 MHz: 3.4dB
@ 14 MHz: 2.3dB  @28 MHz: 0.8dB
R1 = 120 ohms  R4 = 20 ohms
C1 = 330pF  L1 = 0.82uH
DC attenuation:  10.8dB
@ 2 MHz: 9.8dB  @4 MHz: 8.1dB
@ 7 MHz: 5.6dB  @10 MHz: 3.9dB
@ 14 MHz: 2.5dB  @28 MHz: 0.8dB
R1 = 120 ohms  R4 = 20 ohms
C1 = 270pF  L1 = 0.68uH
DC attenuation:  10.8dB
@ 2 MHz: 10.1dB  @4 MHz: 8.7dB
@ 7 MHz: 6.5dB  @10 MHz: 4.8dB
@ 14 MHz: 3.3dB  @28 MHz: 1.2dB
R1 = 100 ohms  R4 = 27 ohms
C1 = 270pF  L1 = 0.68uH
DC attenuation:  9.4dB
@ 2 MHz: 8.9dB  @4 MHz: 8dB
@ 7 MHz: 6.3dB  @10 MHz: 4.8dB
@ 14 MHz: 3.6dB  @28 MHz:1.3dB

Figure 2:
Table showing some possible values for the circuit of Figure 1 and the example attenuation values.

 

In practice, several of these sections will likely need to be cascaded to achieve the desired amount of attenuation at the lower HF frequencies which brings up the question:  Could you not choose components to do this for a single section?  The answer is theoretically, yes - but the fact is that practical inductors - particularly the molded type - are quite lossy, departing from the intended attenuation curve, and achieving the predicted, higher amount of lower-frequency attenuation with a single stage can become problematic - so it's probably better to cascade several of these networks together, instead.

A practical example:

Figure 3:
The exterior of the four channel filter network.
Click on the image for a larger version

A practical example of such a network is one that is to be currently installed in the KFS (Half Moon Bay, CA) KiwiSDR/WSPRDaemon system.  There, four wideband antennas are available to feed the KiwiSDRs on site, so a box was constructed with four, identical pre-emphasis networks, each to feed its own receiver stack.

As is the case at the Northern Utah WebSDR, noise and signals at the lower end of the HF spectrum is often very much stronger than at the high end:  If amplification is added to allow the detection of the noise floor at 10 meters, there is the very high probability that the receiver will badly overload on HF signals from the lower end of the spectrum.

Each "channel" of the device depicted in Figure 3 is identical, consisting of two cascaded sections.  The first section is that from the upper-left quadrant of the table (R1=68 ohms, C1 = 390 pf) and the upper-right quadrant (R1=120 ohms, C1 = 330pF).  Rather than the use of molded chokes, the individual inductors were wound using 30 AWG wire on T25-2 toroids:  17 and 15 turns for the 1 uH and 0.82 uH inductors, respectively.

Figure 4:
The interior of the four-channel network.
The circuit is simple enough to be wired "Manhattan"
style on glass-epoxy PC board material between the
two center pins of the BNC connectors.
Click on the image for a larger version

As can be seen in Figure 4, the construction is very simple, requiring no circuit board at all when using standard, through-hole components.  The circuit was built into a die-cast aluminum box with the BNC connectors holding the piece of PCB material in place.

To secure the components - particularly the small, toroidal inductors - RTV sealant (white) was used to hold components in place and to prevent adjacent wires of C1/R1 and R2/R3 from coming into contact with each other.

This method of construction is very simple and effective, offering good performance into the VHF range when reasonable care is taken.  With the 20mm high dividers between the sections installed as shown, the channel-to-channel isolation exceeded 85dB (the limit of convenient measurement) at 30 MHz.

Figure 5, below, shows the typical response of the sections:

Figure 5:
The response of one of the sections as measured on a DG8SAQ VNA.
Click on the image for a larger version.

Because it can be a bit difficult to read, the values of attenuation and VSWR in the upper-left corner are reproduced below:

Frequency (MHz) Insertion Loss (db) VSWR
0.474 21.4 1.09
1.812 19.9 1.09
3.592 16.6 1.08
5.324 13.4 1.08
7.038 10.8 1.08
10.12 7.4 1.07
14.06 4.7 1.07
18.16 3.2 1.07
21.08 2.4 1.07
24.94 1.8 1.09
28.18 1.4 1.10
50.0 0.4 1.19
Figure 6:
Attenuation and VSWR of the network at amateur band frequencies.
 
Practical usage:
 
For large, broadband antennas and small, active E-field whip antennas, the tendency will be for a relatively "flat" frequency response - but with a small E-field whip antenna, the typical high-frequency roll-off can exacerbate the aforementioned low-HF band overload issue, making a filter network such as the above, even more indispensable.  While an attenuation value of about 17dB at 80 meters may seem to be rather extreme, unless your antenna system has severe low-frequency roll-off at the low end, the noise floor on 80 meters - even during a quiet winter day when the band is dead - should be at least several dB above the receiver's noise floor.

 For specifics relating to a wideband direct-sampling SDR like the KiwiSDR or Red Pitaya, refer to the earlier article linked above - "A Limited Attenuation High Pass Filter".


Set-up:

As mentioned above, a direct-sampling receiver like the KiwiSDR does not have enough sensitivity to "hear" the 10 meter quiet band noise floor at a very quiet receive site. In terms of overall system gain adjustment, a few comments are warranted:
  • A good test is to see if, on 10 meters when it is "dead", you are hearing your local noise floor.  Note the S-meter with the antenna connected and disconnected - preferably, with the input to the receive system terminated with a 50 ohm load when disconnected.  If you do not see an increase in the S-meter reading and on the waterfall by 3-5 dB, the overall system gain is too low to allow the receiver to see the noise floor at your antenna system.
  • If you do not see an increase in noise when the receiver is connected to an antenna, a bit of extra gain is recommended.  Given an ideal isotropic antenna at a very quiet receive site, it will probably take about 12 dB of gain to comfortably "see" the antenna's noise floor - assuming no other losses (coax, splitter, etc.)
  • The preferred location of an amplifier is after the filter described above as it, too, will be protected against the very strong lower-frequency HF signals - even though a device like the above will increase the loss (and noise figure) by about 1.4dB at 10 meters.
  • In cases where there are splitting losses (e.g. feeding multiple receivers) it may be beneficial to split the gain.  A modest-gain amplifier (10-14dB) might precede the splitters - the modest gain being enough to overcome splitting losses and to maintain system noise figure.
  • In the case of a low noise level receive site, the splitting losses may put the 10 meter noise floor below the detection threshold of the receiver and, if necessary, another amplifier may be placed just after the filter described above to make up for it.
  • It's worth noting that if you can detect a 3-5dB increase in noise floor with the antenna connected (versus disconnected) on every band, then even more gain will NOT further-improve system performance:  On the contrary, more gain than necessary will increase the probability of receiver overload - particularly on a direct-sampled SDR that has no AGC in its signal path like the KiwiSDR.  If one has more than 3-5dB of noise floor increase with the antenna connected on 10 meters when it is quiet, it's suggested that several dB of attenuation be added.  The preferred place to add this attenuation is in front of the amplifier to maximize its strong-signal handling - but only if one can still detect the noise floor on the antenna after doing so.  If one has a very high gain amplifier (say 20-25dB) and the gain is excessive, judicious addition of attenuation on both the input and output of the amplifier may be required.
  • When an amplifier is to be considered for HF use, it should have clearly-defined ratings - one of the most important of these is the output power capability (often "P1dB" which is the output power at 1dB compression) which, for a modestly good amplifier capable of handling strong, off-air signals, should be in excess of +20dBm.  Second to this would be the 3rd order intercept point, which should be stated as being in excess of +30dBm - and the higher the better.  Both of these parameters are indicative of how well an amplifier might deal with multiple, strong signals that may be present at the antenna without adding significant distortion of its own.
  • If you wish to pick your own frequency and impedance, the following will get you "close enough".  At the point where a single section of this circuit (as depicted in Figure 1) has an attenuation of about 4.1dB, the reactance of the "L1" and "C1" components will be equal to the desired characteristic impedance of the circuit - which will also be the same as "R2" and "R3".  Unfortunately, other parameters (e.g. the amount of attenuation at a specific frequency) are not predicted by this formula, although it's worth noting that both C1 and L1 will disappear at extremes in frequency and the circuit effectively turns into a resistive attenuator.  For example, C1 disappears (goes to infinity ohms) and L1 goes to zero ohms at DC while L1 disappears (equivalent resistance goes to infinity) and and C1 goes to zero at infinity MHz and one can pretend that these particular components no longer exist (e.g. either a short or open as appropriate).
Addendum:  Comments about the RX-888 (Mk2)
 
The RX-888 (Mk2) is a USB3-interfaced "signal acquisition device" - or an SDR front-end.  Unlike the aforementioned KiwiSDR, it has no signal processing capability at all - it's (more or less) just an A/D converter connected to a USB3 interface.  As such, it can operate at a sample rate of 130 MHz which means that it can acquire the entire HF+6 meter spectrum.  For various reasons (see the link below) it is usually better to operate an RX-888 at around 65 MHz, making it still-useful for inhaling the entire HF spectrum.
 
The RX-888 (Mk2) includes an attenuator (based on the PE4312) and a programmable-gain amplifier (using the AD8370) and this combination means that the noise figure PRIOR to the A/D converter will be on the order of 12 dB or so when the AD8370 is set for the "optimal" gain of about 20 dB:  See the link about signal dynamics of the RX-888 for a better explanation.  Unfortunately, the limiting factor - even with the AD8370 set for maximum gain - is the intrinsic noise of the A/D converter itself more than the components preceding it in the signal path.
 
In this case, I would make the following recommendation:
  • As close to the antenna as practical, place a 10-12 dB gain, low-noise RF amplifier.  This amplifier will be the primary setting for the receive system noise figure and it should have excellent signal-handling properties.
  • The "high pass filter" described above would be placed following the first amplifier.
  • Following the filter, an additional 10-12 dB gain amplifier.  As the attenuation of the filter is relatively low at the frequencies where it really matters (e.g. >20 MHz) the noise figure of the receive system is preserved for these frequencies.  Placing the second amplifier downstream also reduces the total signal power that this amplifier will "see" from lower HF frequencies.  This amplifier should be chosen to have particularly handling of strong signals.
In the case of the RX-888, the PE4312 attenuator is likely not going to be required under any normal circumstances and should be set to "zero" and any attenuation that is needed would be set using the AD8370 amplifier.

Commercially-available version of this filter

Since this article was originally written, Turn Island Systems has produced a commercially-available version of this filter (referred to as the "shelving filter") that includes a 30 MHz low-pass filter - and you may find that here:
This is also available from TAPR as a kit that includes an improved heat-sinking pad:
  • External clock kit and thermal pad:  https://tapr.org/product/rx888-clock-kit-and-thermal-pad/
 
asdf

Pages related to the RX-888:
  • Improving the thermal management of the RX-888 (Mk2) - Link
  • Measuring signal dynamics of the RX-888 (Mk2) - Link
 
This page stolen from ka7oei.blogspot.com

[End]

 

Wednesday, August 14, 2019

Revisiting the limited attenuation high-pass filter for the KiwiSDR (or SDRPlay, RTL-SDR Dongle, Fun Cube, or other SDR receivers)

In the June 18, 2018 entry of this blog (see that page here) I described a device that reduced the lower-frequency (below approximately 10 MHz) by approximately 12dB while leaving higher-frequency signals (pretty much) untouched.

Note:  On 26 September, 2020, I brought up this topic yet again - see "Revisiting the limited attenuation High Pass Filter - again".
 

Since the original posting of this blog entry I was made aware of an 1977 article on this very topic - you can read it HERE. (The article in question begins on page 3 of the PDF.)

Why the need?

The discussion below applies equally to any SDR-type receiver that is connected to an HF antenna.   Some of these receivers have built-in band-pass filtering, but some of these - particularly the RTL-SDR types - may not:  These SDRs, since they are of limited coverage, are better-served with specific "window" type band-pass filters for the frequencies of interest, but the discussion below may still apply.

As it turns out, the KiwiSDR is "sort of" deaf.  Using a variety of measurement techniques, the absolute sensitivity of the KiwiSDR sitting on my workbench at 28.25 MHz was determined to be approximately -155dBm for a 0 dB signal-noise ratio in a 1 Hz bandwidth.

While this may sound impressive, it isn't quite enough to allow the receiver to "hear" the theoretical noise floor of -160dBm (1 Hz bandwidth) at 30 MHz according to ITU-R P.372.7 as depicted in the chart below in Figure 1:

Figure 1: "Typical" noise floor for various radio environments.  Because the above chart is based on a 500 Hz bandwidth, one would subtract 27dB from the power level to scale to a 1 Hz bandwidth.
While it is likely that most RF environments - typically urban environments - are above the "Quiet Rural" line depicted in Figure 1, it does show that if you happen to place the KiwiSDR in a particularly quiet location, it will not "hear" the signals that are right at the predicted noise levels.  If there are other losses in the system - such as those caused by the cabling or splitters (e.g. for multiple receivers) the situation could get even worse.

The obvious answer is to add an amplifier:  Assuming no other losses, about 10dB is more than enough to overcome the KiwiSDR's noise floor - plus "a bit extra" to minimize the dilution by the receiver's noise.

There is a problem with doing this is hinted at the nature of the graph itself.  As one can see, the noise at 5 MHz is nearly 20dB higher than that at 30 MHz.  While this means that the intrinsic sensitivity of the receiver is more than adequate at these (lower) frequencies, there's another problem:  Signals at these lower HF frequencies will also be very much stronger.

It was observed that the KiwiSDR would exhibit an A/D converter overload (at 28.25 MHz) at -15dBm - and while this is a much higher level than the signal levels depicted in the chart above - because Figure 1 just depicts the noise level - the fact that the receiver itself is inherently broadband, much more noise is intercepted.  For example, if we were to re-scale the above power levels for a 5 MHz bandwidth, the noise power alone would be increased by 40-ish dB.

This does not take into account that the frequency range below 10 MHz is replete with strong signals in most parts of the world - particularly at night, some of which have been measured to be stronger than -30dBm - and there are multiple signals of this sort that are present, the total power of which can be cumulative.  What make things worse is that on these frequencies there are very often strong static crashes - particularly in the summer - that may be equal or stronger than the signals present in their "S-meter" reading, but these crashes are inherently broadband, which means that the receiver is intercepting much more signal than the signal meter will indicate.

The "solution" to this is to put the (overall) signal gain where it is needed:  Amplify the high-frequency (e.g. above approximately 10 MHz) signals more than the low-frequency signals - and one way to do this is to construct a filter that attenuates the lower-frequency signals without bothering the higher-frequency signals.

But the previous filter already does this!

The original filter that does this has been in service for months, now - and it has been working very well, but when I installed it, I overlooked something:  The gain of the antenna being used drops off precipitously at MF and LF frequencies.  What this meant was that with the 12 dB or so drop in signal level by the time one gets to 7-8 MHz persisting down to DC, the signals on the 630 meter amateur band (and lower, for that matter) are also attenuated by the same 12dB - but these same signals - from the antenna - are already dropping off, potentially putting these lower-frequency signals (again) below the KiwiSDR's noise floor.

Reworking the filter:

To that end, I re-worked the filter.  Previously, it was simply a 3rd-order high-pass filter with some "bypass" so that a limited amount of the lower-frequency energy would be allowed through and this meant that from the cut-off frequency down to (essentially) DC, there would be 12-ish dB loss.  What I needed, instead, was to affect the lower HF frequencies, but leave the very low frequencies alone.

There was a complication:  The signal path for the KiwiSDR already includes an effective filter for the AM broadcast ("mediumwave") frequencies (described in the 15 February, 2018 blog entry - "Managing HF signal dynamics and preventing overload with the RTL (and KiwiSDR) receivers" - see that page here) and to have both sets of filtering in series - as it is now - would mean that the KiwiSDR would have difficulty hearing weaker signals on the broadcast band - as it does now.  This meant that I needed to reject frequencies between approximately 1.7 MHz to 10 MHz, but leave the signals outside that range alone.

For this, the free "ELSIE" program came to the rescue:  A 3rd-order Butterworth filter, centered on 4.2 MHz with a 10 MHz band-pass was determined to provide the necessary rejection at the boundaries and like the previous filter, it, too, would have a controlled amount of bypass to allow some signal to pass through it as the diagram in Figure 2, below, shows:

Figure 2:
The response plot of the limited-attenuation band-stop filter.
Its effect is limited from the top end of the AM broadcast band and down, having at least 10dB of attenuation from about 1.8 MHz and 8 MHz with 13-15dB being more typical between these frequencies.
Click on the image for a larger version

The schematic of this device of may be seen here:
Figure 3:
Diagram of the limited-attenuation band-stop filter.
Click on the image for a slightly larger version.


If you have visited the 15 February, 2018 page, you will notice very distinct similarities between its main filter element and this circuit, right down to the application of signal "bypass" to set a maximum amount of attenuation that can occur.

In this filter, L1/C1, L2/C2 and L3/C3 are resonated to 3.7 MHz with the values selected to provide the desired attenuation at the frequencies at which the cut-off is to begin.  In this case, this filter is a slightly-tweaked version of a 3-pole Butterworth filter designed for a 50 ohm termination and has a theoretical 3dB passband of 11 MHz centered at 3.7 MHz.  The theoretical -6dB points of basic filter - ignoring R1/R2/L4 - is approximately 1.6 and 8.5 MHz with the -1dB points occurring at around 1.1 and 11.8 MHz.

Components R1/R2/L4 provide a degree of "bypassing" that leaks a controlled amount of signal around this filter:  Without these components, the attenuation could be in excess of 60dB near 3.7 MHz, but as can be seen, the actual attenuation is around 14dB, +/- 1dB or so.  While a simple resistor could have been used to accomplish this, the L4 slightly reduces the attenuation at the high end of the HF spectrum while R2 suppresses some of the asymmetry seen in the bottom of the attenuation curve that is caused by L4.


Figure 4:
As-built limited-attenuation band-stop filter.  This circuit - later put in an enclosure - is built "Manhattan" style using a combination of molded and toroidal chokes.  The BNC connectors visible were temporary, used only on the workbench for testing and characterization.  L1 and L2 are the black devices about the center, L2 is the red toroid in the foreground and L4 is the molded choke located close to the center pin of the right-hand BNC connector.
Click on the image for a larger version.

Comments:
  • As can be seen from the Smith chart in Figure 2, this filter provides a 50 ohm match only at frequencies removed from the portion where the attenuation is occurring.  For this reason it is recommended that this filter be placed fairly close to the receiver (or splitter, if several receivers are being used) - this, to prevent impedance transformation on the line.  Similarly, it is recommended that this filter be preceded one stage of amplification to source the filter with something near-ish 50 ohms.
  • If amplification is used for the receiver, it is suggested that the bulk of amplification be placed immediately after this filter:  The attenuation at the lower frequencies will reduce the probability of amplifier overloaded by the often-strong signals at these frequencies as well as the summer static.  The impact of the filter on the system noise figure at low frequencies is offset by the typically-high noise level while the low loss of the filter at higher frequencies which means that there will be little overall impact at the high end of the HF spectrum.
  • In the case of the KiwiSDR system at the Northern Utah WebSDR, the total amount of amplification is about 22 dB in two stages:  At least 10dB is required in the overall system just to bring the receiver's noise floor (at 30 MHz) below the "rural quiet" noise floor - and there are likely to be other system losses that require even more amplification.  At the Northern Utah WebSDR, there is about 5 dB of loss between the antenna and the first amplifier, and there is an additional 6.5-7dB of loss in a four-way splitter to feed all of the receivers, so the overall 22dB gain in the system is about right.

This page stolen from ka7oei.blogspot.com

[End]



Monday, April 15, 2019

Applying outboard AGC and filtering to RTL-SDR dongles to maximize usable dynamic range on HF


An AGC system for RTL-SDR "wideband" receivers
operating in "Direct" (Q-branch) mode.

 A quick description of RTL-SDR dongles:

Figure 1:
An "RTL-SDR.com V3" 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.
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 a 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.  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 produced by the device reduce the number of usable A/D bits and thus the dynamic range - 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 over 50dB, under some circumstances - but having 50-60 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 and to avoid the complication of a discussion about aliasing, we'll limit the frequency range to 30 meters (10.15 MHz) and lower - a range that encompasses what are, in the current low end of the sunspot cycle, the two most popular HF bands:  40 and 80/75 meters.

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:
  • If one adjusts the signal level going into the dongle to optimize being able to hear weak signals during the day (e.g. the background noise of the band driving the A/D converter to 10-15% full scale indication) it is likely that strong nighttime signals - both amateur and broadcast - will (more or less) saturate the A/D converter (e.g. put it into the range of "clipping"), degrading performance considerably.
  • If one adjusts the signal level into the dongle to accommodate the very strong signals (which is only a "best guess" as such signals can vary by 10s of dB) then the input level to the dongle under "quiet" band conditions will be so low that sensitivity will suffer and spurious signals can appear everywhere as too few A/D converter bits are being "tickled" causing images and intermodulation distortion.
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"!


Applying an AGC (Automatic Gain Control):

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.
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 their overall 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 (excessive) "clipping".

Such is the case with these 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 signal levels in the "sweet spot":  A properly-designed AGC can do this.

In short, the signal path and method is as follows:
  • The signal comes from the antenna.
  • Bandpass filtering for the band of frequencies is applied.  The narrower the bandwidth and "sharper" the filtering, the better.
    •  Important:  One should never connect a receiver - particularly one with limited dynamic range - to an antenna without a band-pass filter that is designed to limitf the applied signals to the range of interest. (In other words:  Don't waste your time trying to make an RTL-SDR dongle work on HF without a suitable HF bandpass filter for the frequency range of interest - no matter which RTL-SDR dongle you use, filter out all but the frequency band in which you are interested.)
  • On the output of the filter is an electronic attenuator.
  • The signal level on the output of the filter (which is also being applied to the dongle) is measured.
  • If the signal level exceeds a set threshold, the amount of attenuation is increased to cause it to remain at/near that threshold.
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 WebSDR, 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" on 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 current 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.

Comment:
You can check out the device depicted in this article yourself - simply go to the Northern Utah WebSDR and listen on the "60 Meter" and "30 Meter" bands on WebSDR #1 and WebSDR #2, respectively, or to the "90/80 Meter" and "41/40 Meter" bands on WebSDR #3.  All four of these bands use RTL-SDR dongles with the described AGC device.
Figure 3:
Schematic of the gain control block.  See notes below if a "standard" DBM is used.
Click on the image for a larger version.
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 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 all that is available - but they tend to do worse at overall higher signal levels and one should attempt to find a proper attenuator like the LRAS-2-75 or similar.  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 while causing minimal circuit loading.  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 - or even local VHF/UHF amateur transmissions - and be somewhat "desensed".  Practically speaking, this may not be a problem - particularly when it is placed inside a shielded container, behind bandpass filtering - 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 (after having been passed through the filter) 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 of -40dBm, no additional RF amplification is necessary in front of U2.

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.
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 to set a low impedance point, and this DC signal 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 the threshold set by R4, 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 bandpass filter's 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 - and even if it was at all noticeable, it will be placed in a metal box, anyway.

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 with varying temperature 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:
  • Pre-set the wiper of R4 (the 10 turn pot) to ground (zero volts at U1b, pin 5)
  • Set a signal generator it to a frequency within the passband of the filter and an RF level of around -20dBm.
  • Connect the input of the dongle to the signal generator and tune it to the frequency of the generator using software of your choice.  Make sure that the "direct - Q" signal path is selected since we are not using an upconverter.
    • If using SDR-Sharp, tuning in the signal (using AM is best) "hovering" the mouse over it on the waterfall display should give a dBFS reading.
    • If using the "HDSDR" program, the "dBFS" reading will appear on-screen in the receiver control panel.
  • Using the software, monitor the level of the applied RF signal's "dBFS" (dB with respect to full-scale).  Ideally, a full-scale A/D indication would yield a dBFS reading of around -6dBFS, but it seems that the internal scaling of the signals from an RTL-SDR dongle aren't scaled, so the reading may be in the -30 to -50 dBFS range.  Monitor the "dBFS" from the dongle while increasing/decreasing the signal and note the highest value.  The goal here is to determine the reading given by the program.
    • Ideally, one would like to be able to see the "recent-highest" reading of the A/D converter of the dongle, but this may not be available in the programs used with the dongle.
    • If adventurous, one can use the "librtlsdr" tool called "rtl_sdr" and dump the results to a file or a display program to monitor the raw A/D values.
    • If you operate a WebSDR using the PA3FWM software there is a utility that will directly read out the number that we want to look at:  Contact me directly for details.
  • Having determined the maximum-displayed "dBFS" level, connect the signal generator to the input of the bandpass filter and the RTL-SDR dongle to the output (e.g. J2 in Figure 3) with the frequency set to the center of the desired frequency range (usually - but not always - the middle of the filter's passband).  The amplitude of the signal generator is set for level higher than one would reasonably expect to see on the input - say -20dBm.
  • At this point the LED should not be illuminated and U3 will offer maximum attenuation.
  • Slowly increase R4 until the LED just starts to be illuminated.  Watching the "dBFS" reading, adjust R4 for a signal level that is about 6dB below the maximum reading that you'd previously obtained.  Ultimately, you will want to set the peak A/D output to between 1/4 and 1/2 of full scale which represents -12 to -6 dBFS, respectively.
  • If the circuit is working properly, any signal above that corresponding with the threshold should be limited at the set value by automatically setting U3's attenuation, but a total signal power level below the threshold should cause U3 to operate at minimum attenuation as indicated by maximum LED brightness.
    • If you are using a signal generator with a built-in "step" attenuator, changing signal levels may cause momentary "glitches" of high signal that may cause a momentary disruption in the A/D reading and slightly upset the AGC:  Simply wait for a few seconds after making an adjustment for the readings to settle after making a change.

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.

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 from a test generator.  In the weeks that followed, these receivers were monitored during high-signal conditions and it was noted that there had been no obvious problems.  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 usually 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.

Not mentioned previously, this AGC system can skew the S-meter readings from the receiver somewhat.  In the presence of strong signals, the AGC will lower the overall system gain causing the readings to vary and appear low.  In theory, one could monitor the voltage being applied to bias the attenuator and relate this to the amount of attenuation and offset the S-meter readings, but this may be overkill in most situations!




The above article was posted (by me) as a technical article at the Northern Utah WebSDR (link).

While the circuitry could be integrated onto a small circuit board, this has not been done as the circuits are quite simple and easy to construct as depicted.

* * *

This page stolen from ka7oei.blogspot.com

[End]