Connecting electret microphone to Atmega16

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am trying to connect an electret microphone to the ADC port (port A) of Atmel Atmega16. My aim is to light an LED when there is a sound.

I have directly connected the mic to the input port of the micro controller. But there is no voltage detection at the input, even after changing the potentionmeter value.

Please advice me how i should connect the mic to the micro controller. Please tell in details since i am new to this area. Also tell the IC number of any amplifier, if required... :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Most electret microphones have amplifier built in. Normally it needs a phantom power (2-terminal microphone) or dedicated 3..5V power supply (3-terminal microphone). You can connect a microphone to the AVR ADC input directly, without a capacitor shown at picture below:

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the reply.

I tried out the circuit with a 10uF capacitor and 5V power supply. The mic which i am having is a 2-terminal device. But there is still no voltage output at the ADC port pin of the micro controller.

The connection done is as shown below..

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'll guess that the electret mic will put out about 50mv if you go "WOOOO!" right into it at point blank range. The avr a/d is about 5mv per count when running from 5V, so you should get little spurts of 0 to 10 counts. I guess you could make a software diode and keep track of the max over the last second or so.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Remove the capacitor.

This will give you biased audio which the ADC needs. AVR ADCs are unipolar input and cannot handle negative voltages. Because of this, the ADC input would need to be biased, so just take the cap out.

The signal amplitude may be too small at this point. With Vcc = 5V, one bit is worth 5mV. So, unless the microphone output amplitude is much more than 5mv, you won't read much.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try this, it will give a pretty good boost:

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

arnab.ray91 wrote:
I tried out the circuit with a 10uF capacitor and 5V power supply.

MBedder wrote:
You can connect a microphone to the AVR ADC input directly, without a capacitor shown at picture below

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for all your help. The circuit given by Michael really worked well at simulation level.

But can anyone please tell me how to connect the mic to the microcontroller directly (without a capacitor)? I mean from where shall I take the output?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Michael's circuit diagram shows the lead marked "A7" ... that is the connection to your microcontroller.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can connect your microphone to the ADC input directly this way:

                    +5V

                    /|\
                     |
                     \
                     / R
                     \ 
                     / 51k..100k
                     |
                     |
                     *---------- To ADC
                     |
                     |
                    ( ) Microphone
                     -
                     |
                     |
                     -
                    GND

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also make sure the ADC to working correctly, AVCC connected, etc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think the microphone does not pass any DC current, so you cannot bias it to 5V and connect it directly to ADC input. The signal will ride over 5V bias.

If a DC-blocking capacitor is used, the AVR side must be biased to something reasonable like 2.5V if 5V VREF is used. If lower VREF is used, then VREF/2 is a good bias voltage. At least the capacitor must not be left without bias on AVR side, who knows where it will drift.

I think in soundcards they used to have something like 2k2 to 5V bias and DC blocking cap, nowadays the voltage might be less, and the mics should work down to 2.0V and I've seen them working with single AA cell. So if 2.5V bias is enough for the mic, then just bias to VREF/2 with two 100k resistors.

Oh but that has a problem, the resistance is way higher than suggested source impedance for ADC. And the electret mic has way too small capacitance to keep voltage stable when ADC samples the voltage into the internal sample/hold capacitance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jepael wrote:
I think the microphone does not pass any DC current, so you cannot bias it to 5V and connect it directly to ADC input. The signal will ride over 5V bias.
And you are completely wrong. These microphones have a built in FET amplifier, so the DC "bias" is necessary as a phantom power source for it. See the picture I posted above.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.