Go Down

Topic: Analog volume reading circuit (Read 596 times) previous topic - next topic

phildo

I think what I'm looking for is essentially this: https://store.arduino.cc/usa/grove-sound-sensor

I have an electret microphone and an LM386 amplifier- is there a straightforward way to recreate a similar circuit? (I can't find a datasheet for this circuit, nor any other circuits that do the same [output volume readable by an arduino]).

The goal is to be able to read volume via an analog pin- I'm NOT interested in losslessly capturing a waveform or anything.

Also, I'm not looking to undercut Grove or save the $5 to buy this chip (I just bought 2 in case I can't figure this out)- but I'd like to 1. learn what/how/why the circuit works, and 2. potentially be able to modify it.

Thanks for any help! (Also- any tips you can think of that might go along with using this circuit would be appreciated!)

MrMark

#1
Jan 29, 2020, 09:54 pm Last Edit: Jan 29, 2020, 10:00 pm by MrMark
There is a schematic under the documents here: https://www.seeedstudio.com/Grove-Sound-Sensor.html

Curiously, both descriptions describe the amplifier as an LM386 "power amplifier" while the schematics and the pictures of the modules show an LM358 "low power dual op-amp".  The LM386 is a power amplifier intended to drive small speakers and would be a poor choice for a microphone amplifier.

For what it's worth, my preferred microphone module for Arduino are those based on the MAX9814 which has automatic gain control (20 dB range) and three gain settings (40, 50, 60 dB at max AGC) that can be controlled by a digital pin if necessary.  

I haven't used the Grove module, so I can't speak from experience about its performance, but the common KY-037 modules have insufficient voltage swing for an Arduino analog input at normal sound levels.

slipstick

The circuit you're looking for is called an "envelope follower". Add "Arduino" and search on that term and you will find lots of useful information.

Steve

DVDdoug

#3
Jan 30, 2020, 07:47 am Last Edit: Jan 30, 2020, 07:51 am by DVDdoug
Quote
For what it's worth, my preferred microphone module for Arduino are those based on the MAX9814 which has automatic gain control
AGC will mess-up loudness measurements. ;)  

Sparkfun gives a link to the schematic for their microphone board.

Quote
The goal is to be able to read volume via an analog pin- I'm NOT interested in losslessly capturing a waveform or anything.
Here is a peak detector (envelope follower).    It goes after the preamp.

I've seen boards with a built-in envelope follower but I don't have a link.

It can also be done in software, by finding the peaks or by averaging the positive or absolute values, etc.   But, you have to run a "fast loop" and there isn't much time to do other things.

Grumpy_Mike

Be aware that measuring the peak voltage of an audio wave will not give a very accurate representation of the perceived volume of a sound.

This is because some sounds have high peaks but overall are not as loud as sounds that have a high sustained average of peaks. Even if those peaks are lower than the first sound.

MrMark

AGC will mess-up loudness measurements. ;)
Fair point.

I suppose if one wanted to get fancy, the AGC level is a function of the voltage across the capacitor on pin Ct of the MAX9814 and that could be tapped into and monitored via an ADC channel, but that probably gets ugly quickly.

Go Up