Shop OBEX P1 Docs P2 Docs Learn Events
Need Help with IR sensors — Parallax Forums

Need Help with IR sensors

marrienmarrien Posts: 3
edited 2011-04-10 19:35 in General Discussion
Attached the IR sensors to BOE BOT. Wrote the following program to test. Once the sensors detect an object, the 2 irDetect values remain at 0 regardless of where I placed the BOT.




irDetectLeft VAR Bit ' Variable Declarations..
irDetectRight VAR Bit
counter VAR Bit
FREQOUT 4, 2000, 3000
DO ' Main Routine..
FREQOUT 8, 1, 38500 ' Check IR Detectors..
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
DEBUG CLS

IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN 'Interference found

DEBUG CRSRXY, 2, 3, BIN1 irDetectLeft,
CRSRXY, 9, 3, BIN1 irDetectRight

ELSE 'No interference

DEBUG CR, "i am here"
ENDIF

PAUSE 1000
LOOP

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-10 14:28
    What do you mean by "once the sensors detect an object"? How do you have things connected?
  • marrienmarrien Posts: 3
    edited 2011-04-10 15:31
    I followed the book - Chapter 7 to connect the IRs. I placed my finger in front of the IRs. I get values "0". When I removed my finger, the values remain at "0".
  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-10 15:38
    If that's the behavior you're seeing, you've wired something wrong. How do you have things connected? ... actually connected, not what you think it's supposed to be. It's a common error. You've followed the book and it doesn't work. When you very carefully trace out what's actually connected to what, you find that it's different from what the book shows.
  • marrienmarrien Posts: 3
    edited 2011-04-10 15:49
    Are you able to see if there's anything wrong with the wiring? Thanks for your help.

    DSC00075.jpg
    730 x 548 - 102K
    1024 x 768 - 114K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-04-10 18:06
    The resistor (red-red-brn) from P9 - is that going to the IR_Det right?
    Looks like that R is going to Det's middle terminal?
    [Should be in the 3rd row down from the V_ss header.]

    The leads of the resistors in P0 and P2 look very close (touching?).

    PE - There's also a note on p243 about sensitivity and experimenting with resistor values for the IREDs (IRLEDs).
  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-10 18:20
    I can't tell looking at the photo. You're really going to have to carefully check this out yourself. Make sure there are no shorts and trace each wire, maybe recreate the schematic from the wiring itself forgetting what's in the book, then check the two diagrams agains each other.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-04-10 19:35
    attachment.php?attachmentid=78421&d=1297987572
Sign In or Register to comment.