Easiest way to detect sound

Discussion in 'General Electronics Chat' started by stoopkid, Oct 31, 2011.

  1. stoopkid

    Thread Starter Member

    Mar 3, 2011
    136
    1
    I'm working on an LED thing for a music project. I want to be able to detect sound so that it can dim down after music stops and come back up when it starts again. The only thing is that the music will likely be very loud and "no music" will still likely be at least a bit noisy.

    It doesn't need to be super accurate or quick, but it just needs to still be useful for detecting loud vs louder. I will be measuring with arduino, so it could be calibrated. But it still needs to not have an upper limit of just "fairly loud." Could this be done with a piezo buzzer?

    Thanks
     
  2. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    I think you are asking about an input device that will be used with mcu's ADC input...if yes then a condenser microphone will do it...

    Good luck
     
  3. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    A piezo buzzer is not a condenser microphone. In particular, the buzzer will have a narrow frequency response and may not be a good choice for this. The condenser microphone would have a much wider frequency response, but if using one you would have to supply it with some bias, typically via a 1kΩ resistor returned to a few volts supply.

    Edit: Depending on the output of whatever transducer you finally pick and the sensitivity of your Arduino input, you are likely to need some sort of amplifier between the two.
     
  4. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    A piezo "buzzer" has a built-in oscillator so it continuously beeps when powered.
    You want a piezo transducer that can be a high frequency microphone or speaker.
     
  5. lowprofile

    Member

    Oct 31, 2011
    33
    2
    I think that what you want to do can be accomplished with op-amps.

    A microphone circuit will output a voltage that will be compared against an adjustable threshold (so you can set its sensitivity). The op-amp can be used such that the output turns ON or OFF when there is sound, whichever you prefer, for driving further circuitry.

    Here is a video that is very related. He has schematics in the video.
    http://www.youtube.com/watch?v=TQB1VlLBgJE

    There is also another video by the same youtube user that describes a simple addition to the sound detector circuit: a peak detector. This might be another option, depending on the exact behavior you are looking for.

    These circuits are very simple and might take some of the work off the shoulders of your arduino. Or maybe it's not a concern.
     
  6. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    Afroman used a real electret microphone, not an awful piezo whistle.
    But he used a horrible and old LM324 opamp instead of a much better one.
     
  7. hert

    New Member

    Oct 24, 2011
    3
    0
    you can use condenser mic with simple common base amplifier set up
     
  8. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    No and no.
    Use an electret mic, not a condenser mic.
    Use a low noise opamp not a transistor.
    Don't use a common base amplifier because its input impedance is too low.

    The electret mic needs a preamp with a fairly high input impedance to avoid being loaded down so a common base amplifier with its very low input impedance cannot be used (it is used for a low impedance dynamic mic or a speaker used as a mic).
    The opamp preamp should have a fairly high input impedance of 30k to 100k ohms which is easy if it is non-inverting.
     
  9. colinb

    Active Member

    Jun 15, 2011
    351
    35
    Is it harder achieve 30k to 100k ohms input impedance for an inverting op-amp circuit than for a non-inverting op-amp circuit? Why is this so?
     
  10. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    Most preamps for an electret mic have a voltage gain of 200. Then for an inverting opamp with a 100k input resistor the feedback resistor must be 20M ohms which is very high.
    A non-inverting opamp can have a 1k resistor to ground and a 200k feedback resistor.
     
  11. colinb

    Active Member

    Jun 15, 2011
    351
    35
    Why couldn't you use an inverting op-amp configuration with, for instance, Rin=1k and Rfb=200k?
     
  12. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    Because the 1k ohms input resistance will attenuate the output of an electret mic that has an impedance of 3k ohms.
    You don't want to attenuate the mic, you want to amplify it.
     
  13. colinb

    Active Member

    Jun 15, 2011
    351
    35
    But that 1k is in addition to the op-amp's input impedance of several hundred kohms to several megohms.
     
  14. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    No.
    Due to the extremely high open-loop voltage gain of an opamp and due to a lot of negative feedback, the (-) input of an inverting opamp is ZERO ohms.

    Look in Google at how an opamp works. Here is what I found:
     
    colinb likes this.
  15. colinb

    Active Member

    Jun 15, 2011
    351
    35
    Wow, that is an important distinction that I have not realized before. Is this mentioned in the AAC op amp chapter??

    Thanks for the explanation.
     
  16. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    No. It does not talk about inverting and non-inverting opamps.
     
  17. colinb

    Active Member

    Jun 15, 2011
    351
    35
    What? Op amps are not inherently “inverting” or “non-inverting” amplifiers: that is a property of the circuit in which the op amp is placed.

    From AAC Op-amp Divided feedback:

    • A negative-feedback op-amp circuit with the input signal going to the noninverting (+) input is called a noninverting amplifier. The output voltage will be the same polarity as the input. Voltage gain is given by the following equation: AV = (R2/R1) + 1
    • A negative-feedback op-amp circuit with the input signal going to the "bottom" of the resistive voltage divider, with the noninverting (+) input grounded, is called an inverting amplifier. Its output voltage will be the opposite polarity of the input. Voltage gain is given by the following equation: AV = -R2/R1
    Please correct me if I'm wrong.
     
    Last edited: Nov 2, 2011
  18. colinb

    Active Member

    Jun 15, 2011
    351
    35
    Also, here are schematics from the same AAC op-amp “divided feedback page” showing both inverting and noninverting amplifier circuits:

    Noninverting amplifier:
    [​IMG]

    Inverting amplifier:
    [​IMG]
     
  19. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    The AAC op amp chapter does not say that the inverting opamp has a completely different input resistance than a non-inverting opamp.
     
  20. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Did you mean to state that in the inverting opamp circuit in question, the (-) input of inverting opamp in your above statement was ZERO volts rather than ZERO ohms?

    In the presense of negative feedback, the output impedance of the opamp is very nearly ZERO ohms.

    hgmjr
     
Loading...