How to Add Bumpers to a SUMOBOT

258

2

1

Published

Introduction: How to Add Bumpers to a SUMOBOT

what this does is that you can make it so that if it hits one of the bumpers on the robot, it will reverse and turn away from the object.

Step 1: Get Your Materials

the things you need to make this is 3 Popsicle sticks, cardboard, hot glue, four wires, and tinfoil.

an optional material you can use is masking tape if you want to remove it later on

Step 2: Cut the Popsicle's Up

for this you take a Popsicle and cut it in half with some wire cutters, or you can try to break it in half which will not be that smooth.

Step 3: Glue Some Cardboard

if you have masking tape, wrap it around the small pole, then glue a small piece of cardboard to both poles.

Step 4: Glue Tinfoil on Popsicle

wrap some tinfoil on two wires and glue it on the ends of a big Popsicle, and make sure the wires are connected to ground.

do the same with another popsicle and connect it with a resistor

now connect the first popsicle and the cardboard that was glued on the poles.

Step 5: Glue Cardboard

take a small, thin piece of cardboard and fold it up, glue one part of it to the middle of one popsicle, then the other. after that glue the popsicle that was broken in half on the ends of the 2nd Popsicle, then after that glue cardboard on the ends of the small popsicles

after that make sure the tinfoil on the second popsicle is facing the first one so that when it touches, it acts like a bumper and moves away.

Step 6: (Optional) Cut the Wires to Organize Them

if you want to, you can cut the wires to make them smaller and so that they look more organized, you can cut them with a wire cutter to your liking.

Step 7: The Code Itself

' {$STAMP BS2}

' {$PBASIC 2.5}

temp VAR Byte RunStatus DATA $00

READ RunStatus, temp temp = ~temp WRITE RunStatus, temp IF (temp>0)THEN END '-------------- I/O Pins ------------------------ LMotor PIN 13 RMotor PIN 12 '-------------- Constants --------------------- LStop CON 750 RStop CON 750 '-------------- Variables --------------------- X VAR Word Turn VAR Word '-------------- Main Program -----------------------

DO

GOSUB Forward

IF (IN9=0)AND (IN10=0) THEN HIGH 14 HIGH 3 GOSUB ReverseTurn PAUSE 50 LOW 14 LOW 3 ENDIF

IF (IN9=0) THEN HIGH 14 GOSUB ReverseTurnRight PAUSE 50 LOW 14 ENDIF IF (IN10=0) THEN HIGH 3 GOSUB ReverseTurnLeft PAUSE 50 LOW 3 ENDIF LOOP

END

'******************************************************** 'the following code is used FOR the bumpers '********************************************************

'---------------------------------------------------- 'this is so that the bumper will move forward '---------------------------------------------------- Forward: FOR X = 0 TO 25 'Forward for a bit PULSOUT LMotor,850 PULSOUT RMotor,650 PAUSE 20 NEXT RETURN

'---------------------------------------------------- 'this is when both bumpers are hit '---------------------------------------------------- ReverseTurn: FOR X = 0 TO 25 'REVERSE 20cm PULSOUT LMotor,850 PULSOUT RMotor,650 PAUSE 20 NEXT FOR X = 0 TO 25 'Turn Left 60 degrees PULSOUT LMotor, 650 PULSOUT RMotor, 850 PAUSE 20 NEXT FOR x = 0 TO 50 PULSOUT LMotor, 850 PULSOUT RMotor, 850 PAUSE 20 NEXT RETURN

'---------------------------------------------------- 'this code is used to reverse and turn left when the right bumper is hit '---------------------------------------------------- ReverseTurnLeft: FOR X = 0 TO 25 'REVERSE 20cm PULSOUT LMotor,850 PULSOUT RMotor,650

PAUSE 20 NEXT FOR X = 0 TO 25 'reverse PULSOUT LMotor, 650 PULSOUT RMotor, 850 PAUSE 20 NEXT FOR X = 0 TO 50 'Turn Right 45 degrees PULSOUT LMotor, LStop PULSOUT RMotor, 850 PAUSE 20 NEXT RETURN

'---------------------------------------------------- 'this code is used TO REVERSE AND turn right when the left bumper is hit '---------------------------------------------------- REVERSETurnRight: FOR X = 0 TO 25 'REVERSE 20cm PULSOUT LMotor,850 PULSOUT RMotor,650 PAUSE 20 NEXT FOR X = 0 TO 25 'reverse PULSOUT LMotor, 650 PULSOUT RMotor, 850 PAUSE 20 NEXT FOR X = 0 TO 50 'Turn Left 45 degrees PULSOUT LMotor, 650 PULSOUT RMotor, RStop PAUSE 20 NEXT RETURN

'******************************************************** ' End of procedures '********************************************************

Step 8: Explaining the Code

what that code is, is that it shows how the robot will act according to the bumpers, for example: the code" reverseturnleft" is when the right bumper is hit and makes it reverse and turn left.

"reverseturnright" is when the left bumper is hit and makes it reverse and turn right

"reverseboth" is when both bumpers are hit and makes it reverse and turn a different way.

the "low" and "high" terms are only useful if you are using leds in your robot, those mean that the certain light will go low, or go high.

Step 9: Final Product

the final product should look somewhat like the picture below

Share

    Recommendations

    • Water Contest

      Water Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Clocks Contest

      Clocks Contest

    Discussions

    That's a fun setup :) Thanks for sharing!