![]() ![]() |
||||
|
||||
[Design Application] Analog Designs Crave Dynamic Gain Control Microcontrollers That Include Programmable Analog-Signal-Processing Functions Improve Performance While Requiring Fewer Parts. Dave Bordui June 2004
In the process of creating various products that deal with analog signals, one frequently requested function is automatic gain control. This feature is needed to control the amplitude of a given input signal so that it always remains within some desired range. Knowing that the signal won't vary from the established range makes it easier to perform a variety of mathematical and electrical operations on it. To keep the incoming analog signal between the predetermined range limits, an attenuation or amplification is applied. Using gain reduction to keep a signal below an upper limit can prevent clipping or mathematical overflow. To increase the signal-to-noise ratio, amplification is generally utilized to keep the signal above some minimum. Amplification also will help prevent underflow. The amplification or attenuation function is performed dynamically on the incoming analog signal based on the signal amplitude. Furthermore, the amplification-/attenuation-to-amplitude relationship can be a linear, logarithmic, or some other mathematical relationship (commonly known as a transfer function). When applied as a system, these concepts form the basis of an automatic-gain-control (AGC) circuit. The applications of AGC circuits include audio processing, speech processing, and some types of instrumentation. In audio applications, AGC systems are used to prevent an analog signal from overdriving subsequent gain, filter, and signal-routing stages. AGC systems also can be useful in audio applications. They keep signal levels from exceeding a point at whichif amplified furtherdamage to output transducers like loud speakers could result. Professional audio systems often use a specific piece of equipment, which is referred to as a compressor/limiter, to maintain the signal level below a certain point. While a compressor/limiter has many other features and functions, its operation typically utilizes AGC circuits. In speech-processing or communications systems, AGC is generally employed to keep a signal's amplitude within the boundaries of the subsequent communications channel. Using AGC prior to applying some form of modulation can prevent certain types of distortion from being induced as the signal is transferred over some medium. One method of creating an AGC circuit is by using two primary analog components: a precision rectifier and a voltage-controlled amplifier. These two components are needed to provide the most basic AGC form. In the simplest sense, the precision rectifier operates on the incoming signal and generates a control voltage. That voltage is then used to control the gain of the voltage-controlled amplifier. Typically, that amplifier's response is fixed, making for a fixed compression/expansion transfer function. This implementation demonstrates a technique that incorporates a microcontroller. Through this approach, the added benefit of transfer-function programmability can then be realized. If the specific microcontroller happens to have analog-signal-processing capabilities, the entire circuit can even be compressed into a single programmable chip. IMPLEMENTATION CONCERNS For now, focus on the ADC-based approach. The technique discussed here allows multiple channels of AGC to be handled by a single device. All of the examples given, however, utilize a single channel implementation. Only the ADC resources of a given microcontroller limit the number of channels that is allowed. Implementing the rectifier requires an analog-to-digital converter, which samples the incoming AC waveform. The digitized signal is then mathematically rectified and averaged in order to form a direct-current (DC) value. This DC value is used to determine when to apply gain compression or expansion. Because many ADCs provide a 2's-complement output value, rectifying the signal in firmware is relatively straightforward. The conversion involves simply detecting a negative reading from the ADC and then converting it to a positive value with the same numeric significance. This converted value is added to a running sum, which is later divided by the number of samples. The result is a determination of the average signal level. Using a microcontroller that includes a digital-to-analog converter (DAC), it's possible to feed the mathematically rectified value into the DAC. The analog output can then be observed on an oscilloscope or other test equipment. This technique can be very useful for debugging not only the rectifier, but other digital-signal-processing functions as well. When choosing the ADC conversion rate, consider the incoming signal's frequency range. For example, suppose that the incoming signal will be between 300 and 3300 Hz. Per the Nyquist sampling theorem, the ADC should sample at 2X the highest frequency (2 × 3300 Hz) = 6600 Hz or 151 µs. For convenience, 150 µs was chosen. In order to cleanly represent the lowest frequency (300 Hz), it's necessary to have at least [(1/300)/150 µs] ~= 22 samples. To make the mathematics run more efficiently, it was decided to accumulate 32 samples before calculating the average DC value. The reason for this choice is that the number 32 (base 10) is actually the binary equivalent of 25. In other words, divisions can be simply handled by five shifts instead of a much longer division routine. This method helps to improve the overall execution speed. It can be a useful technique to remember for other designs as well. Once the incoming signal has been mathematically rectified, summed, and averaged, the result can be used to determine the appropriate amplifier action. One way to implement the internal signal path is through the use of a Cypress Microsystems PSoC Mixed Signal Array (FIG. 1). This device contains analog amplifiers that help in the implementation of the AGC circuit. More specifically, the programmable gain amplifier (PGA) uses firmware to set the gains that result from the ADC calculations. This approach will effectively raise or lower the signal level on the output-signal pin. The multiplying DAC (MDAC) is optional. It is used to give the incoming signal additional gain before entering the ADC. The MDAC can be a useful addition if the input signal mandates higher utilization of the ADC's range. |
|||||||||||||||
|
|
|||||||||||||||
|
[Reader Comments] Analog Designs Crave Dynamic Gain Control |
|
|
|
Electronic Design Europe Electronic Design China EEPN Microwaves & RF Schematics ![]() Electronic Design Military Electronics Featured Vendors EE Events Free Design Resources |
|
|
Planet EE Network Home |
Contact Us |
Editorial Calendar |
Media Kit |
Headlines |
Site Feedback & Bugs Copyright © 2010 Penton Media, Inc. Legal | Privacy Statement Terms of Use |