Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!netcomsv!mcmahan From: mcmahan@netcom.COM (Dave Mc Mahan) Newsgroups: comp.dsp Subject: Re: AGC with DSP... Message-ID: <1991May9.043958.23925@netcom.COM> Date: 9 May 91 04:39:58 GMT References: <15511@darkstar.ucsc.edu> Sender: netnews@netcom.COM (USENET Administration) Organization: Dave McMahan @ NetCom Services Lines: 71 In a previous article, sutin@helios (Brian Sutin) writes: >I am using a 12-bit DSP system to do real time processing on full frequency >range audio signals. Because of the dynamic range in volume, however, 12 bits >is very inadequate at low signal levels. The solution for my application, >since I do not need to know the actual volume, is to use an analog circuit >similar to an AGC. One thing you might want to try is to use a digitally programmable resistor to attenuate the signal. That way, you can know the gain in your CPU since it is set by the CPU. The CPU would just take an average of the last X number of samples, multiply and/or offset this value to derive the proper attenuation for the circuit configuration you select, and then send the value to the resistor. One benefit from using a programmable resistor is that they generally have better frequency response (it's flatter over a wider bandwidth) than other methods I have seen. This tends to make it cheaper. Such resistor networks can be purchased from Dallas Semiconductor or MicroLinear Corp. These usually come with a synchronous serial input that you drive from two digital output lines from your CPU. If the range is semi-limited, this method will work fine. If not, you may have to incorporate the resistor into the gain loop of an op-amp and use it to select the gain of the op-amp. My circuit theory is a bit rusty, but I think the circuit you want is: _ | \ | \ Input | \ >------ /\/\/\----| + \ R1 | \_______________ Ouput to ADC ----| - / | | / | | / | |_ / Op-Amp | \ R2 / \ / | _|_ \_/ Gnd This is a non-inverting Amplifier, and R2 is the programmable resistor. R1 is some fixed resistor that is used to help define the gain of the circuit. I think the formula for the gain is something like: Gain = (R2 + R1) / R1 You should verify this formula before using it, however. The nice thing about this is that you can make the gain of R2 dependent upon very complicated signal conditions, since it is set by the CPU. It can be set to track the peak of a signal, the power of a signal, allow it to find the proper gain during one part of the program and then lock it (by not changing it) for use at some other point of the program, or just about anything else you have the CPU power to compute. The advantage to using the op-amp is that you can set it so that a large input won't clip the input of your ADC and still give you the range you need to amplify a small signal. It's a bit more complicated, but has benefits you may want. >Brian Sutin >Lick Observatory, UCSC >sutin@helios.ucsc.edu -dave -- -- Dave McMahan mcmahan@netcom.com {apple,amdahl,claris}!netcom!mcmahan