LM386 microphone amplifier

In this schematic, a LM386-based audio amplifier takes its input from an electret microphone.

There are two output signals. V_OUT carries an AC-only voltage and should be used when interfacing with another piece of audio equipment. The voltage at V_OUT_UC is biased at 1/2 of the supply voltage VCC and is the better option for microcontroller input.

If volume control is needed, the VR1 potentiometer from the original schematic can be added back, before the input pin 3.

Sound sensor for the Arduino

Arduino’s analog pins map a 0 ~ 5V voltage to a 0 ~ 1023 integer. In silence, an ideal sound sensor should consistently give readings of 511-512 – half of the 0 ~ 1023 range, corresponding to 1/2 VCC = 2.5V. When there’s a very loud sound, the readings should sweep all the way to 0 and 1023. Moderate sounds should have readings somewhere in between. This makes it easier to set a threshold for detecting sounds of a given strength.

Sound Readings range (ideal) Amplitude (ideal)
(Silence) 511 ~ 512 1
Talking 300 ~ 723* 423*
Loud knock, broken glass 0 ~ 1023 1023

* These particular values are just an example

For battery-powered applications, the current draw of the circuit may also be a concern.

LM386 sound sensor performance

Let’s see how the LM386 sensor fares, in its 20x gain configuration (no C2 capacitor). V_OUT_UC is connected to Arduino’s A0 pin and the Min-Max sketch is uploaded.

Sound Readings range (LM386) Amplitude (LM386)
(Silence) 455 ~ 547 92
Loud knock 132 ~ 897 765

Not too bad, not too great either. A loud knock gives a decent output sweep, but the readings in (relative) silence cover quite a wide range. The current draw of the sensor was 5.54mA.

Increasing the gain to 50x or 200x is unlikely to bring much improvement. It may push the output range a bit closer to 0 ~ 1024, but will increase the noise as well. At 20x gain, the output already covers 75% of the 0 ~ 1024 range.

Side note: Picking the value for R2

Most sources suggest using a 1K ~ 10K resistor for R2. The easiest way to test which value works best is to use a trim-pot

Sound Readings range (LM386) Amplitude (LM386)
(Silence), R2=2K 369 ~ 576 207
(Silence), R2=5K 420 ~ 564 144
(Silence), R2=10K 447 ~ 549 102
Loud knock (R2=2K, 5K, 10K) 132 ~ 896 764

These are the results for my particular setup. The maximum output sweep was virtually identical for all R2 values tested and R2 = 10K yielded the lowest noise in silence.

LM386 sound sensor on a breadboard (click for high-res)

Parts list

Part Value Description
C1 1~10uF Bypass capacitor
C2 10uF Gain 200x. Optional.
C3 220uF Output coupling capacitor
C4 47nF Boucherot cell
C5 100nF Power supply decoupling
C6 100uF Power supply decoupling
C7 10uF Microphone coupling capacitor
MIC Electret microphone
R1 10R Boucherot cell
R2 1 ~ 10K Microphone load resistor
VSS 4 ~ 12V Supply voltage

Downloads

Related posts

Links

About these ads

