Thoughts on optimizing gain

You can’t. Forget about the AGC - The detailed explanation is too technical for this thread, but the global idea is that the behavior of the AGC is not instantaneous. It needs to learn about the signal before taking any action. With Mode S (and any short lived signals), it will be always lagging behind the signals.

Here we go.

If you add 20 dB of external gain, you need to compensate for it with some attenuation to keep the signals at the analog front end (AFE) in the expected amplitude range. The overall optimization targets the lowest noise figure still greater than the ambient system noise figure at the highest possible linearity. That’s why we have a gain setting in Airspy, which is actually a programmable multi-stage attenuator.

So, what should I do?
As a rule of thumb, always adjust the gain of the receiver according to your total external gain = gain of the antenna + gain of the preamp(s)

Fully exploiting the available dynamic range is the art of matching the minimum and the maximum signal levels out of your transmission line to those of the receiver.

Things to avoid:

  • Too much gain will reduce the available dynamic range which will cause overload with strong signals.
  • Too little gain will simply miss the weaker signals and the available dynamic range won’t be fully utilized.

Misconceptions:

  • Stop using the ADC saturation or any dBFS reading as a metric for signal quality. Receivers are much, much more complex than that. If the gain distribution is not right (RF gain, Mixer conversion gain, IF gain) , you can easily end up with bad reception quality regardless of the ADC saturation, and still have good readings. SNR is a much useful metric to use, but it is not necessarily trivial for everybody.
  • ADC is not everything. There’s a very long chain of analog processing in front of the the ADC, and analog is not perfect. The dynamic range of a properly setup R820T2 is about 100 dB. That’s a huge figure actually, but to reach it, you need to learn about gain distribution (again). In the Airspy design, we took care of matching the ADC to the tuner in every possible way. In the end, you just need to find a single number for a composite gain setting - check below.
  • More gain is not necessarily better. By default, airspy_adsb uses the “Linearity” gain mode, which optimizes for the linearity and delegates all the “sensitivity” to the external preamp. Every value corresponds to 3 different gain settings in the R820T2: RF, Mixer and IF. Check this table for the actual values.
  • ADC saturation is not bad. As long as your RF front end is not saturated, you can still recover Mode S frames even if the ADC is saturated. That’s possible because the ADC will just clip the signal and make it look like a square instead of a sine. Since we only care about the presence or the absence of a carrier (OOK modulation) at a certain phase, the ADC clipping doesn’t harm the decoding. If this phenomenon didn’t exist, the little RTL dongles and other specialized receivers (like Beast) that use 8bit ADCs won’t be able to see much. At the end of the day, you will see that other parameters matter: Sampling rare (= timing resolution) and the analog processing chain.
4 Likes