ekatzenstein

I picked up a this BOB for an electret microphone from SparkFun (https://www.sparkfun.com/products/9964), 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.)

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.

Quote

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.

* Audacity can create constant-noise, or test-tones that you can save as WAV or MP3.

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 Analog Serial Read 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.