LM358 electret mic amp

Thread Starter

ag-123

Joined Apr 28, 2017
276
I'm in the midst of making a electret mic amp, for now I've selected LM(V)358 as my Op Amp.
This is an initial attempt.
sche1.png
The 2nd op amp in LM358 is unused. And I'm intending to replace LM358 with LMV358 which has rail-to-rail outputs. That 470 uF is not strictly necessary, it is there as I'm observing a lot of noise at my adc. I'm hoping that power rail bypass would temper noise sources from the power supply.
The electret mic is discussed here
https://forum.allaboutcircuits.com/threads/whitelabel-unbranded-electret-microphone.184747/
The electret mic is a white labelled *lousy* electret mic (rather insensitive), little specs if at all.

While working this circuit, a few things cropped up as being rather important.
I found that i actually do not know the output range of the electret mic. Then I did some experiments (that link above) and initial tests suggest that peak to peak output of 100 mV at the mic is about feasible with rather loud sounds.

The current feedback and input resistor sizings R5 200k / R2 2k should give about 100 as amplification, I'd think. This is likely too high for this electret. I'd probably increase R2 to 20k which would give about 10 as amplification/gain.

As sound level varies, I'm thinking, I'd replace R2 and R5 with a *variable resistor/potentiometer*, the center tap would connect to (-) inputs of the Op Amp, one end connect the input capacitor, then other end connects Vout (Out1). The benefit here is, it becomes a 'variable gain' amplifier setup. But the variable resistor is likely noisy due to that contacts.

The other thing I'm thinking about is to replace R3 and R4 with another *variable resistor/potentiometer* and doing away with the input capacitor C2. The trouble with the electret mic is that it is generally not possible to tell what is the operating point that will result, it is unlikely to be VCC/2 (which in this case would be about 3.3 / 2 ~ 1.15 v. The benefit of replacing R3, R4 with a variable resistor and doing away with C2 would then be that it becomes possible to tune the 'operating point' to match the DC level of the electret mic setup. As like mentioned prior, C2 with the Op Amp would make it a differentiator amp. (i.e. active high pass filter). Doing away with C2 would then allow amplification to work down to pretty much DC levels! i.e. good low frequency performance. The compromise is that a variable resistor would likely introduce more noise in the circuit additionally.
This is likely less pronounced compared to replacing the feedback resistor that controls the amplification.

edit: as noted by Audioguru again
1) Your supply voltage is too low.
2) The resistor powering the mic is so low that it is shorting out the mic signal level.
3) An LM358 is never used as a mic preamp because it has too much noise, it has crossover distortion and has a poor high frequency response.

Cheap mics and other things are probably factory defects or fakes.
https://forum.allaboutcircuits.com/...anded-electret-microphone.184747/post-1706287

LM358 is likely a bad choice due to that cross over distortion. For now I'm making do as what I've on hand are LMV358.
I'd think LMV358 would be 'slightly better' as the output stage design is different and that it is a rail-to-rail op amp.
https://www.ti.com/lit/gpn/lmv358
 
Last edited:

Thread Starter

ag-123

Joined Apr 28, 2017
276
ok here is the updated schematic with variable resistors / potentiometers
sche2.png
The PCB feels, 'alluringly simple', maybe I'd just patch up on a perfboard and test.

pcb.png

This is laid out on a 10x24 'holes' 1/10" (2.54mm) spaced perfboard.

edit:
too complicated, this would likely not work Op Amp input levels exceeds common mode voltages.
https://www.ti.com/lit/gpn/lmv358
at 2.7v slightly lower the specs gives common mode input voltage as 1.7 max for 50dB cmrr.
the current dc levels of my electrets on the breadboard reads 2.32 v. I'd think a 'workaround' is to use a 5 v vcc.
not sure what else may be wrong.
 
Last edited:

Thread Starter

ag-123

Joined Apr 28, 2017
276
I'm not totally sure that this would literally work. The idea is the (+) side of the Op Amp is my virtual ground, this need to be adjusted with the pots to match that of the electret DC levels so that the output shouldn't swing too far to either rail VCC (3.3v) or GND.

The (-) side is the inverting amplifier, the pots connecting to this terminal accounts for the adjustable gain.
I happened to browse some products / literature, it seemed for electrets making this gain adjustable using variable resistors for the feedback resistor is after all a quite popular setup even if it introduces some noise at the pot contacts.

I'm seeing some rather bad wideband noise in tests with the electret, no amp yet. As I'm using a stm32 MCU, I think the noise has partly to do with the stm32 and maybe the ADC itself. That noise is observable even if I replace the electret with a resistor. That is how I concluded that the 'wideband noise' is likely not caused by the electret. There are some other noise problems with the electrets I bought, but those are different artefacts. Those can't be fixed, except if I change the electrets for something better.
https://forum.allaboutcircuits.com/...anded-electret-microphone.184747/post-1705927
For noise that is related to the stm32 itself, I noted that for low impedance resistor dividers, e.g. if I simply place 2 x 1k ohm resistors as a resistor divider measured at the ADC, the observed noise is much lower vs if higher ohms are used. This should help if the op amp is used, as that'd lower the input impedance to the ADC.
 
