Noise detecting microphone based circuit - Page 1
Forum section: electronics / beginners

author: mribble
author_rank: Regular Contributor
timestamp: September 16, 2017, 11:57:34 pm
content: I'm looking to make a small sound sensor I can plug into a 3.3V microcontroller to detect sound. I want to detect sound very quickly so those sound detecting circuits online that use a big filtering cap isn't a good solution. I have used something like this one in the pasthttps://learn.sparkfun.com/tutorials/electret-mic-breakout-board-hookup-guide.Here are a few things I'd like to improve with that circuit though.It doesn't detect quiet noises very well. Is increasing the dynamic range just a case of using a larger gain amplifier, or should I be looking for a different type of microphone?This circuit outputs a sound wave centered at vcc/2. I don't care about the sound wave and would rather just detect amplitude. One way I can think to do this visually is to bias the sound wave by -vcc/2 and then take the absolute value of the wave so nothing goes to negative voltage. Then multiple by 2 to use the full vcc. That said I have no idea how to accomplish this in an analog circuit. Can anyone give me some pointer on this or some other better solution for this kind of problem?Any other suggestions for this kind of circuit? I want to keep it simple and cheap since I'll be making a lot of them.

author: Audioguru
author_rank: Super Contributor
timestamp: September 17, 2017, 02:17:24 am
content: The Sparkfun mic board is cheap so it uses a noisy preamp IC with fairly low gain. Instead use an audio low noise opamp with as much gain as you want.Use an active rectifier circuit in a peak detector circuit to show the absolute DC level.

