BAAAA---- BOT

232

2

1

Posted in TechnologyElectronics

Introduction: BAAAA---- BOT

Hi there! This is an instructable on making a semi utility, definitely adorable sheep resembling boe bot with working bumpers. This instructable will work you through the process of making the bumpers, give you all the code and a brief showcase of all the awesome aesthetics!

Step 1: The Code!


So the code is really simple and honestly wouldn't take you more than 2 hours to fully understand and get a grasp of to do it on your own. But! For those that just wanna see the code and copy and paste it into the basic stamp editor program then here ya go!

Code:

'************************************************************************
' Name: Luca DeFilippis

' Title - BoeBump.bs2

' Date - 28 November 2017

'Description ' Create physical bumpers that trigger a command when it hits something ' to move the Boe Bot away from the obstacle.

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

****THIS ABOVE IS JUST THE INFO ABOUT WHO MADE IT AND BASIC STUFF LIKE THAT*******

'************************************************************************

' Code for Reset Start Stop

' this code makes the bot stop or start when reset is pressed = good for making sure bot doesnt run code on loading program

'************************************************************************

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

'************************************************************************

' Pins Setup

'************************************************************************

LMotor PIN 13 RMotor PIN 12

'************************************************************************

' Constants Setup

'************************************************************************

LStop CON 750 RStop CON 750

'************************************************************************

' Variables

'************************************************************************

X VAR Word

'************************************************************************

' Main Program

'************************************************************************

DO

HIGH 1 'Turn cathodes on

HIGH 2

HIGH 3

HIGH 9

HIGH 10

HIGH 11

DEBUG ? IN14, ? IN4,CR

IF (IN14 = 1) AND (IN4 = 1) THEN 'No contact on bumpers, sub Forward

DEBUG "Forward",CR 'debug to see what movement command occurs

LOW 1

LOW 2 'Turn cathodes on and flash red and blue

LOW 9

LOW 10

GOSUB Forward

ELSEIF (IN14 = 0) AND (IN4 = 0) THEN 'Contact with both bumpers, sub BothBump = back up go forward to right

DEBUG "BothBump",CR

LOW 1 'long pause of both lights green

LOW 3

LOW 9

LOW 11

GOSUB BothBump

ELSEIF (IN14 = 0) AND (IN4 = 1) THEN 'Contact with left bumper, sub BumpRight = back up go forward to right

DEBUG "BumpRight",CR

LOW 9 'right light will go blue left will go green

LOW 11

PAUSE 200

GOSUB BumpRight

ELSEIF (IN14 = 1) AND (IN4 = 0) THEN 'Contact with right bumper, sub BumpLeft = back up go forward to left

DEBUG "BumpLeft",CR

LOW 1 'left light will go blue right will go green

LOW 3

PAUSE 200

GOSUB BumpLeft

ENDIF

LOOP

END 'Stop Program before Sub Procedures run by accident

'************************************************************************

' Sub Procedures

'************************************************************************

Forward: 'Forward for 25 cm

' FREQOUT 6, 200, 1600 'optional police siren frequencies for note e high and e flat, this slows down bot and is very quiet

' FREQOUT 6, 100, 800

FOR X = 1 TO 500

PULSOUT RMotor, 700

PULSOUT LMotor, 850

NEXT

PAUSE 20

RETURN

'****************************************************

' Code to reverse and turn when both bumpers are hit

'****************************************************

BothBump: 'REVERSE 20cm

FOR X = 1 TO 150

PULSOUT RMotor, 850

PULSOUT LMotor, 650

NEXT

PAUSE 200

FOR X = 1 TO 200 'Turn Left 60 degrees

PULSOUT RMotor, 650

PULSOUT LMotor, 760

NEXT

PAUSE 20

RETURN

'****************************************************

' Code to reverse and turn left when the right bumper is hit

'****************************************************

BumpLeft: 'REVERSE 20cm

FOR X = 1 TO 150

PULSOUT RMotor, 850

PULSOUT LMotor, 650

NEXT

PAUSE 200

FOR X = 1 TO 200 'Turn Right 45 degrees

PULSOUT RMotor, 740

PULSOUT LMotor, 850

NEXT

PAUSE 20

RETURN

'****************************************************

' Code to reverse and turn left when the right bumper is hit

'****************************************************

BumpRight: 'REVERSE 20cm

FOR X = 1 TO 150

PULSOUT RMotor, 850

PULSOUT LMotor, 650

NEXT

PAUSE 200

FOR X = 1 TO 200 'Turn Left 60 degrees

PULSOUT RMotor, 650

PULSOUT LMotor, 760

NEXT

PAUSE 20

RETURN

'********************************************************

' End of Sub Procedures

