Microphone to PIC


Closed Thread
Results 1 to 22 of 22

Hybrid View

  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.

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