11
\$\begingroup\$

I am taking input from an electret microphone amplified using LM358 amplifier from my PIC16F877A's ADC unit. I am getting the readings in volts from the ADC which ranges from 2.5V to 5V.

How can I convert these readings into dB?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Use the sensitivity figure given in the microphone's datasheet. \$\endgroup\$
    – user16324
    Commented Jan 12, 2014 at 13:22
  • \$\begingroup\$ Here is the datasheet of the mic:- dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Sound/… \$\endgroup\$
    – user35456
    Commented Jan 12, 2014 at 13:32
  • \$\begingroup\$ It's sensitivity is -46±2.0,(0dB=1V/Pa) at 1K Hz. \$\endgroup\$
    – user35456
    Commented Jan 12, 2014 at 13:33
  • \$\begingroup\$ The LM358 has too much noise (hisssss) and other problems to be a mic preamp. Use an audio opamp instead. \$\endgroup\$
    – Audioguru
    Commented Jun 23, 2022 at 2:21

3 Answers 3

12
\$\begingroup\$

dB SPL is a pressure measuring unit.

You can't convert a voltage to a dB SPL reading unless you know:

  • the microphone sensitivity (or simply the analog output voltage to the input pressure ratio) which tells you essentially the voltage level it will output for a given sound pressure level
  • the gain that the preamp has applied

Your microphone has a sensitivity of -46dBV/Pa , this gives 0.005012 V RMS/ Pa
1 Pa (pascal) equals 94 dB sound pressure (SPL)

The dB equation for voltage is \$ 20 \times \log \frac {V_1}{V_o} \$
where \$ V_1 \$ is the voltage being measured, and \$ V_0 \$ is the reference level.

If we do an example calculation for the measurement of 2.5 V (assuming a unity gain for the amplifier) we get

\$ 20 \times \log \frac {2.5}{0.005012} = 53.96 \ \text{dB} \$

so the SPL will be (-46) + 53.96 = 7.95 + 94 = 101.95 dB SPL

We assumed a unity gain for the preamplifier; if the actual gain was 20dB then the SPL becomes: 101.95 - 20 = 81.95 dB SPL

If the actual gain was 10dB then the SPL becomes:
101.95 - 10 = 91.95 dB SPL ...

\$\endgroup\$
8
  • \$\begingroup\$ I knew the mic's sensitivity: It's sensitivity is -46±2.0,(0dB=1V/Pa) at 1K Hz But nothing about gain that the preamp has applied \$\endgroup\$
    – user35456
    Commented Jan 12, 2014 at 13:42
  • \$\begingroup\$ I suppose you could calibrate the preamp, or even use its ideal equations as a very close estimate. \$\endgroup\$ Commented Jan 12, 2014 at 16:15
  • \$\begingroup\$ @alexan_e: Thank you very much. Just one more help in detemining the gain of my OpAmp. \$\endgroup\$
    – user35456
    Commented Jan 13, 2014 at 5:09
  • \$\begingroup\$ @user35456 You said you are using a LM358 preamp so the gain is set with the resistor values you have used and should be definable. For example, if it looks like this then the gain is set by R2,R1. Also check if you have applied any gain in your ADC (I'm not familiar with PIC ADC) \$\endgroup\$
    – alexan_e
    Commented Jan 13, 2014 at 8:14
  • \$\begingroup\$ I also have a very similar situation. I'm using Electret Mic with Max4466 amplifier. My mic's sensitivity is -44dB @1kHz but I don't know what the Op-Amp gain is. The amplified output is 1.5V to 3V where the supply voltage is 3V. According to the datasheet, the gain can be adjusted from 25x to 125x. \$\endgroup\$
    – J.Jay
    Commented Jan 15, 2016 at 9:10
4
\$\begingroup\$

Coming here many years later and I am still confused by the top answer, only because I am trying to solve this exact problem.

As stated in the top answer, voltage gain is calculated as 20*log10(V1/Vref) where V1 is the Vrms of the measured voltage and Vref is the microphone sensitivity. Then, the microphone sensitive in dB is subtracted off (-46dBV/Pa) before being added to dB SPL standard (94 dB SPL), but this doesn't quite make sense to me.

If you put a standardized tone generator outputting 94 dB SPL at 1 kHz, you would expect (and I have experimentally validated) to get exactly the value of the microphone sensitivity (in your case, 0.005012).

Plugging this into the top answers formula, you would get 20*log10(.005012/.005012) = 0 dB - 46 (db rel V/Pa; microphone sensitivity) + 94 db = 48 dB, when it should be 94 dB, because we are using a standardized tone generator.

I believe the correct conversion would just be 20*log10(V1/Vref) + 94 dB SPL, where V1 is the rms voltage of the signal and Vref is the microphone sensitivity.

\$\endgroup\$
1
  • \$\begingroup\$ +1, I think you are correct. Adding -46 dB is unnecessary, cz it is already accounted for while voltage gain is calculated. \$\endgroup\$
    – Mitu Raj
    Commented Dec 15, 2020 at 8:08
1
\$\begingroup\$

-46dB V/Pa is how I read it and 1 Pa is the sound pressure in newtons per sq metre. 0dB SPL is 20 micro Pascal therefore, 1 Pa is 50,000 times bigger or, in dB it is 94 dB SPL.

So, if you are measuring -46 dBV then you are measuring a SPL of 94 dB. -46 dBV is near enough 5 mV RMS so, again, if you measure 5mV RMS then the SPL is 94dB.

If you have a pre-amplifier with a gain of ten, then 50mV RMS equates to 94dB SPL and 5mV would equate to a SPL of 74 dB.

This should be enough to get you started.

\$\endgroup\$
2
  • \$\begingroup\$ So, how to convert the volts I'm getting in the RMS?? Just divide it by sqrt(2)? \$\endgroup\$
    – user35456
    Commented Jan 12, 2014 at 14:29
  • \$\begingroup\$ I think you need to explain what you are measuring from your ADC. If it were me I'd be sampling at 50kHz and calculating RMS by squaring each sample, averaging and then taking the sqrt of the average. I have no idea how your code works or what it does. \$\endgroup\$
    – Andy aka
    Commented Jan 12, 2014 at 15:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.