Before this:Demodulation in code
Gain & automatic gain control
Key takeaways Received signals fade and surge, but a demodulator compares against fixed decision levels, so it needs a stable amplitude. Automatic gain control (AGC) is a feedback loop that measures the signal’s level and adjusts gain to hold it near a target — turning gain down on strong signals, up on weak ones. It’s what keeps symbol decisions valid as conditions change.
The last piece before bits are reliable: level. This lesson explains why amplitude matters to a decoder and how AGC keeps it under control.
Why level matters
A symbol decision works by comparing the signal to fixed thresholds — for C4FM, deciding which of four frequency levels a symbol sits at. Those thresholds assume a known amplitude. But a real signal’s strength varies constantly: a vehicle drives behind a hill, multipath fades in and out, the transmitter is near or far. If the amplitude drifts, the fixed decision levels no longer line up with the signal’s levels, and symbols get misread.
AGC: a feedback loop for level
Automatic gain control solves this the same way clock recovery solves timing — a feedback loop:
1. measure the signal's current level (its power or magnitude)
2. compare to the target level
3. if too high, reduce gain; if too low, increase gain
4. repeat continuously
The result is a signal held near a constant amplitude no matter how it arrives, so the demodulator’s decision levels stay valid.
The tuning tradeoff
An AGC has an attack and decay speed — how quickly it reacts. Too fast and it chases every noise wiggle, distorting the signal; too slow and it can’t keep up with real fades. The loop is tuned to track genuine level changes while ignoring sample-to-sample noise — a balance, like every feedback loop in this unit.
Where it sits in the chain
AGC typically runs on the isolated channel just before or alongside demodulation, and its level target is set from the channel rate and expected signal, so — like the clock recovery loop — the receiver behaves consistently regardless of the capture rate. The RF path frames the analog side of the same idea in gain & AGC; here the point is that stable level is a precondition for reliable symbol decisions, and AGC is what guarantees it.
Quick check: why does a demodulator need AGC?
Recap
- Received signals fade and surge, but decisions use fixed levels — so amplitude must be stable.
- AGC is a feedback loop: measure level, compare to target, adjust gain, repeat.
- Its attack/decay speed is tuned to track real fades without chasing noise.
- Stable level is a precondition for reliable symbol decisions.
Next up: Unit 5 — see the whole chain assembled in GopherTrunk’s real code.
Frequently asked questions
What is automatic gain control?
Automatic gain control (AGC) is a feedback loop that continuously adjusts a signal’s amplitude to hold it near a target level. As the received signal fades or surges, the AGC turns its gain down or up to compensate, so downstream stages always see a roughly constant level regardless of how strong the signal arrives.
Why does a demodulator need a stable signal level?
A symbol decision compares the signal against fixed decision levels — for C4FM, the four levels the frequency can take. If the overall amplitude drifts up or down, those comparisons shift and symbols get misread. AGC holds the level steady so the decision thresholds stay valid as the signal fades in and out.