Shop OBEX P1 Docs P2 Docs Learn Events
Measuring deciBell with BS2pe ?? — Parallax Forums

Measuring deciBell with BS2pe ??

K de JongK de Jong Posts: 154
edited 2004-08-17 10:58 in BASIC Stamp
Hi all,

Has anyone of you experience in building an application to measure deciBells ??

This is as far as I got now:

I have a BS2pe + 12 bit ADC running.
I have a microphone + opamps and rectifier/capacitor for the electronic part of it.
I get a nice response on my display, when 'noise' goes up then my reading goes up as well.

That is very nice to start with but it's not deciBells yet :-).

One thing that puzzles me a bit is how to code the formula to calculate deciBells from the electric readings: 1 deciBell=20*log(U1/U2). Another thing is that I will have to physically switch the range of my opamps to get a usefull range that my instrument can display, maybe 40-130 dB.

Does anybody have experience in this field, or just a good idea. Any help will be appreciated.

Regards,

Klaus de Jong

Comments

  • cyberbiotacyberbiota Posts: 79
    edited 2004-08-16 21:36
    We run into this problem all of the time when measuring real-world phenomena- the dynamic range of the system outstrips the hardware/software.· We solve the theproblem with a programmable gain amplifier (PGA) under the control of the MCU.· As the amp begins to saturate, the MCU drops the gain.· A similar effect can be acheived using a "strap" gain PGA and a variable potentiometer.· All of these parts are available from DalSemi/Maxim, Analog Devices or Texas Instruments.· The tricky bitis getting the algorithm right...

    Good luck!



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dr. Peter C. Charles

    Director, Research and Technology
    CyberBiota, Incorporated
    Peter.charles@cyberbiota.com
    http://www.cyberbiota.com
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2004-08-17 06:22
    One option is to use a more accurate ADC, 16 or even 24 bits. Then you have more dynamic range to play with.

    Once the data is in the stamp, it is not too hard to calculate the logarithm (hehe!). It is easiest to do it in base 2 and then convert to base 10, per this URL (several methods for different accuracy requirements): owlogic.com/BS2math3.htm

    A range of 40db to 140 db a ratio of 10000:1.
    20db ==> V1/Vo = 100
    140db ==> V2/Vo = 10000000
    ==> V2/V1 = 10000

    For example, if V2 is 5 volts maximum, then the minimum V1 is 0.5 millivolt.
    That within the purvey of a 14 bit converter (16384 counts). And well withing the word size of the Stamp.

    Or with your 12 bit converter, a range switched x4 / x1 amplifier.

    I'm curious about your amplifier. Are you extracting the rms amplitude? Peak or average will be correllated to the average power, but that will depend on the waveform.

    Other approaches would use a logarithmic amplifier, like the AD8304 or the Burr Brown Log112 or the MAX4206. They are tricky, though. The MAX4206 covers about 5 orders of magnitude, which is close to your requirement, and the AD8304 ($$!) covers about 8 orders of magnitude.

    Another approach would be to buy a sound level meter that has a recorder output!

    -- Tracy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • K de JongK de Jong Posts: 154
    edited 2004-08-17 10:58
    Thank you, cyberbiota and Tracy.

    This info will help me one or more steps further!

    The whole thing started off with idea to build a simple 'noise indicater' for a small and low cost datalogger. But now I'm working on it I'm getting caught by the aim to build a full deciBell meter. I'm just fascinated by the techniques that go cross borders of Stamp, ADC, math, physics and mechanics smile.gif)))))).

    My amplifier is just an ordinary opamp with a low output impedance and an integrater with a fast charge and a slow discharge. So it's a kind of peak detection enabeling the Stamp to take a sample once a second.

    I will study the material you both presented to me and find the best way. The piece of math Tracy came up be will be very important for sure, the gain swithing/adapting and the logarithmic amplifiers will be inevitable as well.

    I think I will walk on two roads from now. Road one for full precision and road two for compact and low cost.

    Thank you both,

    Klaus

    PS is there somebody who can tell me a little more on A and C weighting of a deciBell meter?
Sign In or Register to comment.