IR for robot on 16F877A


Closed Thread
Results 1 to 15 of 15
  1. #1
    Samuel's Avatar
    Samuel Guest

    Default IR for robot on 16F877A

    My robot is travelling along a narrow coridoor. At the point where it has to turn into a room, i want to have an IR transmission @38KHz. I got the IS1U60 IR reciever (by Sharp?) that detects IR only @ this frequency. I'm planning to mount the reciever on the side of my robot.

    My detector output will remain High and when it detects the IR @ 38KHz, it will go Low. So basically my robot will be going forward, and as soon as the detector goes low, the robot has to make the turn.

    I have two methods in mind and not sure which would be work best.

    1. Connect the detector output to portb (pins 4-7) and Use an interrupt (portb<4:7> change). So the 'forward routine' of the robot is interrupted and made to go into a 'turn routine'.

    (Also note portb0,1,2,3 are connected to my hbridge for my motors and i'm also using a bumper switch (interrupt) on portb.5. This setup works perfectly so far.)


    -OR-

    2. During my 'forward routine, just use an IF loop to keep checking if my detector is high or low?

    In the second case do i HAVE to use ADCON? and if i DO use ADCON, will I HAVE to connect my detector to port RA or RE? Or can i still use port RB? (VCC for my detector and PIC is 5V)


    Thanks,
    Samuel
    Last edited by Samuel; - 31st March 2005 at 21:42.

  2. #2
    AllanL5's Avatar
    AllanL5 Guest


    Did you find this post helpful? Yes | No

    Default

    Personally, I'd use the 'IF' loop.

  3. #3
    Join Date
    Feb 2005
    Location
    Revelstoke BC Canada
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    I agree with Allan, Use the if/then statement.
    You can connect the output of your IR receiver to the RB pin, just be sure to set which ever pin you use as an input.
    Are you going to put the IR emitter inside the room you want the robot to turn into?

    Dave

  4. #4
    thelightbrain's Avatar
    thelightbrain Guest


    Did you find this post helpful? Yes | No

    Default

    Be aware that those IR receivers are designed for modulated data (usually Manchester or some other type of async encoding) and they will reject continuous carrier signals. If you just send a continuous 38Khz IR signal, it will briefly go low, then it will go high again. Check the data sheet for acceptable burst lengths and data rates. Usually each burst of 38KHz will have to be followed by a corresponding "space" to allow the AGC circuit to recover.

  5. #5
    Samuel's Avatar
    Samuel Guest


    Did you find this post helpful? Yes | No

    Default Is1u60

    oh no ... i was just planing on a simple 38KHz modulation .. im really running out of time. Can someone else pls give me some insight on that? my retector is the sharp IS1U60 and im planning on bulding an IR transmietter at 38KHz using a 555 timer.

  6. #6
    Join Date
    Jan 2005
    Location
    Greece
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    You could use a 556 and use the second timer to modulate the first
    LSB

  7. #7
    Join Date
    Feb 2005
    Location
    Revelstoke BC Canada
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Why don't you mount the emitter and receiver to your robot? that way you could use the PWM output of your Pic to pulse the IR emitter at 38khz and connect the output of the detector to any available (digital) input pin, then use an If/Then statment to poll the detector pin, in this case the pin would be low as long as there was a wall, and go high when it came to an opening. If there are other openings before the one you want to go into, you could have the pin increment a counter each time it went high, and when it got to the one you wanted, it would jump to a turn subroutine.

    Dave

  8. #8
    Samuel's Avatar
    Samuel Guest


    Did you find this post helpful? Yes | No

    Default well said ..

    wow DWV actually can see exactly what im trying to do. i did think of ure idea DWV and other ppl have siad the same thing. i'm attaching a picture here to say y i cant do that. (i have no walls in my design) And i dunt think i can put the time i have left into making walls .. Also i'm using the only two pwm's on my 16F877A for my motors.

    secondly, i thought the detection would be much more efficient if the transmitter was pointed at the detected instead bouncing of a wall? In the sense that outside interference etc wont affect as much.. someone correct me if im wrong. This is why i thought it was better to have the transmitter as a separate unit.

    Also ive heard is setup where IR is used as the path .. so there is a whole stream of IR transmitters say for example along the cieling of a coridoor or on the floor, and the robot basically keeps tracking these emitters .. so im tring to incorporate that style .. of having one detector on the robot and having multiple transmitters external to the robot.

    my concern now is when someone said the detector wont stay low the whole time its detecting an IR .. that it would stay low and come back high. i want it to stay long as long as an IR is hitting it .. or do i?

    I want to place two detectors on the robot .. one on the right , one on the left. The transmitters will be placed at each turning point of the robots path. (see my attachment) I want the robot to come out of a "forward routine" and jump to a "turn routine" as soon it detects an IR. And yes i can use counters if i need it to make the second turn and so forth. Another concern is I'm gonn have to place the transmitters in such a way that they dunt interfere with each other. So that the robot does not detect the wrong trasnmitter.

    Pls give my any input and experience you have with such setups. I have jsut 3 more days to complete this setup before final demo!!!! arggh ..

    Thanks so much everyone who is responding to this thread!
    Samuel
    Attached Images Attached Images  
    Last edited by Samuel; - 6th April 2005 at 17:34.

  9. #9
    Join Date
    Feb 2005
    Location
    Revelstoke BC Canada
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    I see what you are trying to do now, Have you checked out Rentron's site?
    I think Bruce just might have what you need.

    http://www.rentron.com/Micro-Bot/IR_Nav.htm

    Be sure to read the Hardware.inc file, it has some nice subroutines for sampling the detector for short periods of time. I'm working on modifying them to use with one of my robots.

    Dave

  10. #10
    Samuel's Avatar
    Samuel Guest


    Did you find this post helpful? Yes | No

    Default Excellent resource!

    Thanks dave for guiding me to some very good resource. And thanks to Bruce for that amazing info on IR navigation!!

    I am attaching a schematic for modulating my IR's @ 38KHz. I'm not sure what transistors this schematic is using tho. Can someone pls help.

    The reason I like this schematic is cuz you can drive 4 IR's .. So I can place them at 4 different points as opposed to building a separate circuit for each IR transmitter.

    I really hope this circuit works. If not I have a coupla others but I cant waste time trying all of them ...

    Pls tell me what transistors theyre using in thie schematic to drive the IR's.

    Cheers,
    Samuel
    Attached Images Attached Images  

  11. #11
    Join Date
    Oct 2004
    Location
    Porto - Portugal
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Hi!

    You can use something like BC546 or similar, here in Europe they are easy to find, if you live across the Atlantic just go to one of those companys who sell trough the net (Farnell, RS, etc) and try to find on their list something alike

    Best wishes to your project
    nomada

  12. #12
    Join Date
    Feb 2005
    Location
    Revelstoke BC Canada
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    You could use pretty much any NPN transistor 2N3904 or 2N2222 should work fine.

    Dave

  13. #13
    Samuel's Avatar
    Samuel Guest


    Did you find this post helpful? Yes | No

    Default multiple IR's

    thanks a lot DWV! I thought a 2N2222 would work but wasnt sure. I tried and now and it works! Also, I was concerned that the detector, when it sees the IR would stay low only momentarily and go back high but its not the case. It stays low as long as it sees the 38KHz IR!!!

    Now i'm trying to add more than one IR to the same circuit. I think at the output of the timer, if i use two 2N2222 with two IR on each it should work according to the schematic i posted above. The other thing is dunt know if the 555 timer on the schematic above is regular or CMOS. So far i only tried the CMOS 7555 with one 2N222 and one IR.

    I'm still contemplating if i should use "for loop" or "interrupts" to make the robot go to a turn or pause subroutine as soon as the detecto goes low etc.

    I think two ppl have posted to use IF loops. Anymore suggestions/experience?

    Thanks so much everyone,
    Samuel

  14. #14
    Join Date
    Feb 2005
    Location
    Revelstoke BC Canada
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Your welcome Samuel, the timer is probably a standard NE555, but if the one your using works, go for it!
    The 2n2222 is rated for up to 500ma, so you should have no problem running 4 or 5 LEDs on each one. In theory, even if you run your LEDs at thier maximum rating of 50ma, you should be able to connect 10 of them to each transistor, allthough I imagine the transistor would run pretty hot!
    Generally each LED would only be drawing around 20ma and the 2n2222 will have no problem handling 100ma.
    I would still use the If/Then loop to poll the detectors every once in a while, and save the interrupts for more important things.

    Dave

  15. #15
    Samuel's Avatar
    Samuel Guest


    Did you find this post helpful? Yes | No

    Default Using IR to make the robot turn.

    Thanks again Dave. I have implmented the transmitters and detectors. I have two detectors one on portd.0 and other on portd.1. (Basically for left and right turns). I have two visible leds on porte.0 and porte.1. I'm trying to get away with using just one detector to make both turns. Lets see how it works ...

    I had to use straws wrapped with black tape on the detector to narrow the detection zone from around 30 degrees to 10 degrees. When IR is detected the detector output goes low and the respective visible leds on portE light up!

    So basically polling my IR detector using "if loops" work well and I'm using my portb interrupts for bumper switches etc.

    I also have added 4 IR LEDS to my 2N2222. All of them work perfectly. I now have to place them appropriately.

    I used my sony digital still camera to see my IR's light and took some pics!! Looks cool! Its a pink color!

    I have one more day to get everything going. I also have to add an LCD and a 5x7 dot matric led!!! Its all in my head .. got all the ports and schematics figured out .. but u know the errors that are gonna popup as i actually put them together. Seems like i'm using around 30 of my 34 ports on my 16F877A!!

    Thanks again
    Samuel

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. Plz help in completing RC-5 IR remote lamp dimmer project
    By vu2iia in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd April 2008, 08:44
  3. PIC10F200 Automated IR Light Switch
    By Bruce in forum Code Examples
    Replies: 7
    Last Post: - 3rd May 2007, 11:40
  4. Clock connection to DS1802 from 16F877A
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd January 2006, 18:52
  5. how to get pic to pic communication
    By kinsiro in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th August 2005, 17:12

Members who have read this thread : 1

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