Go Down

Topic: Arduino UNO measuring audio voltages (Read 1 time) previous topic - next topic

eds_law_

Mar 30, 2017, 03:28 pm Last Edit: May 03, 2017, 09:22 am by eds_law_
never mind

DVDdoug

#1
Mar 30, 2017, 05:25 pm Last Edit: Mar 30, 2017, 05:26 pm by DVDdoug
If you search the forum for 'SPL' you'll get some hits.  This has been discussed & done before.   Although you can make something like an SPL meter, it's difficult to make a "real one" because of averaging & weighting.

Quote
I know that the sensitivity of the electret mic is -44dBV/Pa, how can I use these values to calculate a value for decibels?
There's usually a fair amount of tolerance in those specs and virtually every SPL meter is calibrated against an already-calibrated SPL meter.   

Do you know what those numbers mean?   I assume that's RMS voltage...

0dBV is 1 volt, so -44dB is 6.1mV 
  dB = 20log(Vx/Vref)
  Voltage Ratio = 10(dB/20)

One Pa is 94dB SPL (I just Googled that.)  So, 94dB is 6mV (before amplification?).


Once you've got "the numbers" you can choose 94dB or calculate any other dB value as your internal reference.

For example, if you read 12mV, that's +6dB relative to your 6mV reference, so you've got 100dB SPL.


Quote
float RMS = (volts*0.3535);
That's only true for a sine wave.   Real world sounds will have a larger peak-to-RMS (or peak-to-average) ratio.  You can choose to measure peak SPL, average SPL, or RMS SPL, but you'll have to make RMS or average calculations the "hard way".  (And average is easier than RMS). 



Hardware -
Are you getting 'useful' readings?

The MAX4466 is an amplifier chip, not a microphone.   Do you know how much amplification you've got?

I'm guessing The Arduino can't measure negative voltages and I assume the amplifier's output is biased but you didn't subtract-out the bias in your readings.

Grumpy_Mike

Everything above plus:-
Quote
a MAX4466 electret microphone to measure sound level and have coded it so that it prints out a variation of levels from 0 - 3.3v depending on sound level.
OK it would be good to see the circuit.
Are you using an envelope follower? If not then the chances of that code finding the actual peak of the waveform are slim, and the chances drop as the frequency increases.
The code:-
Code: [Select]
if (sample < 1024)  // toss out spurious readings
Is stupid : you can never get a reading equal or greater than 1024 from the A/D.
And why convert the reading to volts anyway, it takes time and it is perfectly fine as an arbitrary units number.

Go Up