Using AD8307 Log Amplifier for Sound Level Meter

Hello All, I would like to try to keep a log of sound levels in indoor home environments. I would probably want to store / transmit about 10 - 20 measures a second for hours at a time. I would like to be able to report the levels with some certainty that I am plus / minus 5 dB SPL.

I can (for now) get my hands on a very pricey high precision sound level meter for calibration. I just can't leave it sitting around in peoples houses for weeks at a time. I prefer to use RMS for averaging but would consider peak finding if someone convinced me it could be accurate. I want to use relatively cheap components and would love to have a full logging system for about $25.

I have some experience messing around with arduino, but not much about sound amplification. Last night I finally realized I would want a very large dynamic range from at least 20dB to 100dB SPL. I then thought about arduino's 10 bit ADC. So a maximum of what? about 60 dB of range? So by googling around I saw that there was such a thing as a log amplifier and then by checking ebay listings, I found the AD8307.

I read through the data sheet, but I can't seem to make out some very important considerations. It says it is demodulating - what exactly is that referring to? Is it rectifying? Should I just expect to do all the processing enveloping / RMS digitally with the microcontroller after is has gone through the A/D? Can I expect a relatively inexpensive mic and amp to get enough benefit from this. Lets say the noise floor is at some voltage that would correspond to 10dB SPL at the mic how to I make sure the transform only starts at some voltage corresponding to 20 dB SPL mic input instead of at 0 nano volts? It worries me that it is mostly used for RF in the MHZ. I hear it can handle down to DC will it be ok with audio frequencies 20 - 20K Hz? What are the negative and positive inputs for? Do I do half wave rectification on the input and then send it in to the pins? I thought "getting" the idea of how a series of limiting amplifications can lead to estimating a log transform would mean I could figure out how to make practical use of this IC. Definitely wrong.

Sorry for the eruption of questions. Feel free to answer as much as little as you would like. Thanks for your time.

This has been discussed and done (with varying degrees of success) before, so you might want to search the forum.

I prefer to use RMS for averaging but would consider peak finding if someone convinced me it could be accurate.

Real SPL meters are [u]weighted[/u] and averaged (and sometimes professionally calibrated) and it's difficult to build something homemade that's as accurate as a real SPL meter.

Last night I finally realized I would want a very large dynamic range from at least 20dB to 100dB SPL. I then thought about arduino's 10 bit ADC. So a maximum of what? about 60 dB of range? So by googling around I saw that there was such a thing as a log amplifier

First, I doubt that you need to read 20dB SPL.

Another way to handle wide dynamic range is to use multiple ranges. i.e. My old Radio Shack SPL meter looks identical to [u]this[/u]... You rotate the knob to set the range. With the Arduino, you can vary the ADC reference* or you can use a variable gain amplifier, or two or more amplifiers into two or more ADC inputs.

I found the AD8307.

I read through the data sheet, but I can't seem to make out some very important considerations. It says it is demodulating - what exactly is that referring to? Is it rectifying?

I can't help you with that chip.

Should I just expect to do all the processing enveloping / RMS digitally with the microcontroller after is has gone through the A/D?

I assume SPL meters normally do some filtering/averaging in hardware, and maybe there's some additional digital processing.

Can I expect a relatively inexpensive mic and amp to get enough benefit from this. Lets say the noise floor is at some voltage that would correspond to 10dB SPL at the mic how to I make sure the transform only starts at some voltage corresponding to 20 dB SPL mic input instead of at 0 nano volts?

Zero volts is always minus infinity dB. You just need to find a calibration point/reference and calculate up & down from there.

It worries me that it is mostly used for RF in the MHZ. I hear it can handle down to DC will it be ok with audio frequencies 20 - 20K Hz?

You'll have to check the specs, but I assume the chip goes down to DC.

What are the negative and positive inputs for?

I assume it's a differential input. Normal op-amps are differential, and you can build a non-inverting amp, an inverting, amp, or a differential amp.

Do I do half wave rectification on the input and then send it in to the pins?

You can do that. But, you'll need to make a precision rectifier with an op-amp because a regular silicon diode has a 0.7V drop and you don't get anything through it 'till you overcome the drop. And, if you go half-wave, make sure to take into account that signal is zero half the time when you calculate your average/RMS.

