Thank you to Chris Gianakopoulos for writing in and sharing with us the release of his open-source software-based Automatic Gain Control (AGC) library written in C. The library is hardware agnostic and designed to make it easy for programmers to implement an AGC algorithm into their programs. The AGC library can help automatically optimize the signal-to-noise-ratio (SNR) on SDRs with variable-gain amplifiers (VGA). Chris explains:

I converted my software AGC to C code with the following enhancements:

1. It is radio-agnostic.
2. Itis written in C so that both, C and C++ apps can use it.
3. The app provides two callback functions: one to provide the current amplifier gain setting and one to set the amplifier gain.
4. A signal magnitude is provided as input to the AGC algorithm
5. Among other things,the number of bits to represent the signal magnitude, at init time.

For more details, the repo is located at,

https://github.com/wizardyesterday/AutomaticGainControl

I have successfully integrated this AGC into a test version of radio diags, located at

https://github.com/wizardyesterday/RtlSdrWork_agc

-----

An Automatic Gain Control (AGC) is a feeback system that adjusts the gain of a variable-gain amplifier (VGA) to maintain an operating point such as a voltage magnitude level, current magnitude level, or in the case of a digital radio, the magnitude of signal samples presented to the AGC. Typically, an average magnitude of a block of data is used to perform a smoothing action to the input provided to the AGC.

An attempt was made to make an accurate implementation of what was described in the paper (by Fred Harris and Gregory Smith) in the doc/papers/ directory. For details on design and implementation, refer to that paper.

He goes on to mention why a software AGC is useful:

My motivation for creating an AGC was to give people the ability to run SDR software on radios which conain A/D converters that produce 8-bit output samples. With a 48dB (theoretically, ignoring implementation loss), you don't have much to work with in a radio environment with radically different signal strengths.

With an amplifier, whose output drives an A/D converter, on the rtl-sdr, when I listened to aircraft frequencies, I would hear strong tones when a strong signal would be received. The solution was to reduce the LNA and mixer gains.

I asked myself, why would I want to reduce front-end sensitivity when signal overload was not occuring at the variable gain amplifer input? It was A/D converter overload!

With an AGC, the user can establish a safe operating point that allows enough headroom to avoid overload when a strong signal arrives. When the signal goes away, the gain is increased so that you can hear weak signals.

Hopefully, developers of SDR software will see this and implement it into their software!