Last edited:

Thread Starter

ag-123

Joined Apr 28, 2017
276
I redid that 2nd circuit this time making it non inverting, it looks like this
sche3.png

The PCB looks like this
pcb2.png

I'm even less sure if this'd work. But the idea is, the 50k pot RV1 is a resistor divider that is intended to be adjusted to match the DC level of the electret. Then RV2 500k pot adjust for the amplification/gain. This looks a little more complicated but the components are all the same, just that things are rewired.
 

Thread Starter

ag-123

Joined Apr 28, 2017
276
Why don't you couple the output of the mic with a capacitor and make life easy for yourself?
thanks,
There are few things I'm thinking about as I worked this circuit, placing that input coupling capacitor makes it works as a differentiator amp.
https://www.allaboutcircuits.com/textbook/semiconductors/chpt-8/differentiator-integrator-circuits/
In effect, it is a active high pass filter. if we remove the resistor after the cap and only leave the feedback resistor connecting Vout and (-) input, the output voltage becomes:
Vout = -RC dVin/dt
using VinSin(wt) for Vin
Vout = -RCd(VinSin(wt) ) / dt = -RCVin x w x Cos(wt), where w = 2 x pi x f
in effect the gain varies with frequency.
To get good low frequency performance, I thought i'd do away with this input coupling capacitor.

The other thing is the LM358 output stages has output distortion. Accordingly, that distortion is caused by the output transistor stages switching between sourcing current and sinking current. I'm not too sure if this distortion may be alleviated by using LMV358 that has rail-to-rail outputs and a different output-stage design.

As i'm interfacing an ADC, I'd make VCC/2 my mid point 'virtual ground' voltage. The idea is to tune the pots so that the 'virtual ground' side just about matches the DC voltages of the electret with a small margin, e.g. so that the output is VCC/2 at zero signal. In this way the outputs would always be positive w.r.t GND (the actual power supply ground) and the input voltages never switch below ground, preventing a sink/source switching at the output.

In the 3rd circuit above, I redid things as a non-inverting amp, but the maths seemed more difficult to figure out now.
normally for non inverting amp the gain is Vout = Vin x (1 + Rf/Rgnd)
https://www.electronics-tutorials.ws/opamp/opamp_3.html
But that this time round, i'm propping up (gnd) to a divider voltage in an attempt to match that of the electret dc levels.
I'm not too sure how to work this and if the gain is after all the same.
 
Last edited:

dl324

Joined Mar 30, 2015
16,943
Your component layout would be more aesthetically pleasing if you aligned the pots:
1644082203864.png
It would be better if you placed the mic closer to its input pin. If you route ground over the mic outline, you can eliminate that hideous jog to the resistor and align those components. I'd rotate the opamp to minimize coupling between the input and output. The cap would look better if you centered it vertically on the board.

EDIT: Something like this:
1644084253754.png

You still haven't included the decoupling cap I suggested in the other thread. It will shunt high frequency noise to ground. The electrolytic cap won't do that.
 
Last edited:

Audioguru again

Joined Oct 21, 2019
6,710
The LM358 has an extremely high noise (hiss) level plus has crossover distortion.
The LMVC358 has less noise but it is still high. I do not know if it produces crossover distortion.

Both opamps are never used for audio. Audio opamps are used instead.
 

Thread Starter

ag-123

Joined Apr 28, 2017
276
thanks dl324, Audioguru again,

