Microphone to PIC


Closed Thread
Results 1 to 22 of 22
  1. #1
    Join Date
    Oct 2006
    Posts
    32

    Default Microphone to PIC

    I'm planning to build a bot with two microphones as ears. Basically, the robot will function like this: It has two microphones as ears, one for the left and one for the right. If it hears a sound (though not cognitively) from one of its ears, it would go in that direction.
    I've been considering that the two mic would compare with each other so as to move accordingly in the direction of the sound. I've searched through Google and most search results would tell me that I would need an ADC converter before I could connect it to the PIC. But as I've seen in this website: http://www.restena.lu/convict/Jeunes/PhaseSound.htm , the mics were connected to a comparator before they were connected to the PIC. Now I'm getting confused. I'm planning to make the program using PBP where the PIC would treat the mic input like a light sensor input. Is there anyway to clear this up. Any suggestions would greatly help. Thanks very much!

  2. #2
    Join Date
    Oct 2005
    Location
    Loveland CO USA
    Posts
    83


    Did you find this post helpful? Yes | No

    Default ears

    I am looking at http://www.restena.lu/convict/Jeunes/PhaseSound.htm .
    I see MIC, 2 amplifiers, a peak detector, amplifier and a comparator. R11 & R20 set the lever for the comparator. The audio is above or below the level. The input to the PIC is a 1 or 0.

    The PIC measures the delay from left to right. If the sound arrives at the same time then the sound came from directly in front or back. If the right ear hears the sound first then by and amount of delay the sound is to the right at some angle. Sound is 1100 feet/second. If the ears are 1 ft apart and the delay is 1mS then the sound is directly to the side. If the sound is 0.1mS delayed then the sound is only slightly to the side. Do the math.

    My first thought is to drop the comparator and run the output of the last amplifier into the ADC of the PIC. The compare function then is done in software. If ADC > 53 then ear=1 else ear=0. The compare value (53) can be automatically adjusted for week/strong signals. There is probably too much delay through the ADC.

    Next idea: Keep the comparators and replace R11 + R20 with a DAC. This way software chooses the compare level to match the sound level.

    In your case you want to compare the sound “level” to determine left/right. You will want the ears facing left and right not front like the first example. Because you are thinking level not delay, I would drop the hardware comparator. The PIC must have 2 or more analog inputs! You will compare ADC1 and ADC2 and head in the correct direction. You may have trouble knowing if the sound is in front or in back. Worst case you may have to rotate 360 degrees before you know which way to go. I think you will have to go zigzag, drive [walk] +10 degrees then –10 degrees. If the sound is behind not in front you will know! Zigzagging may give you more accurate information.

    You will find the audio level range is far greater then you think. (I have done this before.) In the first example the level is not very important, just the delay. The second example the level is all you have. A 8 bit ADC will gave you a maybe 100:1 range in level so about 10:1 range in distance. (10 feet to 1 foot) Not good. By changing the amplifier and adding AGC you could measure 1,000:1 or more. I think I have a PIC measuring audio levels to 10,000:1.

    Sounds fun…Good luck.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    There's still the option to use a PIC with 2 comparator and set their reference with resistors , trim pot OR HPWM. I like the HPWM stuff... full control of the beast... and when you want

    Now you just need an amplifier/Microphone and poll the comparator output to know what's happen.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Oct 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    There's still the option to use a PIC with 2 comparator and set their reference with resistors , trim pot OR HPWM. I like the HPWM stuff... full control of the beast... and when you want

    Now you just need an amplifier/Microphone and poll the comparator output to know what's happen.

    I don't quite get what polling the comparator means!
    Last edited by scaenix; - 18th February 2007 at 12:54.

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    to do simple... read the comparator output.

    Code:
    If Comparator1=1 then Goto GotSoundFromLeftEar
    If Comparator2=1 then Goto GotSoundFromRightEar
    where Comparator1 and Comparator2 represent dedicated I/Os OR internal register (like CMCON for a PIC16F628A and/or PIC16F88)
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Oct 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    ok got that! thanks very much!

  7. #7
    Join Date
    Oct 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    There's still the option to use a PIC with 2 comparator and set their reference with resistors , trim pot OR HPWM. I like the HPWM stuff... full control of the beast... and when you want

    Now you just need an amplifier/Microphone and poll the comparator output to know what's happen.

    Sir, if this method is to be done, how should I place the microphone? front or facing left and right as said in the previous post?

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    it will depend of what type of mic you are using. A good unidirectional is suggested but you can use an omnidirectional and hack it's pattern.

    with both, you need to place them in such way they will detect ONLY what you want to. Hence, face left, and face right.

    Maybe you could try midpoint between right and middle, midpoint between left and middle.

    With some experiment you should find the best match.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Oct 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default Sound sensor for PIC

    How about this link sir?

    http://www.extremenxt.com/sound.htm

    the creator of the project said that the circuit is a simple sound sensor but I can't quite figure out the purpose of the diode array with the label RCX. I tried to look for a way to contact the creator of the project but I didn't find any. I know that the circuit is made for RCX from Lego Mindstorms, but I just want to know how to use this sensor for a PIC, specifically 16F84A, so that I could make a PBP program for my project. Any help would be gladly appreciated. Thanks in advance.

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    the diode thingy is use to supply the OP-AMP AND also use to modulate the OP-AMP signal to the supply line. I don't know how the RCX handle it but to me , for your application it's way too complicated.


    Now if you want to use this grand'pa 16F84, you will need to boost the MIC signal. A single rail op-amp will do the job.

    Did you already know which mic model you will use?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    Oct 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Well, I'm hacking an old earphone to be used as mic, which, correct me if I'm wrong, makes it a unidirectional mic. I've tried the mic on an stereo amplifier and worked though. Sir, isn't the signal coming from the mic an analog signal? Please correct me again if I'm wrong.

  12. #12
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    well any speaker/earphone could be more directional. But their sensitivity are usually pretty bad too. Never tried with any earphone (walkman or else).

    What range of frequency you need to detect?

    One thing is sure, you'll have to use a high pass filter to avoid any type of interference caused by your robot motor/floor/gear noise.

    I really have to do something like that one day. As many other i've buyed the Robosapiens, dismantle it... and let him gathering dust

    And yes the mic signal is analog.

    PS: you don't need to call me sir. I'm not as old as Darrel Taylor is
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  13. #13
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hey, Hey now! I resemble that remark.

    As many other i've buyed the Robosapiens, dismantle it... and let him gathering dust.
    <table><tr><td align=center valign=top>What? Like this ...

    </td><td><br><br><br>

    Sitting on the shelf, next to my Teddy. </td></tr></table>
    DT

  14. #14
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    yeah! at least yours is in one piece

    Some part of mine have been a little bit chewed by my dog... he will really need an extreme makeover... well the Robosapiens
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  15. #15
    Join Date
    Oct 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    well any speaker/earphone could be more directional. But their sensitivity are usually pretty bad too. Never tried with any earphone (walkman or else).

    What range of frequency you need to detect?

    One thing is sure, you'll have to use a high pass filter to avoid any type of interference caused by your robot motor/floor/gear noise.

    I really have to do something like that one day. As many other i've buyed the Robosapiens, dismantle it... and let him gathering dust

    And yes the mic signal is analog.
    Apologies for calling you "sir"...

    Hmm... I guess I should by a mic though. I need to detect frequencies above 15KHz. I'm bit pressured now 'coz the project I'm making is due next friday and I'm still in the design stage. Actually, this project was just thought out last January after realizing that our previous project proposal for our class is not going to materialize.

  16. #16
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    above 15khz make sure of your mic spectrum specs before. forget the speaker.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  17. #17
    Join Date
    Oct 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    above 15khz make sure of your mic spectrum specs before. forget the speaker.
    i don't quite understand why i should "make sure of my mic spectrum before". before what? I'll use a tweeter instead of mic if i have to..

  18. #18
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    speaker/tweeter are good to reproduce sound, but i doubt of their reliability/efficiency as microphone. Worth a try for sure.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  19. #19
    Join Date
    Oct 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    what would likely be better to use for the circuit? condenser or dynamic? can you suggest any easy method of determining the leg configuration of a 3 wire condenser mic? Thanks in advance.

  20. #20
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    any model for this mic? is this a professionnal XLR connector or just a 3 wire capsule?

    Any picture or part # would be handy.

    Condenser or dynamic? Who knows, the best way will be to evaluate them with a pink noise and a spectrum analyser.

    Few days ago i found the following freeware for someone here. I've tried it, and i'm really impressed how good it is... for a freeware.
    http://www.sillanumsoft.com/
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  21. #21
    Join Date
    Oct 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    It's just a simple 3 wire capsule.

    I am feeding the mic into an amplifier which will turn the signal into pulses. I want to measure the pulse width and compare the widths of the two mic inputs. The problem is I do not know what commands to use in the PBP program. I've read the manual and PULSIN seems to be a good command. I reallt need some hints on this. Thanks again very much for helping me even until this far.

  22. #22
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    You could use Count as well. To me using the internal Timer/Counter have it's advantages.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  3. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  4. connect microphone to pic?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th January 2008, 08:33
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts