LM358 microphone amplifier

After the unconvincing performance of the LM386 mic amp, another design is put to the test. This time, based around a LM358 operational amplifier.

Op-Amps

Operational amplifiers are high-gain voltage amplifiers. There’s a huge amount of information available on how to use them and the guide I followed is TI’s“Op Amps for Everyone”. The schematic is an “Inverting AC amplifier” (A.3.18, p. 424). From the equations there, the voltages on the two outputs are:

  • V_OUT_UC = – V_IN * R5 / R4 + VCC / 2 = – 100 * V_IN + VCC / 2
  • V_OUT = -100 * V_IN, as the C3 capacitor is blocking the DC component

(V_IN is the voltage at pin 2)

Op amps do not provide a lot of output power. In-ear headphones can be driven from V_OUT, but it’s unlikely that a LM358 will power even a small speaker. For a microcontroller, connected to V_OUT_UC, output power does not matter, only voltage does.

LM358 sound sensor performance

As in the LM386 mic amp setup, V_OUT_UC is connected to Arduino’s A0 pin and the Min-Max sketch is uploaded. By using different R5 resistor values (10K, 47K, 100K), gains of 10x, 47x and 100x are achieved:

Gain (Silence) Loud knock
Readings Amplitude Readings Amplitude
10x 510 ~ 512 2 307 ~ 735 428
47x 505 ~ 517 12 17 ~ 754 737
100x 500 ~ 525 25 7 ~ 755 748

Pretty good! The noise level in silence increases linearly with gain. Moving from 10x to 50x gain gives a good increase in the maximum output swing. Pushing the gain to 100x provides only a minor improvement. Overall, the 50x setup gives the best noise vs. output swing results.

The LM358 does not have a true rail-to-rail (0V to VCC) output. The datasheet specifies an “output voltage swing 0V to (VCC – 1.5V)”. This means that when VCC = 5V, the largest possible analog reading is in the 715 – 750 range. In order to get an wider output range, a better op-amp should be used.

Current draw was 1.52mA, in the 100x setup

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

Parts list

Part Value Description
C1 10uF Microphone coupling capacitor
C2 100nF Power supply decoupling
C3 220uF Output coupling
MIC Electret microphone
R1 1 ~ 10K Microphone load resistor
R2, R3 10K Voltage divider: 1/2 VCC
R4 1K Gain = – R5 / R4
R5 100K
VSS 3 ~ 30V Supply voltage

Downloads

Related posts

Links

About these ads

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

  1. Thank you very much for a good picture of the board and a straight forward write up, it helped me alot!

  2. You’re welcome, Chris!

    • William Moreno

      Hi, I am tried to test, followed your instructions here, but I have having problems with noise, please give me any suggestion ?

      • Hi, William,

        Can you describe your setup in more details? Like, are you using the audio output V_OUT or the microcontroller output V_OUT_UC? How is this noise showing up – unstable Arduino readings or poor-quality audio? What is the op-amp gain set to?

        As general suggestions, you should double-check all connections. Are the power rails (+5V and GND) properly routed over all breadboard sections? Then, check if the polarized components (mic and caps) are correctly oriented. Finally, you may try lowering the value of R1, the microphone load resistor, down to 4.7k or 1k

  3. Hey, this is exactly what i was looking for!
    Thanks for all the info!

  4. Lukasz Adamczak

    Hi Dimitar, thanks for a great article.
    I’m planning a similar circuit, but getting audio input from a guitar jack.
    My guitar signal is up to 600mV peak-to-peak (for the loudest possible chord strum). What values of R5 & R4 would you recommend? I believe I need less than 10x gain to fit within 5V range. Am I right?

    Also, can you explain the role of R1? Will I need one for the guitar input?

    • Lukasz,

      For a 10x gain, you can leave R4 at 1k and reduce R5 to 10k. The R1 resistor is part of the microphone setup, you won’t need it in the general case.

      Please keep in mind that the LM358 op-amp is probably not the best choice for quality audio applications. This amplifier may work as a proof-of-concept, but you may want to search for better, specialized guitar amplifier schematics.

  5. is it possible to get the Digital O/P from the circuit to drive digital circuit what ill be the o/p voltage

    • LM358 does not have a rail-to-rail output and with a +5V supply, its maximum output voltage is ~3.5V. This may be too low for some digital inputs to register as a logic “1″ / “HIGH”. A comparator (like LM393) or a Schmitt trigger IC may be used to reliably convert the output to digital.

  6. Hi,
    Thanks for this post, it has been a geat help!!

    I got best results with slightly different values for resistors and capacitors:
    C1=100nF
    R5=330K
    R4 = 0 (Removed it completely!)

    Power supply is 3.3V and I also have a low pass filter on the power.
    I’m using the V_OUT_UC connected to to an ATMEGA and eventually converting this to audio. Voice is loud and noise level is low enough.

    Why is R4 needed at all in this circuit?

    • Hello,

      With R4 shorted out (i.e. R4 = 0), the op-amp would work in what looks like a comparator mode, i.e. with maximum amplification. The output would swing to either ~0V or ~3.5V even for slightest changes in the input signal and I’d expect the output to be clipped and distorted.

      But I’ve never tried such a setup and if it works fine for you – that’s great!

      • Dimitar – It did not behave that way. I agree that according to the formulas it should (with an ideal opamp), but it didn’t happen this way in real life. It had the effect of increasing the gain but not to a full swing between GND and VCC.

  7. Hi I want to connect output to the XBee but ADC range of XBee is 0-1.2V what i should do sir ?
    and if i want to select frequency in range 40-300 Hz could you guide me ?

    • For scaling down the output voltage from 0-5V to 0-1.2V you can use a voltage divider at the output, with a pair of 10k & 3.3k resistors (or a similar pair with a 3:1 ratio). The voltage across the 3.3k resistor will be 1/4 of the output voltage.

  8. Hello,
    I am trying to do a small voice recognition circuit using an arduino mega2560 i bought earlier last year. Are there any changes that i will need to make to this circuit for it? I tried but it gave me no results. I checked everything thrice, still. Should i use a pre-amp circuit as well? if yes, which one would you suggest?
    Thank you.

  9. Thanks Man

  1. Pingback: Sound sampling with the Atmega32u4 breakout board+ « bobanaut

  2. Pingback: Side Project – High Speed Photography trigger « Giant Pong – Making of.

  3. Pingback: Basic Analog Circuits Exercise – Feb 26 | Kangmunicate Here

  4. Pingback: Sound analysis in Arduino | Bocho's Blog

  5. Pingback: Quanto rumore? : QUELog

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: