How to make a pre-amp for a electret? microphone

Nick, both your ckt and the one in reply #11, need a pullup R connected to the "+" input terminal (of the same value as the pulldown), in order to get the op Amps into the linear operating region. What you are seeing in your waveforms is clipping due to the opAmps being DC-biased at ground potential.

Also, the ckt of #11 is pretty much ALL wrong.

  1. when adding the pullup on R3, use 10K to 100K for both.

  2. a gain of 1000X is too high on an LM358. It's GBP [gain bandwidth product] is only 1 Mhz, so at gain=1000, the BW is only 1000 Hz. The gain probably shouldn't be set to over 100X or so, for audio work.

  3. the LPF [low pass filter] on the output kills the signal, as you observed. It has a low-pass F3db = 1/(2*pi*R5*C2) = just 16 Hz.

Low-pass on the very output is an extremely poor way to remove the noise in the system - ie, after the noise has been "amplified" by the ckt. Your waveforms show how much noise there is on the electret signal.

  1. both in your ckt and #11, and 99% of the time with non-inverting opAmp ckts, you want a low-pass filter cap across the "feedback" R. Especially at higher gain, this both filters noise and prevents the ckt from oscillating. Calculate the cap using the same formula as above,

F3db = 1/(2 * pi * R2 * C) --> C = 1/(2 * pi * R2 * F3db)

For audio, C = 1/(2 * pi * 100K * 5000Hz) = 318 pF, so something between 270 and 470 pF should work. Try items 1 and 4, and you should have a much nicer waveform output.

  1. both in your ckt and #11, and 99% of the time with non-inverting opAmp ckts, you want a low-pass filter cap across the "feedback" R.

R2 in my circuit, right?

BTW, in the screenshots I took the input (yellow) shows lots of noise, but it doesn't seem to be amplified. So am I correct in thinking this is a measuring artifact? The noise isn't really there? I was watching one of Dave Jones' videos where he showed that what looked like noise from a power supply wasn't really what it seemed.

http://www.youtube.com/watch?v=BFLZm4LbzQU

Yeah, your R2, the cap goes in parallel with it, not to gnd or anything else. You should always use a cap there whenever you have a gain of about 10X or more. There should also be one across R2 in the inverting ckt of reply #11 - along with all the other fixes.

You're blowing up a small signal, so you'll always see a lot of noise on it, unless you take significant scope grounding precautions as talked about in the past. Also, try just connecting your probe gnd lead to the test pin of the probe, and see what the noise looks like at the same o'scope gain setting - it'll probably look about the same as when on the ckt [maybe]. You need to know what your test equipment is actually doing FIRST, as a yardstick for comparison.

A lot of the noise is also high-frequency, so the limited BW of your amp due to the high gain setting will filter it. Remember, BW = GBP/Gain.

With your suggested changes to my original circuit I now get:

It's looks like the noise on the output is slightly less, as might be expected from dropping F3db from 10Khz down to 5 Khz. However, it looks like you didn't add the pullup R at the "+" terminal to move the DC bias. I forgot, when you do that you'll need to put a 1 uF cap in "series" with R1, the R to gnd off pin 2, in order to make the "DC gain" = 1, when the AC-gain = 101. At that point, the output waveform should be more symmetrical.

BTW, did you measure the o'scope noise by tying the probe gnd to the probe tip?

I did mention that point about not trying to get that much gain in one stage. And my circuit was not meant to amplify more than one half of the incoming signal. And I did also mention that the RC network on the output was meant to smooth it to something approaching an envelope detector.

The intention in wiring the Op Amp so it is biased at ground was to make it act as a precision rectifier, only passing one half of the waveform. It does what I meant it to do, it just needs a preamp before with less gain in it and the preamp.

I added the resistor but not the cap you forgot to mention. :P

This is the reading with the probe tip grounded:

