Electronic – arduino – Sound pressure to db analog

arduinolog-amplifiermicrophoneoperational-amplifier

I'm trying to convert an amplified microphone output (it is from 0-5v, biased at 2.5v) to a linear response that correlates with db SPL.

From my research, the output of the microphone directly correlates to the sound pressure, which is all fine, but I need to represent this in db. I am reading values from the mic with an arduino, which only has 10 bits of precision, meaning I cannot rely on converting the values into db on digital side because of the huge dynamic range that db covers which would mean very little of the db range would be represented inside the 10 bits since db is logarithmic to sound pressure.

So, how would I go about modifying the analog signal so that the output represents db SPL? I have read about logarithmic op amps but still don't fully understand how they could be used in this situation, or if they are what I'm looking for.

Best Answer

Using a log amp is the correct approach. Feed the output of your microphone into the log-amp. Then feed the log amp into your ADC.

One example is the TL-441 from Texas Instruments, about $10 from Mouser.

http://www.ti.com/product/TL441

http://www.mouser.sg/ProductDetail/Texas-Instruments/TL441CN/?qs=sGAEpiMZZMtOXy69nW9rM3%252bknWDosfXEqY%2fig3aTweg%3d

If $10 is too much you can create a cheap log-amp from two diodes a resistor and an op-amp. Wire the diodes in parallel each facing opposite ways between the op-amp output and negative input pin. Wire the resistor between your input voltage and the negative input pin. Attach the op-amp non-inverting input to your center reference (2.5V in your case)

Remember that the current through an ideal diode is...

Id = Is * (e^(Vd/n/Vt) - 1)

Vd is the voltage across the diode
Vt is the thermal voltage (26mV at 25C)
n is the diode ideality factor, typically somewhere between 1 and 2.
e is 2.71828...
Is is the diode reverse saturation current.
Id is the current through the diode.

Solving for Vd gives...
Vd = n * Vt * ln(Id/Is + 1)

Because of feedback the inverting input of the op-amp is held at the same voltage as the non-inverting input, which is 2.5V. With R wired between the input signal and the op-amp inverting input we have...

Id = (Vin - 2.5V) / R then...

So...

Vd = n * Vt * ln((Vin-2.5V)/R/Is + 1)

So the output of the amplifier is...

For Vin > 2.5 V...
Vout = 2.5V - Vd = 2.5V - n * Vt * ln(|Vin-2.5V|/R/Is + 1)

For Vin < 2.5 V...
Vout = 2.5V + Vd = 2.5V + n * Vt * ln(|Vin-2.5V|/R/Is + 1)