Hi Everyone!
Recently I decided to make a volume meter with my Arduino.
I have a small mic hooked up to it, and I have a LCD screen for it to output to.
I want the meter to output to decibels, as a they seem like a pretty decent way to measure incoming volume.
The microphone sends analog voltage to the Arduino and I was wondering how I could convert it to decibel SPL (Sound Pressure Level) in an equation. I have read lots of articles online and I can't seem to find a solid answer to my question, so I came here.
Here is the data sheet for my microphone:
Oh … kay.
The mic wants 3v but is happy with 10, so you can use the 3.3v output on the arduino to power it.
I don't know what the output will "look" like to an analog in.
A problem is that the output is audio frequency - you'll need to smooth it. This probably involves wiring a capacitor … somewhere: I'm not an electronics guy. Or you can do it in software.
At a guess, the signal varies around a "zero" value - you'll need to subtract that value, square it, smooth it, and take the square root of that. Root Mean Square.
Your first issue is just connecting the thing to your ardiuiono and getting numbers off it. Once that is done, then you can look at the numbers and work out how they correspond to SPL.
Once you have that, then dB is a matter of math. Pick a 0db reference, divide the SPL by the reference SPL, take the log base 10, multiply that by 10.
IMO: software isn't the problem. Correctly hooking this mike to an analog input is.
frankplants:
Hi Everyone!
Recently I decided to make a volume meter with my Arduino.
I have a small mic hooked up to it, and I have a LCD screen for it to output to.
I want the meter to output to decibels, as a they seem like a pretty decent way to measure incoming volume.
The microphone sends analog voltage to the Arduino and I was wondering how I could convert it to decibel SPL (Sound Pressure Level) in an equation. I have read lots of articles online and I can't seem to find a solid answer to my question, so I came here.
Here is the data sheet for my microphone:
http://www.cui.com/product/resource/cma-4544pf-w.pdf
The short answer is "You can't". At least not without defining the exact hardware to be used. There is no fixed relation between dB and SPL. SPL is an absolute measure of sound pressure, while dB is a purely relative measure. There is no such thing as 0dB Absolute. A dB reading can only be relative to some reference level. The specific SPL level generated by a specific input signal will depend entirely on the hardware - i.e. - the specific amplifier and speakers or whatever transducers are actually used.
Regards,
Ray L.
Please post a schematic of your microphone input circuit (including anti-aliasing filter), and some test code that records a little bit of an audio waveform. Note that both the bandwidth and the signal to noise ratio for the AVR D/A are terrible by audio standards. It's more designed for instrumentation purposes. The bad SNR will mean that your SPL device will have an extremely limited dB range.
In order to solve the problem posed by Ray L., above, you would need to perform a one to one calibration using a tone source and proper SPL meter in an anechoic chamber.