A sensitive microphone module?

Following on from this forum post from a couple of years ago, I am trying to find a microphone module (OR make a circuit to be included in my multisensor) that is able to work to detect the presence of noise in a quiet room and trigger a signal. The forum post referenced here is a frustrating read, as many respondents do not seem to be distinguishing between audio noise and electrical noise. (A point raised by grump_mike on that thread.)

I have bought a few of the KY-038 modules and found them to be useless for my application as they are able to detect loud claps nearby but when the trigger level is adjusted to the absolute minimum without it triggering constantly, it is not sensitive to hear anything much quieter than that. For example someone talking a metre or two away, or even shouting.

I then drew up my own circuit using a dual op-amp (LM358), the first of which is used as a signal amp, the second as a trigger with adjustable input. A pot on the inverting input of the second. Powered by 3.3V through an LM1117 I fear the noise floor (electrical noise!) is amplified so much that adjusting the trigger level still doesn't give me the sensitivity I need for this application. My circuit is notably different from that of the module above, which doesn't seem to have any amplification but instead uses an op amp just as a trigger for the digital output. (Nor interestingly does that have the ability to set the digital signal trigger time e.g. like a triggering PIR module - may be fine for direct coding in Arduino but when connecting up to a digital input in e.g. Tasmota, which sees the digital input as a "switch" and I think has slower response time to digital changes, doesn't work. My circuit below doesn't have that, but a schmitt trigger can be added to the output easily.)

I need to be able to distinguish between levels in the range of around 52 to 55dB.

The cheap module mentioned above cannot distinguish much below 55dB in my estimation:

I have also seen the MAX4466 breakout, and I'm aware of similar modules (MAX9814 / SPW2430).

Can someone recommend whether these will do what I want, or do I need to change tack altogether? Perhaps a small electret mic won't do it? Perhaps I need to do a lot more when it comes to noiseless amplification?

To be clear, I do not need any analysis of the audio other than level - at least nothing complex. It will be used to sense if there is a person moving or speaking in a room. Perhaps I can lower my spec to allow it to sense someone talking loudly or even shouting or clapping quietly from a distance.

Do you have a calibrated sound meter so you can properly test which ever device you select?
Paul

Unfortunately I do not, it would be good to get some objective idea of sound level. I was thinking of buying a condenser mic and a half decent audio interface for my computer though (for youtube reasons), which would allow me to monitor such levels.

I have a good scope though, so for now I hope to test with my voice and the scope.

Without a DB METER the only thing you can do is adjust the pot for minimum sensitivity and then increase it incrementally while triggering the sound you want to detect until it triggers.

You're not trying to build an SPL meter, right?

If you need to know the SPL level there are apps for smart phones. But different phones will vary in sensitivity so I wouldn't trust it unless it's calibrated for a particular model, and even then there will be some variation.