author: mribble
author_rank: Regular Contributor
timestamp: September 17, 2017, 05:39:14 pm
content: Thanks. That was very useful on getting me started. However, after looking through this I think you might be missing at least one stage.Here would be the major stages of the circuit to do what I described in the first post.Amplify the audio signal. I could do this with a cheap op amp, or with something more expensive like MAX4466(http://www.mouser.com/ds/2/256/MAX4465-MAX4469-62764.pdf). Since I don't really care about the quality of the audio signal I wonder how much advantage there is to using a special audio op amp? The output of this would be sound wave with a max of 0->3.3VThen I would run this through a full wave rectifier. This is a pretty standard circuit using 2 op amps. It would be nice if I could do the gain and biasing here, but I don't think that is possible.Then I would do a 3.3/2V offset and a 2x gain using a differential amplifier (1 op amp).Do people this is an efficient approach? Any suggestions in component selection?

author: nali
author_rank: Frequent Contributor
timestamp: September 17, 2017, 05:50:28 pm
content: Do you want to compensate for ambient noise? You could run the rectified audio through an integrator, then use an open-collector comparator to compare the instantaneous and averaged values to give you a logic level pulse.

author: mribble
author_rank: Regular Contributor
timestamp: September 17, 2017, 06:06:56 pm
content: Nali, I don't think I need an integrator. The micro I'm using has a reasonably fast ADC and can handle about 1M samples per second. I plan to check this sound wave at around 100Khz in software because response time is critical and I figure with sound waves mostly being under 10Khz then a sample rate of 100Khz should be more than enough. I don't want to just use a comparator to allow use of digital reads since I don't need the speed and analog reads give me more flexibility in software in determining quit sounds from loud sounds.One big issue I am seeing with op amps like LM324http://www.ti.com/lit/ds/symlink/lm324.pdfis their common mode input voltage. I'm not an expert on this so please correct me if I'm wrong, but if I understand things correctly this op amp won't work. The issue seems to be that input voltage can't be larger than vcc-1.5v. Since I only have 0->3.3V. This means anything 1.8V would be bad input. Basically throwing out almost half of my sound wave after amplification during full wave rectification. Is my understanding correct, and is there a cheap standard opamp that doesn't have this limitation? If this isn't easy to fix I'll probably just use the MAX chip (which doesn't have this limitation) and then do all the filtering in software using a bias of half vcc (software vs hardware tradeoff).

author: Richard Crowley
author_rank: Super Contributor
timestamp: September 17, 2017, 06:10:48 pm
content: The advantage of a higher-quality amplifier is increased signal-to-noise ratio (SNR). As you say, the actual "quality" of the signal is not important to you, so that is not a reason to use a higher-quality amplifier. However, you seem to be seeking better SNR so that it is more sensitive to quieter sounds without your signal of interest being stuck down "in the mud" of microphone self-noise and amplifier circuit noise. Look for specialized audio preamp chips that are designed for low-noise operation.Note also that some microphones have less self-noise than others. Inexpensive electret capacitor mic capsules are NOT known for having low self-noise. Some of them do, but you would have to buy 100 of them and test them to find a few really quiet ones.

author: mribble
author_rank: Regular Contributor
timestamp: September 17, 2017, 06:32:55 pm
content: Richard, I do want to detect reasonably quiet noises, but they don't need to be super quiet. Detecting anything in the 40-50 db would be fine. On mouser there are ton's of cheap Electret mics that seem capable of this (http://www.mouser.com/Electromechanical/Audio-Devices/Microphones/_/N-awp4b/?Ns=Pricing|0). Actually they list the db levels as negative, which I don't understand since -40db would be a crazy low sound level to actually detect.Anyways I can try a mic and see if they work as expected. If not are you suggesting a different type of mic that is more sensitive such as a mems mic?You do have a good point about low noise amplifiers probably being useful for my use case though.

author: MasterT
author_rank: Frequent Contributor
timestamp: September 17, 2017, 09:45:59 pm
content: If you have a microcontroller, than do rectification in software. You don't need any hardware, except SFE mic board, that especially biased at Vcc/2 to be connected with uni-polar ADC, like arduino boards have. Using fast sampling, sensitivity may be very high.

author: mribble
author_rank: Regular Contributor
timestamp: September 17, 2017, 09:58:45 pm
content: The SFE isn't very sensitive and is quite noisy. In theory if I could do what I described I would double the usable range, but I think just getting a cleaner signal and not trying to rectify/offset/amplify the signal again is worth the effort. It seems the more important thing is just getting a better preamp stage.

author: StillTrying
author_rank: Super Contributor
timestamp: September 17, 2017, 10:51:09 pm
content: You can do a gain of X50 with a single 100mA transistor, Out is at 1.5V so could go straight to a uP ADC input.

author: Audioguru
author_rank: Super Contributor
timestamp: September 18, 2017, 01:58:49 am
content: One week ago Sparkfun had an electret mic on a board with the very noisy MAX4466 preamp IC that has 10 times more noise (!) than an audio OPA134 opamp.They heard me post about it. Now Sparkfun is using the OPA344 opamp that is a little better than the MAX4466 but it also does not have low noise.

author: mribble
author_rank: Regular Contributor
timestamp: September 18, 2017, 01:36:28 pm
content: Could you point me to Sparkfun's efforts with MAX4466 and OPA134? I can't seem to find them. Also please point me to your post since that sounds interesting.I did find that sparkfun seems to be using OPA344.Prices of each of the 3 opamps that came up in discussion in 100 quantites at Mouser are:MAX4466: $0.30OPA134: $1.94OPA344: $0.96What is the correct noise characteristic to use from the data sheet? I think it would be THD+Noise. This changes for different frequencies, but below are the numbers for each chip at 1Khz:MAX4466: 0.02%OPA134: 0.00008%OPA344: 0.006%To make sure I understand THD+N that number basically means if I have a 10 bit ADC (1024) values I'd take the percentage times 1024 to find the number of values in the ADC that would be noisy. This is less than 1 bit of noise even for the MAX4466. Is this analysis correct? If so I don't see a reason to go with the more expensive op amps in my system.I would expect much more than 1 bit of total noise though since I know there will be other sources of noise (such as my power supply). That's fine I just want to pick the right op amp for my use case.

author: Richard Crowley
author_rank: Super Contributor
timestamp: September 18, 2017, 03:24:49 pm
content: Remember that the self-noise from the microphone capsule is probably a bigger contributor to your noise floor than the op-amp used in the mic preamp stage.

author: MasterT
author_rank: Frequent Contributor
timestamp: September 18, 2017, 04:18:08 pm
content: Quote from: mribble on September 18, 2017, 01:36:28 pmCorrect. 10-bits ADC has 0.1% THD+N. But if you know acoustic properties of your noise source, than this can be easily fixed using averaging and filtering. Let say the lowest frequency of the noise is 20 Hz, unlikely mic can get anything below anyway. Setting ADC sampling frequency to 100 ksps (the higher the better) you can improve your THD+N by factor : sqrt(100 000 / 20) = 70.71, from initial 0.1% down to 0.001414213562 %.But, there are two options, make an analog envelope detector and than feed ADC with DC signal, or apply biased AC to ADC directly. You can't do averaging with analog detector circuitry.

author: mribble
author_rank: Regular Contributor
timestamp: September 18, 2017, 05:09:00 pm
content: Thanks for the feedback. It was really useful. I think it's time to take what I've learned, build a prototype, and see how it performs. Thanks!!