Shop OBEX P1 Docs P2 Docs Learn Events
IR help — Parallax Forums

IR help

Kd7laxKd7lax Posts: 42
edited 2006-05-20 20:38 in Robotics
Hi guys..
I am totally new to robots so forgive my noobish ways.

I put a ir emitter and a ir dectector on my robot ... I hooked the emitters + side to hot (6v) and the - side to a 220ohm resistor and then hooked the resistor to pin# 0 .. For the detector I hooked up ( facing towards me) the left side to a 220ohm resistor and then the resistor to pin #5 the middle to ground and the right to hot.

I used the fallowing code to test it
' -----[noparse][[/noparse] Title ]----------------------------------------------------------------
' Mini Sumo 4.1 : IR Sensor Test
' {$STAMP BS2}

' -----[noparse][[/noparse] I/O Definitions ]------------------------------------------------------

LfIrOut         CON     0                       ' left IR LED output
LfIrIn          VAR     IN5                   ' left IR sensor input

' -----[noparse][[/noparse] Variables ]------------------------------------------------------------

irBits          VAR     Nib                     ' storage for IR target data
irLeft          VAR     irBits.BIT1

' -----[noparse][[/noparse] Main Code ]------------------------------------------------------------

Read_Left:
  FREQOUT LfIrOut, 1, 38500                     ' modulate IR LED
  irLeft = ~LfIrIn                              ' read input (1 = target)


Display:
  DEBUG HOME
  DEBUG "L", CR
  DEBUG "--",CR
  DEBUG BIN1 irLeft

  PAUSE 20
  GOTO Read_Left



Have I done any thing wrong? because it is not working... I get nothing on the debug screen.

Let me know if I hooked something up wrong or if my code is bogus.
thanks guys!
-Mike

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit my website @ www.kd7lax.com- Devoted to ham radio

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-19 14:20
    There is a complete wiring diagram and schematic right in the Robotics with the BOE-Bot manual...Note that you are supposed to be using 1K resistors, not 220 with the IR LEDs.· Also, each LED has an Anode (positive) and Cathode (negative) side...Do you have these in properly?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Kd7laxKd7lax Posts: 42
    edited 2006-05-19 18:41
    Yes I have the polarity of the led right...
    Do you think I burnt it out by not using a 1k ? I thought the sumobot manual said 220?

    thanks
    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit my website @ www.kd7lax.com- Devoted to ham radio
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-19 19:36
    Mike,

    ·· Sumobot?· Ah, now in looking closer at your code I see(you didn't specify in your text)...I thought you had a BOE-Bot.· The Sumobot LED connects directly without the resistor, since it is built into the board.· And it is designed to work with the 220 ohm that is there.· The detector is also designed to just plug in.· How are you connecting these?


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Kd7laxKd7lax Posts: 42
    edited 2006-05-20 20:38
    Hey,
    Well actually I am building my robot from scratch [noparse]:)[/noparse] (sorry I did not mention this) but it is a sumo bot ... and I am using alot of the same parts as your sumo bot.. the only difference is I am building my own PCB and frame.

    I got the IR sensor to work after installing a 1k resistor ... I didn't have a solid connection to my I/O pin before.. I think that was the cause of my problems.

    Right now I have my robots frame done and I am building the whole circuit on a breadboard so I can get a feel for how my PCB is going to be designed. I am using a BS2 OEM chip for this.

    Thanks for your help! I am sure I will have more questions as soon as get the QTI sensors on [noparse]:)[/noparse]

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit my website @ www.kd7lax.com- Devoted to ham radio
Sign In or Register to comment.