Go Down

Topic: dB Meter from Electret Microphone (Read 3 times) previous topic - next topic


Arduino Community,

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.


Aug 21, 2013, 09:55 pm Last Edit: Aug 21, 2013, 10:00 pm by DVDdoug Reason: 1
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.

Windows serial port monitor: Tellurium | Arduino serial port debugging library: DBG | Cusom LCD char generator | Technical questions will only be answered in forum threads


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!




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.


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

Go Up