# Arduino dBSPL meter

Hi Guys

I am busy with a project that has a few phases, the first phase is the most difficult one in my eyes and i would really like some guidance on how and where to begin.

I want to use a mic, pre amp and Uno to accurately measure dBm from a speaker. at the risk of sounding very naive what is the formula to calculate the dbm from a mic out put of 2.7 to 5 v ? i would prefer to stay away from the IC that spit out dbm for you as i need to know what the calculation is for the next phase

any help would be great

is this the fomula Formula: dB = 20 x Log (volts1/volts2) or 20 Log (2.5/5)?

Over what frequency band? What weighting curve? You can take a bunch of samples and rms them, but the arduino is severely band limited and will chop off a lot of the signal typically used for this measurement.

well it wil be used for bird sounds and the bird sounds range from 50hz to 200 khz as far as we know, but we do not want to record we only want a decibel reading

Do you have a precision microphone in mind that will give you accurate SPL for a certain voltage?

Arduino cannot directly digitize a 200kHz frequency. Your best bet is to buy a meter - Radio Shack used to have a good one - and hack into the meter to get a DC reading that the Arduino can handle.

dBm (note capitalization) is a measure of power where 1mW = 0dBm. You are looking for (as you do say in the subject line) dB SPL, which is something else.

But dB SPL is based on how loud a sound is to a human. So 0dB SPL is set by the threshhold of hearing of a human, and changes according to frequency. That is the "weighting scale" mentioned by KeithRB. However, at the peak or best response of the human ear, that is 20uPa (20 micropascals) of sound pressure.

http://www.phon.ucl.ac.uk/courses/spsci/acoustics/week1-2.pdf

http://www.engineeringtoolbox.com/decibel-d_59.html

Keep in mind that 10x the voltage in a measuring circuit is 100x the power, hence 10x the voltage is +20dB above the reference.

For your purposes, you could use that over the entire range you wish to cover. You are going to have a devil of a time finding a transducer (microphone) that can cover that with a flat or at least known/measurable response curve.

So.... Normally you'd build the thing and then calibrate it using test signals and a known-good SPL meter as a reference.

There are companies that calibrate scientific equipment, but proper calibration would cost you about as much as purchasing an SPL meter. If you just need something "useful", but not necessarily scientifically-accurate, you can calibrate it yourself with test tones (or pink noise) and a known-good SPL meter.

calculate the dbm from a mic out put of 2.7 to 5 v ?

You can look-up the microhone sensitivity spec. That will give the voltage (in millivolts) for a given SPL level. Then, you have to compensate for the preamp gain. The specs for an ordinary recording/performance mic are just a guideline. You can get a calibrated instrumentation microphone that comes with the actual test results for that specific unit. [u]This[/u] is the least expensive calibrated mic I know of (\$50 USD). They generally go for a LOT more.

...bird sounds range from 50hz to 200 khz as far as we know,

Is that a typo? 200kHz would be a problem. You'd probably need a 2nd special ultrasonic transducer for that, and since it's above the normal audio range, you'd have to devise a method of calibrating it... That would require some "serious science"...

The good thing is that the Arduino itself doesn't need to go to 200kHz. You can use an analog "averaging circuit" to convert the high-frequency AC signal to varying DC. For my (uncalibrated) meter lighting effects, I use a [u]Peak Detector circuit[/u]. You'd probably want something where the DC follows the average level, rather than the peaks. That can be done with a low-pass filter (or something like a low-pass filter). But, that also means that any weighting has to be done in analog, since there is no frequency-information going into the Arduino.

If a bird actually makes sounds up to 200kHz, I would guess it's also making lower frequencies at the same time. Those lower frequencies will mask (drown-out) the supersonic frequencies anyway. You'd have to do spectral analysis to detect the high frequencies..... A single "loudness" measurement isn't going to do it. And unless you are in a soundproof studio, there will be lots of other ambient sounds masking those frequencies (and maybe even drowning-out audible bird sounds). High frequencies are also greatly attenuated in air, so if there is much distance, the supersonics won't be measurable.

What bird goes down to 50Hz? An ostrich?

The trilling/warbling would be at lower frequencies, so you would have a higher frequency tone amplitude modulated by the 50 Hz.

Actually, if you AM modulate, say, a 50kHz tone with 50Hz, you don't get a 50Hz tone. You get 49.950kHz, 50kHz, and 50.050kHz.

WOW guys

thank for the great response ! one thing i can see now is that i have clearly miss judges of how complicated this is. let me explain what my project has to do and maybe you would get a better idea on how to do it.

First of tracking is not possible as birds can not carry anything more then 25g

the Background I am studding the territorial behavior of a bird called South african koraan. our studies have show that these birds hand there territories down from generation to generation rather then being owned by dominate males.

the problem these birds habit is normally very thick and you can barley see 5 meters into the bush from the road. but you always always hear them when driving through their area.

the idea we want to be able to listen to the sound get a decibel reading and calculate the distance from where we are to where the bird is. Crazy ? well the rest is easy. we know the birds natural decibel level at 1 meter is around 85 decibel and we know in the thick bush we can hear the bird up to 100 meters away. so i have two of the three factors needed to calculate the distance. and i can do it using a linear graph but if i can make this work the next stage would saving the Decibels and distance on a SD card. and final stage would be to take a GPS reading from where recorded and calculate where the bird was heard.( we can already point out direction)

so where does that leave me now? is a very expensive mic required for what i want to do ?

[EDIT] 50hz to 20Khz is more then enough

Does the microphone really need to pick up all the way to 200kHz, or is up to around 20kHz enough?

Oh! That is a rather huge difference. Really huge difference.

50 to 200Hz isn't a problem. How much of a problem is ambient noise?

that is good to know ! would 1 -6 khz also be doable ? ( other bird) setting on device ? ambient noise is generally insects and the bird sound over powers insect sound by far.

 come to think of it what good would the device be for anything outside human hearing range. since we first ID the bird by hearing it and then taking a measurement. so if the device does what a human can hear it will be sufficient

the Mic i am planning on using is this mic. it very small size and has a op amp built in. (100x) the mic sensitivity is (0dB=1v/Pa)

Did you mean 1kHz to 6kHz?

yes 1khz to 6khz . sorry here is the link http://netram.co.za/1097-electret-microphone-breakout-board.html . under documents there is data sheet for the op amp and one for the mic. but i am still not clear on what the output voltage range is.

What you need is a log detector. It accepts a signal and outputs a voltage that is a function of the logarithm of the input power.

They are meant for RF, but a few go down to DC. The AD8307, for instance. It has a 92dB dynamic range. http://www.analog.com/en/rfif-components/detectors/ad8307/products/product.html

There are a LOT of samples of interfaces from the AD8307 to an Arduino. Most are for RF work, but to the Arduino side, it makes no difference what frequency is going into the AD8307.