Posted on May 15, 2011, in Electronics and tagged , , , , , . Bookmark the permalink. 24 Comments.

  1. This works well!! But, do you think i’ll be able to actually acquire the signal into matlab…and read it as a wave file…????

    • Thanks for the comment!

      It’s certainly possible to send the readings from Arduino to a PC, using some of the “oscilloscope”-type sketches. However, the resolution of the audio signal (10 bit) and the sampling rate (5-10kHz, limited by the speed of ADC & Serial) may be too low for most applications.

      The quality will be much better if the microphone is connected to the computer’s sound card.

  2. If you used an external adc could you achieve higher recording quality?

    • Well, yes, Arduino’s ADC is not really up to the task of high quality sound recording, mostly because of its fairly low sampling rate.

      But the setup described here is for a much simpler tasks – monitoring the overall ambient sound level, detecting loud noises, etc. For this you won’t gain much by using a higher-quality external ADC.

  3. Sweet. Works as advertized. I’m getting ~780 differential using an electret out of a Furby we are hacking. This was perfect. Thanks for doing all the leg work and documenting it so well!

  4. the preamp circuit works for dynamic microphones?.

  5. In the image of the Setup you made, where is the (C3)220uF ? (C2) is series to (C3) and connected to 10Ohm resistor, are both (C2)and(C3) a ceramic capacitor?

    • The 220uF C3 is not present on the image, as the setup uses the V_OUT_UC output. C2 is not present either, as it’s optional. And there are two ceramic capacitors that form C4 – I didn’t have a 47nF cap and used 2x 100nF as substitute.

      When installed, C3 would be an electrolytic capacitor.

  6. I have built this circuit on my breadboard multiple times, but I keep getting values around 860 instead of 512. It’s reacting to sound, so the microphone is working, but when I connect ground to the amplifier input the result stabilizes at around 500. I’m powering this from a Uno r3 over usb, is this a problem?

  7. I’m building this LM386 audio amplifier as part of my 8th grade Nobel Prize sound detector project, in the sound detector you need a electret condenser mic (as input) on the LM386 audio amplifier (built on breadboard) wired to an Arduino Uno (which processes the electric signals, then the Arduino is programmed to turn on an LED. So the diagrams and photos for building this project could work as my LM386 audio amplifier? Everywhere else I searched, there aren’t any actual photos of the completed project of the audio amplifier for the sound detector built on a breadboard, so I haven’t the least clue where to start. I’ve started building the audio amplifier part with the picture of the actual breadboard above…this should work, right? The purpose is the same – an audio amplifier w/ an LM386. AND: on the BREADBOARD, C23, the capacitor is the 220uF? and D24 is the 47nF? I’ve assumed the electrolytic capacitor at the very top of column 24 would be the 100uF as the other 10uF ones are located below? If there was a labeled photo of the breadboard w/ all the pieces on it, it would make my life much easier building this, as I’m in 8th grade and haven’t had much experience in circuits and physics! Also, does a breadboard with numbers 1-30 work? I see the last wire is located on 31, and was wondering since I had to put it on 30, would it make a difference? Probably not?
    Thank you, this page has been the most helpful by far! PS I was originally building the circuit on this web: http://www.learningaboutelectronics.com/Articles/Sound-detector-circuit.php
    I don’t really see how the schematic on that page translates into the breadboard, so…
    Wonderful, helpful reference page! Greetings!

    • Sorry for the late reply.
      The capacitor at C23-C24 and the one at D24-D25 are both 100nF and together approximate C4 (47nF) from the schematic. I didn’t have a proper 47nF capacitor when I was building this, so I had to substitute.
      The cap at Top24 is 100uF; The other two electrolytic caps are 10uF. There is NO C3 (220uF) placed on the breadboard, as we’re only using the V_OUT_UC output.

      The exact position of the jumper at column 31 is not that important. What matters is that the top-side and bottom-side GND rails are connected.

    • If an Arduino (or another microcontroller) is used at the output, then C3 (220uF) is not needed; But if want to get actual audio out, then you need it in place, roughly at position B28. Note the correct polarity! You can also check the output stage in https://lowvoltage.wordpress.com/2011/04/23/lm386-audio-amplifier/

      Yes, C5, 0.1uF is at top-21

      Couple of notes on your breadboard image:
      * The lower end of the red wire at column 17-18 should be connected one square further down, to the common GND
      * The capacitor at G24-25 should be stretched to G23-25
      * Pin 6 of LM386 should be connected to VCC, it’s currently connected to GND
      * Double-check and triple-check the polarity of all electrolytic capacitors, they seem to be placed the wrong way

      • I would assume the Pin 6 wire is the one on column 21 that wasn’t placed at the top? Is VCC going to be the battery supply? Where would you add in the battery supply? I got a battery holder for 4 AA batteries and am not sure where to place it on the breadboard. Is it best near the electret mic or near the other side on column 30? I originally thought the Arduino needed a battery supply to power it, so would the batteries go on the breadboard or wired to the Arduino? Or can the Arduino be wired to a computer with the breadboard wired to the Arduino? I’m not really sure, the complete project I’m building is the sound detector circuit.

        I fixed it…would this look better?

        http://tiffanyzha.wix.com/welcome#!AudioAmplifierCircuit-1/2way/zoom/c1vts/image_46b

        Thank you so much! This has been more helpful than all the other sites added together! No one’s been this kind enough to help…I’m still learning as I haven’t learned much about electric signals, schematics, and circuits yet in school.

        Again, thanks! Greetings!

    • Looks much better now. One last thing to check – the C7 capacitor at the microphone output should be across B9-B10. It’s not very clear from the picture where its pins go.

      It doesn’t really matter whether you connect your power source to the breadboard or to the Arduino – either way should be OK. What matters is that you have both the VCC (+5V, commonly in red color) and GND (0V, commonly in black) properly interconnected among all boards.

      • You’re right, the C7 was on B8-B9, now it’s on B9-B10. Thanks for checking the images, it really helped! The VCC+5V, is that a wire rather than batteries? I have a battery holder, would that work? And if I connected it to the Arduino, would it be better placed above or below on GND/Analog terminals? In my sound detector project the Audio Amplifier Circuit should be connected to the GND and A0 terminals below (I think your picture of the breadboard shows that). On the top I’ll need to connect an LED on Pin13 of the Arduino. Where’s the best spot for the battery holder (for 4 AA 1.5V batteries)?

        Thanks again for checking the images! That was really helpful(: This project is a great challenge for me and I’m looking forward to see the complete sound detector circuit!

  1. Pingback: Dan’s Perodic Table Display « The Mind of Bill Porter

  2. Pingback: The Elemental Illuminator « The Mind of Bill Porter

  3. Pingback: Arduino Lichtorgel, Teil 1: Hardware | TechBlog

  4. Pingback: Atelier pratique : Capter et mesurer une intensité sonore | Œuvre | Imaginaire | Numérique

  5. Pingback: Ojacevalnik za electret mikrofon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: