Shop OBEX P1 Docs P2 Docs Learn Events
Hallowe'en Quick and Dirty - Sensing audio input with BS2 — Parallax Forums

Hallowe'en Quick and Dirty - Sensing audio input with BS2

Harry StonerHarry Stoner Posts: 54
edited 2004-11-08 20:48 in BASIC Stamp
I am hoping to build a simple project for Hallowe'en using a BS2. I will use a motion detector to trigger a BS2 to flash some lights. I have that covered. What I also hoped to do (if it's easy enough - really time constrained here) would be to crudely sense speech or noise with a microphone (or even cruder, with headphones acting as a microphone!), and flash the lights in synch with that noise.

So someone shouts into the mic "Ha ha ha" in an evil voice and the lights pulse 3 times. That sort of thing.

I am clued out audio wise. Could I just hook up the microphone to an ADC0831 and detect voltage changes? I really only need to sense a couple of levels (e.g. silence or background noise versus someome speaking into the mic - don't care too much if it can detect volume levels accurately).

Is there anything simple I can do here?

Thanks.

Harry

Comments

  • DonivanDonivan Posts: 23
    edited 2004-10-29 19:02
    I have not tried this, but ran across it when doing some research for my own project. Sounds like (no pun intended) just what you're looking for:

    http://www.andrew.cmu.edu/user/fwinkler/SoundSens/

    Good Luck! Please let us know if it works...

    -Donivan
  • K de JongK de Jong Posts: 154
    edited 2004-10-29 19:25
    Hi Harry,

    Donivans circuit is a good point to start with. What you will need is voltage divider with microphone and a resistor of 5 to 20 kOhm at the input. Then a capacitor of 0.1 uF indeed to any rail to rail OpAmp which is configurated for about 10x amplification.

    At the output of the OpAmp I would suggest a diode into a capacitor of 10 uF with 10 kOhm in parallel to it. That way you have a simple rectifier and a buffer capacity to make reading by the Stamp more easy. (it takes samples every somany milli seconds)

    An ADC0831 analog input would be fine to read the signal to the Stamp.

    I tried a similar setup and it works, is reliable and fast enough for the purposes you intend. The only thing I found in my device was a strong response to very low frequency noise. If this is a problem to you you could try a capacitor of 0.01 uF at the input.

    Regards and succes,

    Klaus
  • Harry StonerHarry Stoner Posts: 54
    edited 2004-10-29 21:38
    Thanks for the links and suggestions. I may not have time to get this done but I have gathered enough info to give it a shot.

    Harry
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2004-10-30 21:14
    If it's not too late, one more suggestion might be...If you used a electret mic with an op-amp and power transistor you could make the light intensity vary with the amplitude of the sound.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • DonivanDonivan Posts: 23
    edited 2004-11-05 22:49
    I was wondering if there is a way to detect different frequencies - High, Med, Low - using this approach. Kind of like a home-made light organ...

    Thoughts?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-11-05 22:52
    Sure, use PULSIN to take a half-wave measurement and to the analysis from there.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2004-11-06 02:06
    An alternate method would be to use Op-Amps coming from the mike that have bandpass filters...Using multiple filters would give you a "Color Organ" platform.· Of course, Jon's idea will work more simply in terms of hardware.· I always think Analog when working with Audio myself...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • Harry StonerHarry Stoner Posts: 54
    edited 2004-11-08 20:48
    I just received a Jaycar catalog with latest issue of Nuts 'n Volts. FYI there are several kit boards that do these things - e.g. one that switches a relay on/off based on the presence/absence of sound, and others that vary light intensity with volume (or perhaps frequency also).

    I haven't had time to build anything myself yet (I am slow), but have acquired LM386 chips to build the test circuit that Donivan pointed to above.

    Thanks.

    Harry
Sign In or Register to comment.