all, one more iteration, I decided that since I'm using a LMV358 anyway, rather than leaving an Op Amp unused, I might as well use it. I used one op amp as a voltage follower. That is for the resistor divider to adjust the offset.
Increased electret mic load resistance to 6.8k ohm, I checked this on my 'scope', it brings the electret DC levels just below 1.9v.
1.7 is the max common mode voltage at 2.7v for 50 dB cmrr on LMV358 . (it says 'typical 1.9v so I gambled that extra 0.2v).:p
Now it looks like this:
sche4.png
And the PCB looks like this
pcb3.png
placing an additional 100n decoupling cap at the op amp would look like this
pcb3a.png

The PCB uses all the same components, just that it now looks more complicated as there are more dependencies between the components.
But now my 'virtual ground' is easier to visualize. As the first op amp is setup as a voltage follower, what is set at RV1 50k pot is simply presented at the output of the first op amp, this is my 'virtual ground'.

Then RV2 500k pot is my adjustable amplification/gain pot, now it is a full non-inverting op amp and I'd think the
gain follows : Vout = (Vin - Vgnd) x (1 + Rf/Rgnd)
where Vgnd is that 'virtual ground' output of the 1st op amp
hope it works lol
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,056
As above in several places, direct coupling an electret microphone element into a high-gain amplifier is not a good idea. The DC potential at the mic output will wander around with temperature, age, and minor variations in power supply voltage. W.A.Y. better to AC couple the signal into the preamp.

Separate from that, the 358 is a poor choice for low-level audiio work. It has high input-stage noise, high output stage crossover distortion, and relatively low gain-bandwidth. All three of these issues are at least in part due to its remarkably low (at the time) operating current.

Also, there is no decoupling capacitor near the opamp package. The standard thing is a 0.1 uF ceramic cap across the power pins, as close as possible with short leads.

ak
 
Last edited:

Alec_t

Joined Sep 17, 2013
14,335
Won't using the first opamp as a voltage-follower mean that noise generated by it will be passed to the inverting input of the second opamp and so get amplified, adding to the noise generated by the second opamp?
 

LowQCab

Joined Nov 6, 2012
4,078
Why are You trying to re-invent the Wheel ?
You're using a lousy Op-Amp with too much Gain, ( needs 2 stages ),
and not enough Power-Supply Voltage, and you're concerned with Resistor-Noise ???
And, you're talking about flat Sub-Sonic frequency response like it's a desirable goal,
when it most certainly will provide You with huge, un-fixable problems.

The guys over at Texas-Instruments have got this figured-out, and their expertise is free .............

Of course starting out with a completely un-known quantity of a Microphone doesn't help matters.
Just keep in mind that the Bias-Resistor needs to be adjusted to a value that creates
1/2 of the Supply-Voltage with your particular Mic.

Split the Gain between the 2 Op-Amps instead of using one, ( 10X plus 10X =100X ).

If You need a "Through-Hole" Op-Amp, try one of these ...... LM6142BIN/NOPB-ND
.
.
.
 

Attachments

Thread Starter

ag-123

Joined Apr 28, 2017
276
Won't using the first op amp as a voltage-follower mean that noise generated by it will be passed to the inverting input of the second op amp and so get amplified, adding to the noise generated by the second op amp?
Well, I'm thinking, it might be good to put a 1 uF or higher cap at the 1st op amp output which is the 'virtual ground', since that is 'static'. That'd deal with noise coming out from the op amp. It is certainly worse in the prior design, where one variable resistor/pot feeds another variable resistor/pot.

The trouble is, this might cause some coupling with the 2nd op amp, since that 2nd pot deals with the amplification/gain of the 2nd op amp?
i.e. the pot handling the 2nd op amp literally has signals on the line, just that it is divided by a large resistance 500k.

to think about it a little differently, that 1st op amp works a little like a 'LDO' power regulator, just not exactly the same.
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,056
Won't using the first opamp as a voltage-follower mean that noise generated by it will be passed to the inverting input of the second opamp and so get amplified, adding to the noise generated by the second opamp?
Yes. Because the two amplifiers' noise values are uncorrelated, they sum as the square root. The resulting noise is approx. 1.4 times the noise of either one. -ish.

Adding a capacitor from the non-inverting input to GND would reduce the noise contribution of RV1, but not affect the noise in U1A.

ak
 

Audioguru again

Joined Oct 21, 2019
6,710
A capacitor to ground at the output of an opamp produces an oscillator that you do not want.
Capacitor-couple the microphone to the opamp input and bias the opamp input at near half the supply voltage with two resistors fed from an RC filter. The feedback ground also needs a coupling capacitor.

I never tried the TI inverting opamp preamp.
 

Thread Starter

ag-123

Joined Apr 28, 2017
276
Audioguru again
yup, I think so too, capacitors at op amp output may produce oscillations as op amps 'servos' the voltages to the targeted values.

I think I'd after all place that electret input capacitor, probably like 1uF should suffice I'd think. As like AnalogKid mentioned, electret dc voltages would likely vary with temperature, age, power supply voltage, maybe add other unknowns as well. Without the input cap, it would at least mean rather frequent bias adjustment by tuning RV1. But it also means another 2 resistor dividers are needed to bring the input bias voltage to about 1/2 VCC.

At the moment, the noises I observed I think are caused internally within the MCU a STM32. The OpAmps has low output impedance and I'd think it would temper the observed noises. If I observe more noise still, I'd try placing caps at various op amp inputs as my perfboard may have 'spare' holes to fit them. In a sense, if the noises are from within STM32, then this OpAmp may help, it works as a buffer and with that amplification, the signal levels are much higher than the observed noise floor which is between 0-10mV.
 
Last edited:

DickCappels

Joined Aug 21, 2008
10,187
Fortunately the LM358 has a very common pin-out so swapping in a quieter chip might be pretty easy.

Using a capacitor to couple the signal to the non-inverting input does not create a differentiator. In some circuits coupling to the inverting input will do, but you can put a resistor in series with the capacitor to set the gain and the low frequency roll-off.
1644135188662.png
I think every electret microphone data sheet I have seen notes a low frequency cutoff of 10 Hz or higher.
 

Thread Starter

ag-123

Joined Apr 28, 2017
276
ok here is the thing
micamp1.jpg
and a record (song) is attached in the zip file. Very imperfect, lots of noise (the mic that is), and well enjoy :D
 

Attachments

Top