0
\$\begingroup\$

I have a microphone whose output needs to be limited to 0V-5V. The microphone itself should be picking up audio from its environment (such as a living room). Later, specific signals will be identified from the audio stream that the microphone is picking up. The output of the microphone will lead into an analog input pin of a microcontroller which will do all of the signal analysis. But for now, all I'm focusing on is the microphone.

I've done some googling and have discovered auto-gain amplifiers that seem to be able to adjust their gain depending on what the output voltage is. If the output is too low, the gain will increase, and if the output is too large the gain will decrease. If I understand this correctly, this should be the type of behavior I'm looking for. I think this process of limiting microphone output voltage is known as compression in the audio world?

Anyways, I've found an example or two of an auto-gain amplifier being used to ensure a minimum output voltage, but I'm struggling to find out how to use one to ensure a maximum output voltage.

The core of my questions are:

1) Is it possible to use an auto-gain amplifier to limit the output voltage of a microphone to a maximum of 5V with an unknown input voltage?

2) If it possible, is an auto-gain amplifier the best choice for this? If it is not possible to do this with an auto-gain amplifier, what are some other methods that may accomplish this?

3) If an auto-gain amplifier is indeed a suitable choice for this task, how would one go about selecting/wiring an auto-gain amplifier?

For reference, a microphone I might want to use is the CMA-4544PF-W. Some other information that might be relevant is that I expect the ambient noise of the environment the microphone is in to be around ~50dB-60dB on average.

I can clarify any additional details I haven't mentioned here if necessary!

EDIT: When I wrote this I wasn't clear, I still do want to amplify the microphone signal before it reaches the input pin of the microcontroller. So although I expect the microphone to output a signal in mV, I'd like to strengthen the signal a bit. I'm just worried that if I use an amplifier with a large gain that the output could possibly exceed 5V. My thought process is that an auto-gain amplifier would be able to both amplify the input signal as well as limit the output amplitude to less than 5V.

Thanks in advance!

\$\endgroup\$
2
  • \$\begingroup\$ "I have a microphone whose output needs to be limited to 0V-5V." Microphones don't put out anywhere near that much voltage. You link to a electret microphone, which like most microphones, puts out a few mV, not volts. \$\endgroup\$ Commented Nov 18, 2017 at 23:05
  • \$\begingroup\$ I did not explain myself very well. I would like to use an amplifier between the microphone and microcontroller to amplify the input to make it stronger, but I don't want to accidentally amplify the signal too much resulting in an amplitude of 5V or more. \$\endgroup\$
    – Zearia
    Commented Nov 18, 2017 at 23:27

2 Answers 2

1
\$\begingroup\$

Compression is something else entirely.

Auto gain amplifiers are intended to keep the average sound at some preset level and is a common feature in TVs. However, they are not much use for microphones intended to detect speech since most of the time there is no sound. As such the amplifier will be boosting itself most of the time, only to let through sudden load speech before it can react.

Auto gain amplifiers are also prone to amplifying the background noise. You may have noticed with TVs equipped with this feature when the sound track is quiet, the background "hiss" slowly grows till someone speaks. This is annoying for human listening, but a definite issue for computer recognition.

As such an auto-gain is probably not what you want. Instead you can clip the output to 5V and detect that with the micro. Then have the micro adjust the volume so it knows what levels it is interpreting. Two to four different volume levels should normally suffice.

\$\endgroup\$
4
  • \$\begingroup\$ Perhaps I am misinterpreting your suggestion about the microcontroller. If parts of the signal is clipping at 5V for the microcontroller, then how would the microcontroller know what to adjust the volume to? Wouldn't the microcontroller have no idea what the actual amplitude of the clipped signal is, and therefore not know how to "construct" the clipped signal on the other end? \$\endgroup\$
    – Zearia
    Commented Nov 19, 2017 at 6:42
  • \$\begingroup\$ @Zearia You are right it would not, but since it can react quickly on the first wave front it can compensate for the next. \$\endgroup\$
    – Trevor_G
    Commented Nov 19, 2017 at 6:51
  • \$\begingroup\$ How the microcontroller would compensate is what I seem to be misunderstanding. Sure the microcontroller would know its clipping, but what would it do about it? Would the microcontroller be controlling the gain of the incoming signal somehow in response to clipping? \$\endgroup\$
    – Zearia
    Commented Nov 19, 2017 at 8:29
  • \$\begingroup\$ @Zearia as Olin mentions, you can set up a bunch of fixed gains and select only one. \$\endgroup\$
    – Trevor_G
    Commented Nov 19, 2017 at 15:46
1
\$\begingroup\$

You need to start with some real specs.

First find out what the microphone puts out with the loudest sound you want to interpret. Now set the gain of the amp between the microphone and the 5 V A/D input so that this loudest sound results in close to the maximum of 5 Vpp.

What to do next depends on specs you haven't supplied. Find what the quietest sound is you still need to interpret, and what minimum signal to noise ratio you need for proper interpretation. That tells you what resolution A/D you need if everything is done with the sample stream coming from the single A/D.

For example, let's say the quietest conditions are 30 dB down from the loudest, and your algorithm needs 20 dB signal to noise ratio. That means the A/D quantization noise needs to be at least 50 dB below full scale. -50 dB is 1/316 in voltage, so your A/D would need at least 316 discrete output levels. A/D output levels come in powers of 2, so you would need at least a 9 bit A/D, which would actually get you 512 output levels, or 54 dB noise floor.

You can easily get a microcontroller with a 12 bit A/D. 1/212 = 1/4096 = -72 dB. That would be your total budget for quietness plus algorithm signal to noise ratio with a 12 bit A/D.

So the answer is to first see if a 12 bit A/D might not be good enough for the full range of what you want to do. If it is, then all you need is a fixed-gain amp into a 12 bit A/D, which can be found built into many microcontrollers these days.

If 72 dB isn't good enough, then you can use a external A/D. There are 16 bit (and more) A/Ds intended for audio purposes. The gain budget with 16 bits is 96 dB. You get about 6 dB more for each additional A/D bit.

Or, you can use several fixed gains and run each result into a separate 12 bit A/D input of the microcontroller. The firmware then first decides which inputs are valid, and how to blend the remaining ones to avoid steps at crossovers. This would result in a more than 12 bit value inside, which is then used with your algorithm as if you had a wider A/D in the first place.

However, none of this is possible to design without the all-important spec of how much signal to noise ratio you need relative to the loudest signal you want to decode.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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