[quote author=Nick Gammon link=topic=191774.msg1424285#msg1424285 date=1381471341] I added the resistor but not the cap you forgot to mention. :P [/quote]

Ahem.

C2 is meant to be a smoothing capacitor, so you'd not see much except a little DC.

Not meant to be a final circuit, just to illustrate that the circuit acts as a precision rectifier. As mentioned, with that ridiculous gain the frequency response is horrible.

With the probe tip grounded to what?

As instructed:

BTW, did you measure the o’scope noise by tying the probe gnd to the probe tip?

I looped the ground around to the tip.

Interestingly, if I connect the probe tip to the Ground on the scope, I get more noise, not less:

This is the reading with the probe tip grounded:

You can see that that's basically the majority of noise you see superimposed on the electret signal. If you touch the probe gnd to the tip, you have a tiny pickup loop. If you touch the tip to the scope gnd, it's a bigger loop.

Not meant to be a final circuit, just to illustrate that the circuit acts as a precision rectifier. As mentioned, with that ridiculous gain the frequency response is horrible.

Yeah, that's basically how the ckt works, but I'm not sure it's such a good idea to DC-bias an opAmp right to gnd, there might be some nasty nonlinearities as the feedback loop goes in and out of operation. Plus you might end up with serious clipping of the tiny signal being amplified. I should think even a rectifier app should have the DC-bias set close to gnd, but slightly above, so the opAmp stays in operation.

I was trying to get Nick to understand a little better about how to get a single-ended [non-bipolar] amp ckt to work as a general amplifier.

Yes, interesting. If I ground the tip and ground the ground wire, the noise drops slightly to around 5.6 mV.

oric_dan: I was trying to get Nick to understand a little better about how to get a single-ended [non-bipolar] amp ckt to work as a general amplifier.

I'll add the extra cap tomorrow, I'm always keen to learn new things.

Here's a slightly odd thing. I had the probe on 10x, and if I change it to 1x, the scope display doesn't change, but if I adjust the units, it now reads 600 µV as you expect as it is dividing the previous result by 10.

So whether you have 6 mV or 600 µV of noise depends on what setting you use. It's almost as if the noise is internal to the scope input circuitry.

oric_dan: Nick, both your ckt and the one in reply #11, need a pullup R connected to the "+" input terminal (of the same value as the pulldown), in order to get the op Amps into the linear operating region.

The LM358 is not rail-to-rail output, the output range goes from close to 0V to around 3.5V when operating from a 5V supply. So I would not make the pullup resistor on the +input the same value as the pulldown, I would make it about twice as high, as I suggested in reply #5, so as to bias the input and output at about +1.8V. If there is noise on the power supply (e.g. because you are powering it from USB or a switched-mode power supply), then instead create a 2:1 voltage divider across the 5V supply to provide 1.8V, decouple it with a capacitor to ground, and take a 100K resistor from there to the +input.

Also, you must add the capacitor in series with R1, otherwise the amplifier will also be amplifying the DC bias and the output will be stuck at about 3.5V.

Yeah, dc42 has a good point about how to bias the "+" input pin. Also, once you bias it into the linear [ie, symmetic] region of operation, and away from clipping the negative swings as at present, you may need to cut back on the AC-gain to keep it from clipping high input signals.

You can also play some more with the value of the cap across the feedback-R to see its effects - eg, check with larger values.

I'll add the extra cap tomorrow, I'm always keen to learn new things.

You can learn several things at once, of course. One, how to get it working for general audio amplification to produce nice output with symmetrical swings, and once that's in hand, then how to fiddle the ckt to do rectification, envelope detection, etc. [good night now].

dc42: The LM358 is not rail-to-rail output, the output range goes from close to 0V to around 3.5V when operating from a 5V supply.

Well, I got that bit right:

[quote author=Nick Gammon link=topic=191774.msg1421554#msg1421554 date=1381292983] It seemed to clip if the music was much louder, but I guess that since that isn't a rail-to-rail op-amp, you would expect that after about 3.6V. [/quote]