Introduction: Make Robot Bumpers (with Code)

This instructable will walk readers through how to create and code bumpers on a Boe-bot that will be able to navigate through a maze while detecting obstacles. The coding for the project was done using BASIC Stamp programming software and the Boe-Bot robot, and basic understanding of circuitry and programming is required to succeed at creating these bumpers.

Supplies

To create these bumpers, you will need:

- Boe-Bot robot

- BASIC Stamp programming software

- Popsicle sticks

- A sponge

- Aluminum foil

- Paper clips

- 8 decently long wires (at least 6 inches)

- 2 LED lights

- 2 brown-black-yellow resistors

- 2 red-red-brown resistors

- Tape and hot glue (or a similar adhesive)

- Batteries for your Boe-Bot

Step 1: Step 1: Creating the Circuit

Follow the breadboard diagram above to create a circuit to orient and operate your breadboard. At the end, your breadboard should look similar to the image on the left.

Things to remember:

- Make sure the LED is in the correct position. This means that the flat leg of the LED should be on the negative side and the other leg on the positive side.

- The Vss serves as the ground on this breadboard, which means it has a value of zero, and the Vdd has a value of 1.

- A running circuit has a value of 0. A circuit that is turned off has a value of 1.

Step 2: Step 2: Programming for the Boe-bot

The following code programs the robot to turn left and right 90 degrees based on which of the bumpers are pressed (further detail about bumper creation in next step). This code makes sure that the robot will turn left when the right bumper wires are pressed, and will turn right when the left bumper wires are pressed.

Some basic language translations:

- GOSUB = subroutine (must be followed by a demand in the code)

- If..Else = specifies a group of code that should be executed, if conditions are true, and carries instructions out if conditions are false

The code:

' {$STAMP BS2}

' {$PBASIC 2.5} '*************************************************************************** 'Reset Restart Code ' Use the reset button to stop and start the robot '*************************************************************************** temp VAR Byte 'temporary store RunStatus DATA $00 'variable stored in ROM READ RunStatus, temp 'Read the variable from ROM temp = ~temp 'invert the value 0 to 1 or 1 to 0 WRITE RunStatus, temp 'Write the variable back to ROM IF (temp>0) THEN END 'Check if the value is 1 ' if so END the program PAUSE 3000 'Pause to allow you to move ' your hand when you press reset '*************************************************************************** '************************************************************************** 'Pins AND Constants ' Used to simplify programming '************************************************************************** LMOTOR PIN 15 RMOTOR PIN 14 RFast CON 650 LFast CON 850 RSlow CON 700 LSlow CON 780 MStop CON 750 RFastRev CON 850 LFastRev CON 650 RSlowRev CON 800 LSlowRev CON 700 TurnLeft90 CON 90 TurnRight90 CON 90 '************************************************************************* '************************************************************************* 'Variables ' Used to simplify programming '************************************************************************* MLoopC VAR Word 'For..Next Variable up to 65000ish sideCount VAR Byte turnAngle VAR Word '************************************************************************** '-------------------------------------------------------------------------- 'Main Code '-------------------------------------------------------------------------- DO IF IN10 = 0 THEN 'If the wire in pin 10 is on then turn left GOSUB LeftTurn90 GOSUB LFastRev GOSUB RFastRev ELSEIF IN11 = 0 THEN 'If the wire in pin 11 is on then turn right GOSUB RightTurn90 GOSUB LFastRev GOSUB RFastRev ENDIF GOSUB ForwardFast 'Move forward one pulse LOOP '------------------------------------------------------------------------ '**END OF MAIN CODE****************************************************** '------------------------------------------------------------------------ '************************************************************************ '**Sub-routines / Sub-procedure / Methods******************************** '************************************************************************ '************************************************************************ '************************************************************************ RightTurn90: ' Subprocdure to Turn 90deg Right '*********************************************************************** HIGH 1 LOW 0 FOR MLoopC = 1 TO 22 PULSOUT LMOTOR, Lfast 'move forward one pulse PULSOUT RMOTOR, RfastRev ' using pins and constants PAUSE 20 ' 20mS allows robot to move NEXT ' before NEXT pulse RETURN '*********************************************************************** LeftTurn90: ' Subprocedure to Turn 90deg Right '*********************************************************************** HIGH 0 LOW 1 FOR MLoopC = 1 TO 22 PULSOUT LMOTOR, LfastRev 'move forward one pulse PULSOUT RMOTOR, Rfast ' using pins and constants PAUSE 20 ' 20mS allows robot to move NEXT ' before NEXT pulse RETURN '*********************************************************************** ForwardFast: ' Subprocedure to move the robot forward one square fast '*********************************************************************** FOR MLoopC = 1 TO 55 PULSOUT LMOTOR, LFast PULSOUT RMOTOR, RFast PAUSE 20 NEXT RETURN '********************************************************************** ReverseTurnLeft: 'Subprocedure to reverse and turn the robot left when right bumper is hit '********************************************************************** FOR MLoopC = 1 TO 55 PULSOUT LMOTOR, LSlowRev PULSOUT RMOTOR, RFastRev PAUSE 20 NEXT RETURN '*********************************************************************** ReverseTurnRight: 'Subprocedure to reverse and turn the robot right when left bumper is hit '*********************************************************************** FOR MLoopC = 1 TO 55 PULSOUT LMOTOR, LFastRev PULSOUT RMOTOR, RSlowRev PAUSE 20 NEXT RETURN '*********************************************************************** 'END OF SUBROUTINES '***********************************************************************

Step 3: Step 3: Using Aluminum Foil and Popsicle Sticks for Wire Bumpers

Before you begin this step, ensure that the 4 wires from the breadboard (refer to step 1) are divided into pairs, with each pair controlling a right or left bumper. LEDs function in this situation to check that the code was effective on the right and left bumpers. On the Popsicle sticks, one wire from each pair shares one end of the Popsicle stick (this means that wires of the same pair CANNOT be on the same bumper).

Cut 4 small rectangles of foil and use one to wrap the wire around each end of two Popsicle sticks. This increases the surface area of conductivity of the Popsicle stick as well as provide a greater surface area for the sticks to touch.

To keep the foil and wires stuck to the Popsicle sticks, use 1-2 paperclips to hold the materials together. The paperclips also provide more accessibility for the Popsicle sticks to touch without much external interference. Slide the paperclip over the Popsicle stick just as you would with a normal stack of papers. Repeat this for all four pieces of foil and each end of the two Popsicle sticks.

Step 4: Step 4: Assembling the Rest of the Bumpers

Once the aluminum foil and paperclips are able to keep the wires attached to each Popsicle stick, cut two small cubes of sponge and glue each cube between the sticks (at the very ends of each stick so that the hot glue adhesive does not interfere with the conductivity of the metal. The sponges ensure that the bumpers with touch each time the robot hits a wall.

Optional: Cut an extra Popsicle stick in half and glue it at an angle at the tip of the outer Popsicle stick bumper. This reinforces the impact of the bumper hitting a wall and turning.

Remember the bend the wires so that the bumpers curve out right in front of the Bot-bot.