Pages: [1]   Go Down
Author Topic: dB Meter from Electret Microphone  (Read 2370 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Edison Member
*
Karma: 32
Posts: 1282
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)

« Last Edit: August 21, 2013, 03:00:29 pm by DVDdoug » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks so much for the thorough explanation!
Logged

Melbourne, Australia
Offline Offline
God Member
*****
Karma: 8
Posts: 567
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

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

Pages: [1]   Go Up
Jump to: