Shop OBEX P1 Docs P2 Docs Learn Events
Problem with Boe Bot Infrared — Parallax Forums

Problem with Boe Bot Infrared

shinn89shinn89 Posts: 3
edited 2012-05-27 11:47 in BASIC Stamp
Hi. I am given a project using Boe Bot Educational Robot Kit. Our given task is that the robot has to travel a circle in the provided track, which is pretty similar to the "Activity #3:Following A Stripe: in the guide book. Our group's bot has a problem where only the right Infrared is working and the left does not detect or react anything. The bot spins around and did not make the bot to keep moving on the track. We programmed it with Basic Stamp according to the program provided in that guide book. Is there something wrong with the program?

20120524_122549.jpg



This is what is writen in our Basic Stamp

' {$STAMP BS2}
' {$PBASIC 2.5}

DEBUG "Program Running !"

'
[ Constants ]

Kpl CON -35
Kpr CON 35
SetPoint CON 2
CenterPulse CON 750

'
[ Variables ]

freqSelect VAR Nib
irFrequency VAR Word
irDetectLeft VAR Bit
irDetectRight VAR Bit
distanceLeft VAR Nib
distanceRight VAR Nib
pulseLeft VAR Word
pulseRight VAR Word

'
[ Initialization ]

FREQOUT 4, 2000, 3000

'
[ Main Routine ]

DO

GOSUB GET_Ir_Distances

' Calculate proportional output.

pulseLeft = Setpoint - distanceLeft * Kpl + CenterPulse
pulseRight = Setpoint - distanceRight * Kpr + CenterPulse

GOSUB Send_Pulse

LOOP

'
[ Subroutine - Get IR Distances ]

Get_Ir_Distances:
distanceLeft = 0
distanceRight = 0
FOR freqSelect = 0 TO 4
LOOKUP freqSelect, [37500, 38250, 39500, 40500, 41500] , irFrequency

FREQOUT 8, 1, irFrequency
irDetectLeft = IN9
distanceLeft = distanceLeft + irDetectLeft

FREQOUT 2, 1, irFrequency
irDetectRight = IN0
distanceRight = distanceRight + irDetectRight
NEXT
RETURN

'
[ Subroutine - Get Pulse ]

Send_Pulse:
PULSOUT 13, pulseRight
PULSOUT 12, pulseLeft
PAUSE 5
RETURN
1024 x 768 - 79K
1024 x 768 - 84K

Comments

  • ercoerco Posts: 20,257
    edited 2012-05-23 08:51
    Check your wiring. Can't tell from your photo, but it's likely that some part of your left IR circuit (LED or detector) is not properly connected. Your left and right circuits are identical, just plugged into different I/O pins. Make sure they are hooked up properly to the right pins. If that checks out, it's possible that your left IR LED is hooked up backwards, there is a polarity there, shorter lead goes to ground (negative). As a last resort, you can swap parts one at a time between left & right to find out if you have a bad IR LED or detector. Take lots of clear pics before you undo anything! :)
  • shinn89shinn89 Posts: 3
    edited 2012-05-24 01:46
    I did what you had taught me. We had changed the wire connecting the Left IR LED, switch its polarity but still the same. When it supposed to turn left, it just went spinning around. The bot has no problem going clockwise, but when we want it to go counter-clockwise, it just go spinning around when comes to the turning. Could it be the IR LED or detector problem or any chances of wrong coding in the programming?
  • ercoerco Posts: 20,257
    edited 2012-05-24 08:30
    I'm assuming your code is perfect and from Parallax, if so, its thoroughly tested. If you hand-typed it, double check all your code.

    You can't see the IR LED glow with your eyes, but you can see it when viewed through a camera/cellphone. Try that.

    Are you sure both of your servos work and are hooked up properly? Just try this:

    a: PULSOUT 13, 800
    PULSOUT 12, 700
    PAUSE 20
    goto a
  • shinn89shinn89 Posts: 3
    edited 2012-05-25 13:09
    ok. Thanks for the help. Appreciate it much.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-05-27 11:47
    Are those IR LEDs? They look red.

    Is there a program just to check if the IR sensors are working correctly?

    If the program isn't working as expected, then it's time to isolate each component and make sure each component can work on its own.

    erco suggested testing the servos. If the servos work correctly then you'll want to test the IR sensors.

    When you say your using the "guide book", what is its title (and edition)? Is it "Robotics with the BOE-Bot"? If so which version.

    Which page is the program you typed from?

    It's easier for us to read code you post if you use code tags. Here's a link to learn how to use code tags.

    attachment.php?attachmentid=78421&d=1297987572
Sign In or Register to comment.