Thoughts on the Firmware-Implemented AGC

I want to share some of my thoughts about how an AGC for the X1M might be implemented in the Arduino Nano. Hopefully, someone out there will chime in with ideas on what’s wrong with it or how to make it better.

The concept starts off with the Nano sampling the detected audio at a regular rate (say 8 khz) and building a firmware ‘peak detector’ using the 10-bit A-D values. The peak detector is just a number that corresponds to the maximum audio level of the samples inside some time window. However, there are some special concerns:

  • The ‘attack time’ can’t be instantaneous, otherwise the AGC will ‘hang’ the gain at a reduced level any time a noise impulse hits it. The attack time needs to be adjustable, probably up to about 10 msec(?).
  • The ‘decay time’ needs to ‘hang’ so that the audio level doesn’t ‘pump’ between voice syllables and morse code elements. The decay time needs to be adjustable, probably up to a couple seconds.

Once a good peak detector is available, it can be used to control audio gain in any one or combination of methods:

  1. Reproduce a synthesized version of the sampled audio using a PWM output as a D-A converter and send this to the audio power amplifier. This synthesized audio stream can then be ‘scaled’ in real time to control the level over some range (probably not more than 20 db). I’d call this a ‘feed-forward’ method.
  2. Use the peak detector value to generate a varying DC voltage using one of the PWM outputs. This voltage could then be applied to a gain control element just before the audio power amplifier. This would allow gain control over as wide a range as the gain control element allows. I’d also call this a ‘feed-forward’ method.
  3. Use the peak detector   value to generate a varying DC voltage using one of the PWM outputs and apply this to the MC1350 gain control pin back in the IF stage. I’d call this a feedback method.

All of these methods have pros and cons:

  • Method 1 is, in principal, the most flexible, but it has limited gain control range and would probably also be limited by the speed and processing power of the Nano. However, I think it has a place in the mix.
  • Method 2 could be very fast and have a very wide range, but it leaves the IF running at wide-open gain, possibly allowing IF overload on strong signals.
  • Method 3 avoids the problems of methods 1 & 2 (the MC1350 has almost 80 dB of gain control range) but it suffers from common problems that all servo loops suffers; ie, the control loop will be either overdamped (slow response), underdamped (overshoots and ringing; possibly oscillation) or critically damped. The last case is the best you can do and it will be a compromise at best and is complicated by the MC1350’s non-linear gain control transfer function.

I propose that a combination of all 3 methods could produce a very optimized AGC function wherein method 1 is used for small, very fast gain changes until slower methods 2 & 3 can catch up. The method 2 loop would be the next fastest, providing some more gain control range until the much slower method 3 loop finally catches up and relieves methods 1 & 2 of their burden.

These are all just concepts, so comments are appreciated.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Q R P e r

QRP radios, product announcements, reviews, news and more. Low power amateur radio fun!

Dian Kurniawan

electronic for better life

N6QW -- Left Coast Radio

For Ham Radio Experimenters

SolderSmoke Daily News

For Ham Radio Experimenters

%d bloggers like this: