I am developing a circuit that has as an input a line-level audio signal, it then boosts the signal using either an op amp or transistor so that line-level (which is around 1.6v) is boosted to what my MCU ADC input works best with, which is 3.3v

The problem I am trying to solve, is that the audio input signal will come from a phone, ipod or what ever, and each of these devices has its own volume control. But the end result I want is not related to the volume, I just want to have a signal that is optimally amplified what ever the volume.

Is there an IC that does this, or a circuit that can make this happen? I have ideas on what to do in the digital realm through code, but it would likely produce better results if I could solve the problem on the analogue side.

  • 3
    \$\begingroup\$ Look up Auto Gain Control (AGC) \$\endgroup\$ – apalopohapa Nov 3 '13 at 13:40
  • \$\begingroup\$ Thanks, I now have a name for what I am tying to do. Are there any ICs that perform this task? or do I need to design a circuit to do this? \$\endgroup\$ – Remixed123 Nov 3 '13 at 13:49
  • 2
    \$\begingroup\$ If the volume control is really low (not zero because that would be stupid of course) you are going to need a fair bit of amplifications and you'll amplify noise too and end up with a signal into your ADC that is poor quality. How are you going to avoid this scenario plus, with a small signal (due to volume being low), it's probably going to be better to use a differential amplifier such as an instrumentation amp. My last thought is that you'll need to bias the signal to be able to correctly amplify positive and negative parts of the signal. \$\endgroup\$ – Andy aka Nov 3 '13 at 15:02

What you are looking for is called Automatic Gain Control (AGC). Many audio ADCs have AGC (I've personally used the PCM1870).

If you wish to use your MCU's ADC, I can think of a few options:

  • Use an external AGC, like the NE570, or build it using op amps (a cursory web search revealed that there are several reference circuits available).
  • Use the MCU to assess amplitude/clipping and find a way to control the ADC's voltage reference. This option gives you the most flexibility. You could use a DAC or a digital potentiometer.
  • Same as the above but instead of controlling the ADC's ref voltage, set the gain of a variable gain amplifier (VGA).
  • Use multiple fixed gain paths fed into the ADC's mux, like Olin suggested. This will probably use more area and possibly be more expensive than a single variable amp, depending on how many fixed gains you find good enough.
  • Limit your AGC to digital amplification inside the MCU. This probably yields the worst quality for low volumes, but it is the easiest and cheapest, and it may be good enough for whatever it is you're doing. The viability of this depends on the effective resolution of your MCU's ADC, and how low a volume you are willing to tolerate.

As a footnote let me warn you that if you roll your own gain logic/controller, adjustments must be made slowly and care must be taken as to not introduce audible artifacts or distortion.

|improve this answer|||||

Yes, there are various ways to adjust analog voltage gain from a microcontroller.

However, several fixed gains is probably a simpler choice. Each signal is presented to a different A/D input of the micro. The micro reads all of them and uses the strongest signal that isn't clipped. You have to make sure that a large signal can't overdrive any A/D inputs of the micro, but that's pretty easy.

Another solution is to use a high resolution A/D. Let's say you ultimately need 8 bits for the audio signal. A 16 bit A/D then gives you a 250:1 dynamic range over which the micro can read the audio signal correctly.

|improve this answer|||||
  • \$\begingroup\$ Yup, a 16 bit ADC sounds the right way to do it. \$\endgroup\$ – Andy aka Nov 3 '13 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.