dB Meter from Electret Microphone

Arduino Community,

I picked up a this BOB for an electret microphone from SparkFun (SparkFun Electret Microphone Breakout - BOB-12758 - SparkFun Electronics), and I need to find a way to convert it to a dB meter. Does anyone have any suggestions for this? Is this microphone fit for an accurate dB reading? I have limited experience in electronics and sound, but have worked with Arduino and am familiar with the programming side. Thanks so much for any help.

Sure, you can do that! You'll need a "real" SPL meter to calibrate yours.

FYI - There are some standards for frequency contour and response time that would be rather tricky to get right, so you wouldn't want to use a homemade meter for workplace noise compliance, or anything critical like that. But, you CAN build a meter that matches your "real" SPL meter with white/pink noise, or a test-tone.

There are lots of "VU Meter" projects, and if you can use a bargraph-style display, you can base your design on one of those projects. You'd simply need to calibrate and re-label the dB scale. Or, you can use an LCD numeric display.

dB is a relative measurement, so you need a reference.
Then it's calculated as 20 x log(Reading/Reference).

For example - Lets say you have a tone (or white/pink noise) and you measure 100dB* on your "real" meter. And, let's say you get a reading of 500** from the Arduino's ADC. You now know that your meter should display 100dB, when the ADC reads 500. If you now boost the volume to get a ADC reading of 1000, you can calculate the relative dB level... 20log(1000/500) = 6dB. So, your SPL reading is 106dB (6dB more than your reference). A reading of 250 will convert to -6dB, or 94dB SPL.

  • 100dB is WAY too LOUD to be playing with, I just wanted to make an easy example.

** Of course, we don't know what that reading will be because we don't know the sensitivity of the microphone, and that's why we need the real SPL meter. And, you''ll have to do some averaging (or maybe ignore everything except the peaks), since audio is constantly-changing AC, but the Arduino only reads the instantaneous voltage. And, since the signal/waveform goes positive & negative, the true-average is always zero, so you'll need to use the absolute value, or ignore the negative-half of the waveform, etc.

Also, the Sparkfun board is biased at 2.5V so you'll read about 512 with no sound and the AC waveform will swing around that bias. (That's good, because you can't put negative voltages into the Arduino.)

Thanks so much for the thorough explanation!

Thanks for the great question and the great explanation. Have been thinking of doing something similar myself recently, and this gives a great head start.

hey there

I am working on a similar project (Electret MIC + Arduino --> measure db) and I have roughly understood the answers so far. Roughly ;-).

Has anyone of you guys made any progress and would be willing to share? I'll be happy to provide some input as well, but coding from scratch might be too difficult for me (Arduino-First-timer)

So far, I am only displaying the measured voltage of the MIC...

any input would be great!

thanks and have a great day!

ben

Ben,

Do you have an SPL meter? Play a constant test-tone or white/pink noise* and tell me the SPL reading and the Arduino's ADC reading. (We don't need to convert the ADC reading to voltage.)

Even with a constant test-tone, the ADC reading is going to jump-around a LOT because we are reading random places on the sound-wave. So try to pick-out the peak/maximum reading.

Once we have an ADC reading that we can match to an SPL reading, I can help you with the calculations which can be done in your sketch.

Once the basics are working, you can add some code to your sketch to pick-out the peaks and maybe average/smooth the peaks.

Has anyone of you guys made any progress and would be willing to share? I

I have NOT built an SPL meter, so I don't have a working sketch to give you. But I do have many years of experience with audio & electronics. I've built a couple of sound-activated lighting effects with the Arduino, and I have an SPL meter. One of the lighting effects I built is a "giant VU meter", but it's not calibrated in dB. In fact, it's intentionally uncalibrated because it automatically adjusts to changing loudness for lots of "meter action", no mater how loud the music is playing.

Doug.

  • [u]Audacity[/u] can create constant-noise, or test-tones that you can save as WAV or MP3.

Hello guys,
This is a really interesting project. Has anyone ever tried this dB meter? I wonder if I could use it in silent rooms like the ones in hospital where the sound level should be around 30dB.

Gabriel

I wonder if I could use it in silent rooms like the ones in hospital where the sound level should be around 30dB.

That would depend on the quality of your analog electronics.

...I'm pretty sure the hospital rooms I've been are louder than 30dB SPL.

DVDdoug:
That would depend on the quality of your analog electronics.

...I'm pretty sure the hospital rooms I've been are louder than 30dB SPL.

Thank you for your help! I checked on a real SPL and the sound level is around 35dB.

All I need to do is connect the Electret Microphone (SparkFun Electret Microphone Breakout - BOB-12758 - SparkFun Electronics) on my Arduino and do the programming, since it comes with a amplifier, right ? Do I need anything more ?

Regards,
Gabriel

All I need to do is connect the Electret Microphone (https://www.sparkfun.com/products/9964) on my Arduino and do the programming, since it comes with a amplifier, right ?

Yes, that should do it. At least that should get you started.

Then to quickly test it, you can just run the [u]Analog Serial Read[/u] sketch to see the ADC readings on your computer monitor. Like I said above, the readings are going to jump all over the place "randomly" and you'll have to mentally pick-out the peaks.

That amplifier has fixed gain and I'm not sure about the amplifier's electrical noise so I'm not sure what kind of usable range you'll get. I just have a feeling that 30dB SPL is going to be "difficult". There is also the possibility of saturating the amplifier and running-out of range on the loud-end if you are checking the loudness of rock bands.