LM358 electret mic amp

Thread Starter

ag-123

Joined Apr 28, 2017
276
interesting circuit, but a cap on the feedback (-) resistors side?

there are a couple noise sources
- one of which is an ac 50 hz hum, that probably come from power supply or induced from somewhere. the 470 uF did help to attenuate that
- adc switching noises (this probably can't be helped but see next)
- apparently if i use a high impedance source e.g. connect the mic directly to adc, or even for that matter a resistor divider exceeding 10k ohm, noise present itself. the op amp (lmv358) did suppress this noise and significantly reduced it (low impedance output). it worked in conjunction with the 470 uF cap i'd think.
- noisy mic, this is a 'lousy' (electret) mic, bought from a public market place, there are hissing, clicks when sound levels are higher. this can't be helped short of changing the mic.
the current setup did made a difference, less noise i.e. higher signal to noise ratio, but the noise remains. it is worse prior with the mic direct to the adc.
- RF interference see below

note that LMV358 isn't LM358, that extra V made a lot of difference
https://www.ti.com/product/LMV358
it is rail-to-rail (one of the features), the output stage is different from LM358, uses an 'LDO' style design. I'm not sure about the cross over distorsion though which LM358 is infamous for. I kind of avoided it by keeping the signal above zero. that level is adjusted by rv1. In addition, LMV358 is designed for 3-5.5v operation. The strict voltage limits probably made a difference in particular with its different output stage design.

stm32 has 'noisy' adcs, I'd think it is partly caused by RF interference (EMI). As I still use wires, those wires work as antennas. Even though RF frequencies are much higher, it is likely an aliased signal would still appear at the adc. After all we are measuring millivolts, and RF signals easily exceeds that.
 
Last edited:

Audioguru again

Joined Oct 21, 2019
6,705
An electret mic is not a 1.65V voltage regulator. Instead the mic has a maximum current of 0.5mA and it needs at least 2V across it.
The previous post shows 6k of resistors feeding the mic which will produce a voltage of only 3.3V - (6k x 0.5mA)= 0.3V so both the mic and the opamp will not work.

Use a higher supply voltage (maybe 9V) and bias the opamp at half the supply voltage with two series biasing resistors. Capacitor-couple the mic and power the biasing resistors and the fairly high resistance (maybe 10k) mic biasing resistor from a series 1k resistor and a 47uF capacitor to ground.
 

sghioto

Joined Dec 31, 2017
5,391
An electret mic is not a 1.65V voltage regulator. Instead the mic has a maximum current of 0.5mA and it needs at least 2V across it.
The schematic is not theory but a working circuit that I designed and tested myself. The combination of the mic element and R1+R2 form a voltage divider that biases the +input at appx 1/2 Vcc. The mic element I'm using is a generic one, works fine with only 1.65 volts. Circuit works as posted.

interesting circuit, but a cap on the feedback (-) resistors side?
Because the + input is biased at 1.65 volts the output and the -input are also at 1.65 volts. A DC path to ground at the - input drops the voltage to almost zero volts turning the circuit into a comparator with the output at Vcc.
 
Last edited:

Thread Starter

ag-123

Joined Apr 28, 2017
276
Well, that Alix electret measures 1.9v dc with the 6.8k resistor. Hence, I tuned RV1 such that the output dc levels are around 1.5v.
This is done at 3.3v. And well, it is likely my Alix electrets are goofy electrets.

about that circuit. normally, I'd avoid placing a cap at the opamp output, there is a risk of oscillation, but that it probably works.
it is interesting nevertheless.

as for mine, i made do as this is as few physical components as practically feasible and that those are the components I've got on hand.
 
Last edited:

sghioto

Joined Dec 31, 2017
5,391
about that circuit. normally, I'd avoid placing a cap at the opamp output, there is a risk of oscillation, but that it probably works.
it is interesting nevertheless.
It's not going to oscillate. The purpose of the output cap is to block the DC voltage on the Level control. You don't want to be sending DC voltage to what the output of the amp is connected to.
The reason it works isn't anything special or interesting other then the fact I used the bias on the mic as a voltage reference for the +input. For proper operation the +input should be biased at 1/2 Vcc
LQC has it right in post #12 "why are you trying to re-invent the wheel" The schematic in that post is pretty standard for a mic amplifier although I would add decoupling to the mic element.
I don't think the problem is the "goofy" electrets but in a kind word that circuit.
Here's another schematic using a LMV358 amp module sold through Sparkfun.
1644769594661.png
 

Audioguru again

Joined Oct 21, 2019
6,705
Well, I'm thinking, it might be good to put a 1 uF or higher cap at the 1st op amp output to ground which is the 'virtual ground', since that is 'static'.
A 1uF capacitor to ground at the output of an opamp causes a phase shift and oscillation.
Most datasheets show a tiny amount of capacitance (100pF) to, show that it can drive a little amount of wiring capacitance. Some noobs then think the output to ground capacitor is required.
 

Thread Starter

ag-123

Joined Apr 28, 2017
276
It turns out what I've done has a rather useful side effect, as it can amplify sounds pretty much close to DC frequencies, I noted it can capture heart beats pretty much like a stethoscope, as low as like 20 hz or lower, but that my lousy electret is too noisy to be useful for that purpose. This is a benefit of DC coupling, but that it also means rather frequent adjustments of rv1 and rv2, as it turns out the electret DC voltages tend to drift.

With this op amp, and the variable resistors I've been able to tune up the gain to pretty high levels. It is now able to pick up background sounds. Here is a record with a bird chirp at 3s (in attached zip). Unfortunately, the noise level is as large as the background sounds. To get better than this, I'd think it would be necessary to get a better electret. This is a crappy electret.

agreed, cap at output is sometimes useful, I've tried low pass filtering the output using things like 10-100nF at the output with a series load resistor. I'd think the main trouble would be with large caps directly to the ground. With a series resistor that works for things like thermistors etc.
more commonly i'd place caps to ground at the inputs say like 10n as that's easier for considerations.
 

Attachments

Last edited:

Thread Starter

ag-123

Joined Apr 28, 2017
276
i've been thinking about an interesting idea, but i'm not sure how feasible are those. one of those ways is to make a resistor divider say present it at the (-) input and say the electret mic goes to the (+) input, if there are common mode noises, e.g. AC hum etc, the CMRR would remove all that noise. That is theory, but I'd guess there are limits such as limits with common mode voltages etc.

I'm suspecting the observed noises are actually picked up by the electret mic itself, i.e. those are sounds. If that is true, removing common mode signals won't help. in a sense, the 'noises' are probably 'sub sonic' e.g. 50hz or less infra sounds that our ears couldn't hear, but the electret mic pick those up. i think i'd try digitally high pass filtering that signal to see if that's true.

the chirp spectrum looks like such, those peaks probably correspond to the chirps.
chirpfft.png
But there is a huge wide band spectrum below those peaks, this i'd think is the 'noise' it won't be easy to remove it.

The chirp waveforms looks like this:
chirp.png
it is pretty much 'noise', that chirp is 'lost' within the midst at beginning around 3.0s. The amplification to these levels is provided by the op amp (pretty much 'peak-to-peak' 0-3v range), centering zero levels is done digitally using a simple average.
 
Last edited:

Alec_t

Joined Sep 17, 2013
14,330
This is a benefit of DC coupling, but that it also means rather frequent adjustments of rv1 and rv2
DC negative feeback is the common way of stabilising the operating point of a circuit without the need for constant manual tweaking.
 

Thread Starter

ag-123

Joined Apr 28, 2017
276
DC negative feeback is the common way of stabilising the operating point of a circuit without the need for constant manual tweaking.
that is an interesting idea, I'm thinking if there may be a way to after all let the op amp to automatically servo the bridge voltages between the mic and the dc levels for the (-) side of the mic amp (op amp b). so that the 'output' dc levels would maintain at 1.5v., an incorrect implementation may cause oscillations as 2 op amps are involved, with one feeding another.
:D
edit:
oh it seemed that is what sghioto has presented
the other way is that 'plain old' inverting op amp with an input capacitor configured as a active high pass filter.
the 1st circuit in effect
https://www.allaboutcircuits.com/textbook/semiconductors/chpt-8/differentiator-integrator-circuits/
There doesn't seem to be an easy way to transfer the gain from the 2nd op amp to the first such that the input levels at (-) in op amp b just offset by difference between the electret dc levels and 1.5v divided by the gain. i.e. servo for the dc difference divided by the gain.
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,055
if there are common mode noises, e.g. AC hum etc, the CMRR would remove all that noise.
That is the essence of balanced audio (1910's), and the phone system (1880's). Granted, there wasn't much hum to pick up in the 1880's, but there is today. My house is 1.7 miles from the exchange, and my lines are scary-clean.

If, OTOH, you are talking about a 2-resistor divider acting as a noise source, that is then subtracted from incoming noise on an unbalanced line - no.

If the two noise signals are completely uncorrelated, they will add as the square root of 2. That is, if each signal's noise component is 1 Vrms, the resulting noise will be 1.4 Vrms. This can be used to an advantage in high gain amplifiers, but the technique is pretty complex. Some old Tek scopes used to have multiple 1-tube preamp stages in *parallel* (not series) to reduce the noise. It's all in the math.

ak
 
Last edited:

sghioto

Joined Dec 31, 2017
5,391
There doesn't seem to be an easy way to transfer the gain from the 2nd op amp to the first such that the input levels at (-) in op amp b just offset by difference between the electret dc levels and 1.5v divided by the gain. i.e. servo for the dc difference divided by the gain.
I have no idea what you are talking about but I challenge you to build the circuit I posted in #21 and compare with your circuit.
Also change the value of R2 if needed to get close to 1.65 volts across the mic element.
 

Thread Starter

ag-123

Joined Apr 28, 2017
276
thanks AnalogKid,
my guess is for that to be common mode, the same signals need to present themselves across the electret mic dc levels and the resistor divider.
For this assumption to be true, they may be from the power supply source. Well, i may be wrong with this understanding.
But with my post just above, the signals (noise) certainly don't look like 'common mode' signals, they appear to be actual signals (sounds) that the electret mic received after all. Note that the pictures in the comment/post 3 post / comments above are the actual signal observed in a moderately quiet room. The 'bird chirp' sound is audible but it isn't particularly loud, that chirp is smaller than the ambient 'noise' levels as observed, it is 'mixed up' in that 'noise' and there is no distinct larger amplitudes observed for the bird chirp.
---
On a different topic i'm thinking of 'automating' rv1 (the first op amp) that does the 'virtual ground' i.e. present the dc signal level offset away from the electret DC levels so that the output levels at the eventual (op amp b) is around 1.5v (VCC/2) at zero signal (DC).
I've thought about PWM that level feed into the op amp a (+) input over a low pass filter say RC circuit, so that it works in place of rv1. But my guess is that doing so would just add more noise to the circuit.
I've been thinking about 'tweaking' the circuit to let the first op amp 'servo' this part, but a few attempts don't make sense, hence I'd not post the circuits.
The simplest is still the differentiator amp method, which is an active high pass filter.
sghioto, your circuit is nice as it is a non-inverting design of a differentiator amp of that i made in my 1st post .
The extra RC (low pass) filters for the electret mic that you place probably made a difference with the noise at the electret inputs.
 
Last edited:

Thread Starter

ag-123

Joined Apr 28, 2017
276
1/f noise as it seemed is unfortunately a 'natural' noise floor. it is probably comparable to 'thermal' noise.
https://en.wikipedia.org/wiki/Pink_noise
It doesn't seem to have particular patterns or peak at particular frequency ranges.
So I'd guess that 'bird chirp' is kind of soft that it is within that 'thermal noise floor'.
my guess is to get better results, among the ways is to use a better mic, e.g. it seemed MEMS mics could be more sensitive than this electret and could probably provide a better 'signal-to-noise' ratio. or maybe there are better electrets after all.
My electret is bought on an open marketplace (Alix). Hence, for now I'd made do, it has been an interesting experiment.
The electret mic (with this op amp circuit) works ok, while speaking near it like 1-2 feet away, it picks up the sounds.
But that my lousy electret has various hissing and clicks mixed up within the signals, I'm not too sure if better electrets could eliminate these issues and is more sensitive.

Oh, and the (LMV358) op amp did make a difference, without that amplification and it possibly help to remove some noise with that 470 uF cap (maybe common mode noise is removed?), i'm now able to detect / record background sounds which is otherwise impossible with the electret mic alone.
The electret mic signal levels are around 10mV
https://forum.allaboutcircuits.com/threads/whitelabel-unbranded-electret-microphone.184747/
This is probably that 'thermal noise floor', 1/f noise, pink noise etc.
The amplification has made it possible for sounds like that rather soft bird chirp (within ambient noise floor) to be recorded, which is within this thermal noise floor in amplitudes. That op amp also suppressed quite a lot of high frequency noises (which appear as single random spikes), if the rather high impedance electret mic is connected directly to the ADC, though it is likely those 'spikes' are at a higher frequency than the ear can hear them. With the op amp, all that random 'spikes' are gone (lower impedance output at the op amp).
 
Last edited:

Audioguru again

Joined Oct 21, 2019
6,705
In addition to your poor quality electret mic, the LMV358 opamp you are using is one of the noisiest opamps that show their noise level. Its noise level is more than 17 times the noise level of a hifi LM4562 dual opamp. The LM4562 needs a minimum supply of +/-5V.
 

Thread Starter

ag-123

Joined Apr 28, 2017
276
well, there are old phones, but that i think it is better to just leave them alone as they are after all working in order.
as it turns out searching for mems microphone as a keyword on aliexpress
https://www.aliexpress.com/wholesale?catId=0&SearchText=mems+microphone
turns up part numbers like
INMP441 | TDK - InvenSense
or
SPK0838HT4H-1
I'd guess if need be I can purchase one/few of them and try them out. There are probably many more manufacturers as after all those are used in phones/mobile phones etc.
The specs are pretty impressive, with the INMP441 having a SNR spec of 61 dbA and sensitivity of -26 dBFS. And that this is literally a digital part that output as digital signals over I2S. I could do away with op amps and such. For now I'd make do as other than the pink noise and lack of sensitivity, hissing, clicks noises etc the lousy electret mic would probably work ok for 'casual' usage.
Since I'm digitally processing the signals, one of those things I may try may be to
https://en.wikipedia.org/wiki/A-weighting
filter the signals accordingly to A-weighting or perhaps the simplest being C-weighting. C-weighting looks almost like a bandpass filter that high pass and attenuate the low frequencies and low pass and attenuate the high frequency signals. A weighting seemed harder to achieve, but it still looked like attenuating (low pass / high pass) signals. Perhaps that would make that pink noise sound more 'natural' to the ear.
The rational is that electrets after all has different sensitivity compared to the ear, i'd guess this accounts for the pink noise spectrum that is recorded. i.e. the electret is far more sensitive than the ear for low frequencies. If i do that i'd post an update.

AliX prices for those specific mems mics are about similar to those sold on Digikey etc which shows that those parts are likely imported parts. So one may as well order them from the likes of Digikey etc.
On public market places such as Alix, only electrets seemed 'cheap' going for like 10 for a dollar excluding shipping etc. Those are likely locally produced parts. The thing as it goes is those are sometimes a lottery, so for those who do not have time to deal with defects, poor sensitivity etc it is probably easier to order from the better sources.
 
Last edited:

Audioguru again

Joined Oct 21, 2019
6,705
Lookup Fletcher-Munson Hearing Loudness Curves to see that our hearing is most sensitive to the 3800Hz of a crying baby.
Low frequencies are heard with low sensitivity at low levels which is why many amplifiers have a "loudness" bass-boost switch or automatic depending on the volume control position.

A microphone, amplifier and speaker should all have a flat frequency response for sounds to sound normal.
A tone control is usually used to make a cheap poor quality sound system sound a little better or to make weird sounds.
 

Attachments

Top