Shop OBEX P1 Docs P2 Docs Learn Events
Is there a way to mount a Microphone or a Sound Sensor? — Parallax Forums

Is there a way to mount a Microphone or a Sound Sensor?

esjdesjd Posts: 2
edited 2009-06-07 18:04 in Accessories
Is there a way to mount a microphone straight onto the basic stamp (by cutting the microphone wire or such, because I think the microphone produce an electric current) ? If not, is there any sound sensor available? I really don't want one of those pre-built, speech recognizing fancy modules, just a simple device that can recognize sound. Thanks!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-03 22:36
    There's no way to mount a microphone directly to a Stamp. The amount of voltage produced by the microphone is too small for the Stamp to detect.

    Do you just want to detect sound above some specific level (like a hand clap detector)? There are all sorts of things like that on the internet.

    Here's one example: www.reconnsworld.com/audio_electretamp.html

    The output of this detector can be connected to a Stamp I/O pin and goes LOW when the sound is above the level set in the circuit. This can be powered by the Stamp's regulated 5V output if need be.
  • esjdesjd Posts: 2
    edited 2009-03-03 22:51
    Hmm interesting, thank you Mike! It would be great if it can detect sound in a more sensitive fashion - I really want it to be able to detect different pitches. If the voltage produced by the mic is too small, is there some kind of amplifier? (sorry I'm really new to the stamp) Or is there a way to build a micro controller that does that not necessarily using the Basic Stamp?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-03 23:07
    Detecting pitches, particularly when the sounds are not pure sinewaves, is not an easy task. The Propeller is fast enough to be able to process sound from a microphone and you could do digital filtering on the data or maybe a Fourier analysis to look for the dominant frequency involved. The Propeller Demo Board has a built-in microphone and there are several demo programs to process the sound from the microphone, one that displays the sound waveform on an attached VGA display. You would have to learn about sound processing, digital filtering and Fourier analysis from other sources, but the Propeller could handle it. As an example of what can be accomplished, there's a speech synthesis program that "sings". Take a look here: obex.parallax.com/objects/category/10/.
  • pdiefendpdiefend Posts: 27
    edited 2009-03-18 23:54
    What about using the microphone to detect music, such as having the propeller listen to the music, then pull a pin high if a specific frequency (or range of frequencys) is detected.· Basically using the propeller as a color or light organ.
  • beazleybubbeazleybub Posts: 102
    edited 2009-05-07 06:23
    Interesting, I too am looking for a way to trigger an event if either a bs2sx or a prop stick detects a specific sound frequency.
    Basically a crude DMX "like" controller that would listen to a CD or MP3 and when certain frequencies are heard it would interpret the sounds and execute code based on the frequency. The sounds would be above the range of the human ear and only heard by the controller.

    Could an analog to digital converter IC be used to accomplish this task?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    How can there be·nothing? Nothing is something!

    Post Edited (beazleybub) : 5/7/2009 7:01:55 AM GMT
  • LeonLeon Posts: 7,620
    edited 2009-05-07 12:45
    You need an ADC and FFT for that. You won't be able to do it on a BS2 but there is an FFT implementation for the Propeller:

    propeller.wikispaces.com/FFT

    The much simpler Goertzel algorithm would be more suitable if you know the frequencies in advance.

    Leon

    Post Edited By Moderator (Chris Savage (Parallax)) : 5/7/2009 9:33:56 PM GMT
  • beazleybubbeazleybub Posts: 102
    edited 2009-05-07 14:46
    I believe this can be done using a LM567 tone decoder or an equivalent. I'm still looking into it though. I believe the only drawback to this approach would be that you would be restricted to a single tone frequency. ( correct me if I am wrong ) You might also be able to use a NTE832 tone decoder.
    http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMvkC18yXH9iIvlH%252b7DLPI6OQmf4uQji4o8%3d

    I however need to be able to detect multiple frequency ranges to trigger different events.

    If I find anything else helpful I will get back to this post. In the meantime if anyone else has any suggestions I'm definitely all ears. scool.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    How can there be·nothing? Nothing is something!

    Post Edited (beazleybub) : 5/7/2009 2:56:21 PM GMT
  • LeonLeon Posts: 7,620
    edited 2009-05-07 15:23
    The LM567 will only detect a single frequency.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • beazleybubbeazleybub Posts: 102
    edited 2009-05-07 15:48
    Yes, this is true. I have contacted Maxim Integrated Products to see if they have any suggestions.

    As a last resort I could just use a·LM567 for each frequency. Unfortunately this approach robs the stamp of pins.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    How can there be·nothing? Nothing is something!
  • beazleybubbeazleybub Posts: 102
    edited 2009-05-09 08:04
    I propose to write a program for the BS2 that uses the LM567 to trigger different events.

    You would set up the LM567 to detect anywhere from 20,000 to 500,000Hz ( Anything above human hearing ) and write a program to listen for the LM567 to saturate when a chosen frequency is detected.

    Different events could be triggered because you would use the trigger frequency as a type of Morse code of sorts.

    For example, if you wanted a red led to flash·five times during a specific place in a song or soundtrack·you could embed the trigger frequency into your song or sound track consecutively five times·with a small pause between bursts. The LM567 would saturate five times and the stamp would count·and act accordingly.

    As for the reliability of the·LM567 being able to hear the trigger frequency accurately this will need to be field·tested.
    The LM567 does have a high rejection to out of band signals and noise·also Immunity to false signals.

    I will play around with this idea and post my findings here if anyone is interested.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    How can there be·nothing? Nothing is something!
  • PrettybirdPrettybird Posts: 269
    edited 2009-05-11 18:29
    A condensor mic needs power to operate. Just run it through a comparator and set at a low level. I have used it to make chase lights sequince to music using a 74hc4017 decade counter and a LM 311 comparator. The 311 is very usefull for low signals and can also interface higher voltages at 100ma. I will post some stamp applications in the future.
  • UghaUgha Posts: 543
    edited 2009-05-17 01:54
    Beazleybub:
    I know next to nothing about sound frequency detection and have never heard of the LM567 before you mentioned it but...
    A glance at the datasheet shows that it can be set using an external resistor. Couldn't you use a digital pot to readjust the LM567 several times a second and
    "sweep" a wide range of different freqs?

    To test this you could use a CDS cell and an LED taped together. PWM the LED until the CDS gives the required resistance and see if it works. Make sure you
    figure in the timing of the PWM to include checking the LM567.

    If I'm wrong about any of this, please feel free to slap me upside the head and tell me to shut up about stuff I know nothing about.
  • beazleybubbeazleybub Posts: 102
    edited 2009-05-17 04:37
    Ugha,

    Clearly you have mistaken me for something I am not! [noparse]:)[/noparse]
    I am a novice and have never been to any kind of electronics school.

    Everything I have learned has come from Parallax and it's community.
    ( PJ Allen, Chris Savage and Mike Green have been most helpful to me in the past )

    I bought a tone decoder kit from NightFire [url=mhtml:{C8ED4378-0039-4945-8953-B91B359FDD2A}mid://00000002/!x-usc:http://www.vakits.com/product_info.php?products_id=804]http://www.vakits.com/product_info.php?products_id=804[/url] and expect it in the next few days.

    The only thing that troubles me on this project is what Mike Green pointed out.
    Mike Green said...
    Detecting pitches, particularly when the sounds are not pure sinewaves, is not an easy task.
    If I were only using the LM567 to listen for specific frequencies in an audio track with no other audio signals in the track I believe it would possibly work ok. But I had planned on placing the trigger signals into a mixed audio track and this may cause the trigger signals to be drowned out completely.

    I see in the LM567 Datasheet that the LM567 does have a high rejection to out of band signals and noise also Immunity to false signals but am a bit concerned about how I am applying the LM567. I am sure it was never designed to listen to so much audio garbage at once.

    I like your good idea but no matter what the trigger frequency is the LM567 will respond by saturating a transistor switch to ground thus giving the stamp a zero or a one so it would not matter if·I were using different frequencies the end result would be the same.

    Maybe·I could write the program to check what the digital pot was set at during the sweep and if the LM567 grounds the transistor switch during a specific resistance then execute whatever code was associated with that specific frequency.

    I believe·if the trigger frequencies are too close together the bs2's inability to do more than one thing at one time·would result in·the stamp essentially ignoring the second frequency. ( This might be better suited for a Propeller )

    Anyhow, I will still attempt this project with the expectation that it will most likely fail though I am hopeful.
    And if all fails I will have still learned something useful through the process.

    Even Edison and Swan worked for years to develop the light bulb! ( That's probably going to light someone's fuse. )

    Your input·was very appreciated and your suggestion is most certainly interesting!

    Beazleybub

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    How can there be·nothing? Nothing is something!

    Post Edited (beazleybub) : 5/17/2009 6:49:49 AM GMT
  • UghaUgha Posts: 543
    edited 2009-05-18 15:36
    beazleybub:
    I'm the same way, I don't even have a highschool education, completely self-taught with the assistance of the wonderful people here on the Parallax forums.

    By using the digital pot to "sweep" I simply meant adjust the pot to X resistance, causing the LM567 to check for frequency Y. Wait a half-second, then adjust the
    pot to Y resistance and check the LM567 for the next frenquency in the list.

    There is, indeed, a chance of missing the desired frenquency if its duration is extremely short (less than a second) but otherwise, this should work.

    Again, this is all just guesswork by a total newbie who has neither a digital pot nor a LM567.

    Please keep us informed about your testing. I would love it if testing for tones is as easy (and cheap!) as a LM567 and a digital pot.
  • beazleybubbeazleybub Posts: 102
    edited 2009-06-07 05:54
    I've done some experimenting and so far it's not good.

    I have built two separate circuits that I found on the web and both gave me similar results.

    [url=mhtml:{C8ED4378-0039-4945-8953-B91B359FDD2A}mid://00000003/!x-usc:http://www.scary-terry.com/more_stuff/tonedet/tonedet.htm]http://www.scary-terry.com/more_stuff/tonedet/tonedet.htm[/url]

    http://www.io.com/~n5fc/zerobeat.htm

    The lm567 will not work well for this particullar application because the amplitude of the input signal affects the bandwidth·and affects·reliability.
    The LED in both of the circuits above·remained "on"·and varied in brightness when the volume was turned up or down.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    How can there be·nothing? Nothing is something!

    Post Edited (beazleybub) : 6/7/2009 6:18:50 AM GMT
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-06-07 18:04
    The classic "color organ" uses inductors and capacitors to make lowpass, bandpass and highpass filters to separate the sound into bands that then turn on colored lights. Maybe that is something the OP was looking for.

    To detect a high frequency subcarrier, an active or passive filter could reduce the interference from the normal audio.

    For the tone detector, I prefer the LMC567, the cmos version of the LM567. I've had good luck with it as an ultrasound detector, in a circuit with a piezo followed by lots of amplification and then the LMC567. It does take some experimentation. The lock indicator LED should stay on continuously when the input frequency matches the reference and is above threshold. If the sound is clean and well above threshold, the output frequency locks to the input.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.