'********************************************************

The comments in the code should give you an idea of how everything works and why certain code is present but here goes a brief explanation anyways.

Ok so the way this code works is like this. The bot will run a loop code of checking the inputs of the bumpers that act like buttons. So whenever there is no detection (1,1) the forward sub procedure will run and the bot will go forward. This same idea works with whether there is left, right, or even both bumper detection!

The cathodes use the high and low commands to show light based on inputs from the bumper. They should flash blue and red like a cop car when no detection has been taken place and they should turn the corresponding left or right light bumper to turn green if said bumper has any detection. The sub procedures tell the bot to move back and turn right or left based on the hit to avoid the obstacle it made contact with. This works exceptionally well in mazes because the turn is very slight meaning that the bot will be careful not to turn exceedingly much and exit the maze.

Attached to the forward sub procedure is a freqout command to allow for sound to be transmitted while moving forward. The frequencies given should sound like a cop siren, thus adding to the aesthetic of having cop lights.

Thats it really! Nothing too crazy to understand, I hope this was helpful and straightforward!

Step 2: The Construction!

------------------------------------------------------------------------------------------------------------------------------------------------------

What you will need:

------------------------------------------------------------------------------------------------------------------------------------------------------

6 1k resistors

2 10k resistors

2 3 colour cathodes

1 speaker (optional)

any small sized capacitor (also optional (for the speaker!))

Multitude of wires

2 popsicle sticks

Aluminum foil

Small pieces of cardboard

Hot Glue

Tape

------------------------------------------------------------------------------------------------------------------------------------------------------

The Bumpers!

------------------------------------------------------------------------------------------------------------------------------------------------------

Ok so lets begin with the bumpers! To make them you are gonna need to use the aluminum foil, cardboard, wire and hot glue to mantle it to the board.

1. Cut out 2 similar sized cardboard rectangles and fold them in half

2. Hot glue the 2 pieces to the same popsicle stick and then hot glue the other side of the cardboard pieces to another seperate popsicle stick.

3. Now you need to fold aluminum foil into some hefty squares big enough to fit 2 on each cardboard piece, attach the pieces of foil to the cardboard via staples, or any other conductor. I used staples.

4. Now it is important to attach 2 wires to each cardboard piece and make sure they have clear secure connection to the aluminum foil

They should look something like the first image

5. Finally now you have to attach the 4 wires to the board. Do so by connecting 2 to Vss and one to anywhere in the 6th row, and one anywhere in the 14th row.

To attach the bumpers to the bot, you can do this many ways, I do it by taping the bots front and gluing the stick to that tape.

And really thats it with assembling the bumpers! Now is a matter of actually using them!

------------------------------------------------------------------------------------------------------------------------------------------------------

The Wiring of Everything

------------------------------------------------------------------------------------------------------------------------------------------------------

Now this next part is a little complicated to explain but I will try my best to do so with massive visual help. Reference image 3, 4, 5 to just plug in the components as you see them.

So youre going to want to insert the cathodes on the right side of the board and follow 3 1k resistors into each cathode which would eliminate your 6 1k resistors.

When this is complete you are going to want to wire a ground or vss to the 2nd pin of each cathode, the longest wire.

That completes the cathodes, so the next thing to do is connect your 10k resistors from the vdd to the places you put the 2 bumper wires on the board.

Next is too use a wire and connect pin 6 for the right bumper to the most right 10k resistor and bumper wire.

Follow the past step for the left most 10k resistor.

This next step is optional for the speaker and that is to connect your small capacitor to pin 7 and too the board.

You will then want to connect the speaker negative end to the capacitor and finally connect the positive end to the VSS.

This should conclude the wiring and be sure to reference image 3, 4, 5 for more help!

Step 3: THE BAAAAAA------ Feature!

Along with having police lights and an optional police siren. Your BoeBot will be king of all others by being dressed as a sheep!

Seen in the title image, I made mine look like one!

To do this is really simple, all you need is:

Puff balls

Masking Tape

1. Simple lay out layers of tape and make sure they are all connected with stickyness left on them to stick the puff balls

2. Layer on the sticky part puff balls.

3. This is the part when you attach the furry coat to the bot, you can do this many ways

--> Add inverted tape to the ends of the fluff and wrap the tape around the bot like a rope

OR --> Tape the bottom of the bot and hot glue the loose ends of the tape mesh to the tape at the bottom of the bot

I did the first option for faster and easier access to the board if something goes wrong!

And that's it! Hopefully now your Boe Bot will be the best in town cruising with its amazing features.

Share

    Recommendations

    • Woodworking Contest

      Woodworking Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Make it Move Contest

      Make it Move Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments

    Cute, that's a fun take on one :)