Scope
This page is about gain control, including automatic gain control, of the various radio hardware one might use, as well as processing within rtl_433
. It assumes a basic command of the concept of gain, and of dB, but does not assume familiarity with the block diagram and receiver operating theory of any particular hardware.
This page presumes that one is running an up-to-date version of rtl_433
. Because there are not frequent releases, this more or less means git from within 30 days.
This page is very much a work in progress and quite unbaked. So far, it doesn't really attempt to discuss direct-sampling mode, or other than RTL-SDR.
RTL-SDR dongles
An RTL-SDR dongle contains a tuner chip and a Realtek RTL2832U, more or less by definition.
An important difference is which tuner is used, particularly for this discussion.
For now, we focus on the R820T and R820T2. \todo Expand
librtlsdr
There is a library librtlsdr
, and there are multiple versions of this library; those choosing to run old software ("LTS") might not have an up-to-date version. This page presumes that you have 2.0.1 from
https://osmocom.org/projects/rtl-sdr/wiki or equivalent.
See rtlsdr_get_tuner_gains
which talks about gain being in 0.1 dB units, and gives a list for E4000 tuners (only).
One can set gains for 6 separate stages for the E4000.
See rtlsdr_set_agc_mode
which sets the AGC mode of the RTL2832, which is digital AGC on or off.
\todo Add link to block diagrams.
gain distribution
There is a gain stage in the tuner and also one in the RTL2832. There is confusion about which stage is being talked about when one says "AGC" or fixed gain.
\todo Explain "digital AGC".
https://github.com/merbanan/rtl_433/issues/1749
software AGC
https://www.rtl-sdr.com/a-software-based-vga-agc-implementation-for-the-rtl-sdr/ https://github.com/wizardyesterday/RtlSdrDiags/blob/master/doc/agcResearch/README.txt
\todo Discuss.
radios used via SoapySDR
\todo Write!
rtl_433 switches
-Y autolevel
\halfbaked This seems to be about detection code running on IQ samples, where it does not insist on signals being nearly full scale, by finding the thresholds dynamically. \todo Explain this for real when clear!
-g N
See https://triq.org/rtl_433/OPERATION.html#input-gain
For RTL-SDR, 0 for automatic gain, other values for specific gains. \todo This is very likely for the tuner gain, but confirm.
There is a fixed set of allowable gains, which is queried. A user-requested gain is then replaced with a value from that set which is the smallest value that is >=, except that a very large requested gain gets the max value.
It is not clear if the AGC range is larger than, smaller than, or equal to the set of manual gains.
Note that many signals will have signal strengths that are just below 0 (full scale), and about-0.5 is typical. This more or less means that the AGC put the signal in the right place. This then means that the noise value for that packet should be interpreted as relative to the signal; there is no absolute calibration with AGC enabled.
\todo Explain what the "noise" values are during periods of no signal. AGC will turn gain up high, and without knowing what it did, this isn't really meaningful. This is in contrast to a radio with an AGC voltage driving an S meter.
-t digital_agc=1
Set the digital AGC on (default off) for the RTL2832. \todo There's an implication that there is no analog variable gain in the RTL2832 - confirm and give a datasheet reference. Conventional wisdom is that this mode probably should not be used, but published data from rigorous experiments is lacking.