The "standard" way of handling audio/AC input is to [u]bias[/u] the input. (You can subtract-out the bias in software.)

  • With my lighting effects (including my "giant VU meter" effect) I switch between the 5V and 1.1V references as necessary. But, you can't do that if you've biased the ADC at 2.5V (to handle the negative half of the waveform). I use a half-wave peak detector circuit which is good enough for my application.

Hello DVDoug, thanks for taking the time to send a reply.

This has been discussed and done (with varying degrees of success) before, so you might want to search the forum.

Yep, I gave it quite a few looks. The most common suggestion was to use an AD8307. Since most of my questions were about not fully understanding the data sheets for that, I thought the post was necessary.

Real SPL meters are weighted and averaged (and sometimes professionally calibrated) and it's difficult to build something homemade that's as accurate as a real SPL meter.

Yep as I said in the post I have access to a few of those guys. I also mentioned right at the get go I'm only trying to get within 5 dB of the true level. I might actually have to measure down to 20 dB because one of the uses was to get logging from within a double walled sound isolating booth.

The "standard" way of handling audio/AC input is to bias the input. (You can subtract-out the bias in software.)

Thanks this was a very helpful suggestion. I hadn't thought of that.

Most of my questions were about that specific chip and decoding it's data sheet. If you still had more time to blow on me maybe you could tell me a little more about differential amplifiers / inverting / non-inverting is it all just about flipping phase? Is the differential about canceling noise with balanced lines? I do know what that is, but just don't know all the magic op-amps can do.

I have a lot to say on this subject, but don't have a moment right now. Feel free to PM me to remind me to follow up on this.

The AD8307 puts out a voltage that is proportional to the log of the input power. So with a 92dB dynamic range, let's say you use 90dB of that for simplicity's sake.

It is rated at 25mV per dB. So 90x25mV = 2.25V

But you won't use that. That would be 20dBspl to 100dBspl, hardly likely you'll need that much.

From Figure 11 on the datasheet, -65dBm to 15dBm gives you the widest dynamic range. About at 0dBm at 2V, ranges from about 0.3V to about 2.4V.

http://www.analog.com/media/en/technical-documentation/data-sheets/AD8307.pdf

Say you have designed the filters and proper amplification so that 20dBspl supplies -65dBm to the AD8307. From there, -65dBm to 15dBm is 80dB range, so 100dBspl at 15dBm input to the AD8307. 25mV x 80 = 2V range.

5dB corresponds to 25x5 = 125mV. With the Arduino's 10 bit ADC, which is really about 8.5 ENOB (effective number of bits), at 5V reference that is about 5mV per step or really about 19.5mV per step after noise, jitter, errors, etc are taken into account. Or roughly 1dB per bit.

Seems do-able.

I strongly suggest using a separate voltage regulator to power this. I'd also add 0.1uF bypass capacitors to the Arduino AVcc (analog Vcc) pin and the Vref pin.

There is also the AD8362 which is an RMS responding detector, the dynamic range is "only" 65dB. But that still takes you from 20dBspl (a really quiet recording studio) to 85dB (a rather loud street with traffic).

http://www.analog.com/en/products/rf-microwave/rf-power-detectors/rms-responding-detector/ad8362.html#product-overview

Like I said, I can't help you with that chip but I did scan the datasheet and I found:

The AD8307 has very high gain and a bandwidth from dc to over 1 GHz...

So, it will work at audio frequencies.

If you still had more time to blow on me maybe you could tell me a little more about differential amplifiers / inverting / non-inverting is it all just about flipping phase? Is the differential about canceling noise with balanced lines?

You probably don't have to build a differential amplifier but if you do, you can simply ground the negative input and you're amplifying the "difference" between the positive (non-inverting) input and ground.

With pro audio audio preamps, a balanced line is used to reduce noise pickup in the wiring (common mode noise is canceled). The microphone has a 3-wire connection, with the two (out-of-phase) signal lines connected to the differential amp inputs and a separate ground/shield.

In certain other circuits (maybe a strain gauge bridge) the signal-source is differential and a differential amplifier is used to "match" the source.

Operational amplifiers are by-definition differential and you can build a differential amplifier with an op-amp, but in fact most actual amplifier circuits are either inverting or non-inverting.