Or, you can get an [inexpensive SPL meter[/url]. Of course, these are just for casual use and not certified for regulatory or legal purposes.

You'll probably just have to try-out your circuit. You can check the electrical noise by shorting-out the mic. Or by removing the mic and shorting the input.

You should probably have variable gain. Or, most mic preamps simply have an attenuator ("volume control") on the input. And, then you probably don't need the adjustable sensitivity on the comparator. ...You may not need the comparator unless you're using an interrupt, or unless you want the Schmitt trigger or some kind of "pulse stretching", etc. If you are "sampling" or "polling" the input, you can read an analog input just as easy as reading a digital input.

Since the signal isn't biased your circuit "looks like" it's supposed to run from dual +/- power supplies. If that's that case, make sure to protect the Arduino from negative voltages.

I was thinking of buying a condenser mic and a half decent audio interface for my computer though (for youtube reasons), which would allow me to monitor such levels.

That should work and electrical noise shouldn't be a problem. Would that use the computer instead of using the Arduino?

...You still might not have enough gain for a "full signal" at -55dB.

If you want to use the analog output of the interface into the Arduino, look for an interface with direct-hardware monitoring so the signal doesn't have to go through the computer.

A little mixer is another way to get an inexpensive mic preamp. There are "USB mixers" that double as an audio interface.

With either of those and an Arduino, you have to protect the against the negative half of the AC audio signal.

...And, you'd have to re-calibrate (re-adjust the level control) when you go back-and-forth between your YouTube stuff.

](https://www.parts-express.com/search?keywords=spl%20meter)

Perhaps I need to do a lot more when it comes to noiseless amplification?

Noiseless amplification is not possible.

The dB level is not that useful. What you can do is discriminate between different types of sounds, and possibly recognize a particular type of sound. This is something that the brain does extremely well but microphones don't do at all.

This is a complex and currently, a hot topic in machine learning, using powerful computers.

The dB level is not that useful. What you can do is discriminate between different types of sounds, and possibly recognize a particular type of sound. This is something that the brain does extremely well but microphones don't do at all.

This is a complex and currently, a hot topic in machine learning, using powerful computers.

Record the sound and run an FFT for the harmonic frequencies using an iPhone FFT app and amplitude levels and then make a an op amp notch-pass filter (HPF followed by LPF, resulting in NOTCH-PASS band in between the two. The order of the filter
would determine the selectivity of the filter.

The MAX9814 boards are by far the most sensitive of the one's that I've used (includes at least the KY-038 and the FC-109 / MAX9812 boards).

The MAX9814 boards into an Arduino ADC will easily give you usable signal at whispered conversation levels across a room. It has automatic gain control, so it will adapt to much louder levels without saturating.

The FC-109 / MAX9812 boards are usable for moderately loud voices spoken into the microphone, but probably not suitable for the application you've described.

KY-038 is pretty much useless for capturing analog audio at any reasonable volume.

Thanks Mark, I had initially assumed I should avoid sensors with AGC on the grounds that it would be too difficult to calibrate the noise level against a moving target.

Perhaps what AGC would give me is the chance to increase amplification to the point where it’s easy to distinguish between “quiet room” noise (distant sound of cars outside etc) and slightly louder noises such as talking in the room.

I’m aware that audio presence sensing is an advanced topic, and I’m minded to agree with another user here who said FFT analysis would be needed for any meaningful sensing. Perhaps I’m looking for a silver bullet, or perhaps AGC is exactly what I need.

Clearly I need to get hold of this and test, but what you described sounds perfect for my needs. I guess the key is, if there’s an analog output, working out what voltage level would be considered a trigger. Haven’t even looked at the data sheet yet, typing from phone in bed, look forward to looking this up!

An automation company has recently released a multisensor that does what I am trying to do and I’m interested in how they did it and was hoping there may be a simple method or analysis chip that is purpose built for this application. I have done quite a bit of online research but haven’t yet made much progress on in that front.

Out of interest how are you using this chip yourself? Just for testing so far?

Thanks

NB I have bought an ATTiny85 which I plan to use as a “bridge” to the ESP32 and to reduce need for other circuitry. I may be able to do some basic detection of signal envelopes in code.

Looks like the MAX9814 has a digitally controlled selectable gain, so could also use a spare pin from the ATTiny85 to calibrate as per requirements, ie dynamically!

p.p.s. I pretty much understand the data sheet but it mentions “Tri level digital input”, what does that mean? A single pin with three voltages (not really digital), a serial input, or a two bit input?

hazymat:
Thanks Mark, I had initially assumed I should avoid sensors with AGC on the grounds that it would be too difficult to calibrate the noise level against a moving target.

AGC will only kick in to limit the amplification when the sound is "loud" by some definition. In a nominally quiet room it won't be a factor. Also you can set the maximum gain to a lower level, so the sound would have to be louder for it to kick in.

I pretty much understand the data sheet but it mentions "Tri level digital input", what does that mean? A single pin with three voltages (not really digital), a serial input, or a two bit input?

These pins really do respond to three levels, grounded, tied to Vcc, and left floating. One could control this with an Arduino digital pin by setting it to be low, high, or with the Arduino pin configured as an input respectively. The modules expose one such pin for maximum gain setting, and one for the AGC response time.

Out of interest how are you using this chip yourself? Just for testing so far?

I've done a number of sound related projects where I'm mostly just interested in capturing wiggling voltage and less interested in the absolute amplitude. I've posted code for single frequency tone detection here and some workable "guitar tuner" core code here. I've done some prototype work on an acoustic modem and on audio direction finding.


Excellent, I have just bought this chip on Amazon next day delivery, something for the weekend. Thanks for explaining the three level digital signal and for the idea of setting arduino pin as input. May post back here after an initial play with it.

Hi Hazymat; I'm surprised no-one has picked up on this.

The loudness of a sound is a function of its power in watts. Your circuit (full marks for using an op amp) is measuring instantaneous voltage. So from W = V^2 / R you need to square it.

You can do this with a simple rectifier.

I'd suggest - very easy modifications - add a rectifier as shown here - "simple precision rectifier" in place of the second op amp which you have wired as a comparator.

Then feed the output to an analog input where you can measure the voltage and do a comparison in software.

The kind of voltage from a microphone in a quiet room is a microvolt or so, way below the level
a single opamp stage could usefully amplify. A good microphone amp is able to give upto 75dB of
gain or so with good bandwidth and low noise and no hum - this is more what you need to bring
the level up to sensible voltage levels. A single LM358 was a poor choice, and a single-ended amp
design will be suffering from mains hum pickup most likely, which is why studio mics are all
balanced output and decent mic amps are all differential.

A couple of things I forgot, if you want to build your own circuit and you want to go with analog -

There is a circuit called a [u]Peak Detector[/u] (or sometimes called an "Envelope Follower"). That's a simple modification of the precision rectifier mentioned above. It puts-out a varying DC voltage proportional to the AC audio peak. The advantage is that you always "catch" the peak loudness without having to sample the audio waveform thousands of times per second.

I don't know why I forgot about that... I use a peak detector all the time with my sound-activated lighting effects and I sample the "loudness" about 10 times per second in this application.

Another thing you can do with analog is use the optional 1.1V ADC reference for about 5 times the sensitivity. I also use that all the time... But since I'm not looking for a specific level, I switch automatically between the 1.12V and 5V references as necessary.

Hi @MarkT can you PM me on a different matter please so I can contact you?

The kind of voltage from a microphone in a quiet room is a microvolt or so

well it depends on the microphone you are using. Modern electrets give a LOT more output than some other types.
And the OP wants to detect NOISE in a quiet room. How loud we dont know.

For a simple inexpensive experiment the circuit he has already will give interesting results. The LM358 has a GBW of 1.2MHz so can be used at a gain of 100. The Peak detector (just a variation on the active detector I suggested) can also be configured for a high gain, so overall should be sensitive enough.

@hazymat: you dont show op amp supplies in your schematic - I hope you arent expecting to power the 358 from 5V single supply!

@hazymat: you dont show op amp supplies in your schematic - I hope you arent expecting to power the 358 from 5V single supply!

LT1215 was specifically designed for operation from 5V (although it can work up to +/-18V)
The Peak Detector followed by an analog input may tell you something.

@Raschemmel - gosh that LT1215 is an expensive beast!

I tested a lot of op amps before making the short list in my op amps tutorial

I'd suggest the MPC6022 would be a good choice and a lot less expensive!

I tested this with a microphone of unknown origin. Its barely sensitive enough to respond to a rather loud whistle near the microphone, so I reckon you would need more gain.

But the gain of each stage is already set to 100 so it would need another stage of amplification. 2 op amps isnt enough, and a gain of more than 100 from an op amp is pushing the boundaries.

I'm using the INTERNAL (ie 1.1V) reference and just getting say a reading of 30 from ambient noise.

mic amp detector.png

mic amp detector.png