Programming and Using The

Programming and Using The

Programming and Using the

Boe-Bot to Perform Various Actions

6/24/2013

Akash Oza, Nate Hartley, Ashley Milligan

Team 4

Engineering Fundamentals — Governor's School 2013

Abstract

For this project, we had to build and program a robot using a Boe-Bot kit to follow a figure 8 pattern on a table. We put together the basic parts of the robot and began programming. We started by programming basic functions on the robot, such as moving forward and not running into the wall, and later added on more complex functions. These functions include using the QTI infrared sensors to follow a black line and stop when in close proximity to other objects. For aesthetic appeal, we decorated our robot like a pirate ship, complete with a mermaid on the front and Peter Pan on the mast.

Detailed Description

To program the robot, a combination of two individual programs was used. First of all, we wrote the line-follow-with-qtis program. This allowed the Boe-Bot to follow a black line. The Boe-Bot, however, would stop if it saw all black, so we modified the code to allow it to move around to find the black line and continue on it. Furthermore, we added to that code a modified version of the code of the infrared program. That allowed us to stop the Boe-Bot if an obstacle came in its way. Obstacles included other Boe-Bots, hands, and walls. We also had to adjust the sensors so that the walls of the figure-eight track were not sensed. Therefore, rather than modifying the code, we changed the Boe-Bot, allowing it to move around. Our Boe-Bot did not move very smoothly around the track, however. The Boe-Bot moved jaggedly trying to turn around.

Our robot was very visually stimulating. Light brown construction paper with a wood grain pattern drawn on it surrounded the base of the robot. A redheaded mermaid with a green tail and purple top was on the front of the ship. The robot's name, Pirate Ship One, was written on a green piece of construction paper and taped to the side. A mast made out of a wooden stick was attached to the base. On the mast was a pirate flag, sail, and small Peter Pan.


To construct the Boe-Bot, we first followed the instructions for constructing the robot with the QTI sensors, which were on the underside of the robot. The wires were attached as stated in the instructions. On the underside of the robot, batteries in a pack were also placed. We attached the wheels. We had lights included in the machine, but they did not work. After attaching the QTI sensors, we attached the normal infrared sensor. For this, we had to move around some of the wiring, moving it over a row. That allowed us to fit both the QTI sensor wiring and the normal infrared sensor wiring, and run the program that used a combination of both. We also had an overheating problem with our Boe-Bot. To fix that, we first allowed the Boe-Bot to cool by unplugging the batteries. Then, we reattached some wires, which apparently helped fix the problem. Also, aligning the motors was definitely another problem. At first, our robot would only move in circles. After the motors were aligned during construction, the robot moved normally. The sensors were attached with screws; however, some kept loosening.

What Did I Learn?

Having no prior experience with robots, this experience opened my mind to a new world: that of robotics. When dealing with the hardware side of the machine, the main components are wires. It is important to be very careful when wiring the Boe-bot because the slightest error can cause a catastrophic malfunction. All wires must be in their correct position. It was unexpected that something so simple would be so critical to the robot. Other than that, construction consisted of mere following instructions and using common since. It was a smooth connection between hardware and software that made Boe-bot possible.

With respect to programming, we learned the basic commands needed in this software. We learned about the importance of describing what one did in the code. That helped us understand as beginners, what we were doing.

Furthermore, we learned how to make the Boe-Bot respond to situations. An example of this is making it stop if an object was placed in its way. We were also able to program each infrared sensor. To continue, we learned the importance of having to use if, then statements.

Advice for Future Students

We have a lot of advice for future students. First, they should delegate tasks so that they can complete the project in a timely manner. They should also work together if one person finishes early or needs help. They should know what each command in the code means. Before testing, they should check to make sure the motors are aligned and that all the parts are connected. Do not get distracted on adding flashy details before working out the basic task. Also, it is best to not add annoying flashy functions that will cause traffic jams during testing, such as doing 360 degree spins or having harpoons on the robot.

Suggestions

Please make sure the equipment is functioning before the project. It was difficult to figure out what was wrong with our Boe-Bot without the assurance of functioning supplies. Do not allow 360 turns in the middle of the figure-eight; it slows down traffic. A few days of coding may help us have a better grasp of what is going on. Also, we would like to have robot fights.

Code Listings

Appendix 1: Code for Line-Follow with Infrared Sensors for Objects

' {$STAMP BS2}

' {$PBASIC 2.5}

' LineFollowWithCheckQtis.bs2

' Navigates based on values acquired with the Check_Qtis subroutine.

irDetectLeft VAR Bit

irDetectRight VAR Bit

pulseCount VAR Byte

qtis VAR Nib ' black/white states

OUTB = %1111 ' Set OUTB bits to 1

FREQOUT 3, 2000, 3000

DO

FREQOUT 8, 1, 38500

irDetectLeft = IN9

FREQOUT 2, 1, 38500

irDetectRight = IN0

IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN

GOSUB Hammer_Time

ELSEIF (irDetectLeft = 0) THEN

GOSUB Hammer_Time

ELSEIF (irDetectRIght = 0) THEN

GOSUB Hammer_Time

ELSE

GOSUB Check_Qtis

SELECT qtis

CASE %1000

PULSOUT 13, 650

PULSOUT 12, 650

CASE %1100

PULSOUT 13, 750

PULSOUT 12, 650

CASE %0100

PULSOUT 13, 800

PULSOUT 12, 650

CASE %0110

PULSOUT 13, 850

PULSOUT 12, 650

CASE %0010

PULSOUT 13, 850

PULSOUT 12, 700

CASE %0011

PULSOUT 13, 850

PULSOUT 12, 750

CASE %0001

PULSOUT 13, 850

PULSOUT 12, 850

CASE ELSE

PAUSE 3

ENDSELECT

ENDIF

LOOP

Check_Qtis:

' Result -> qtis variable.

' 0 means white surface

' 1 means black surface.

DIRB = %1111

PAUSE 0

DIRB = %0000

PAUSE 0

qtis = INB

RETURN

Hammer_Time:

FOR pulseCount = 0 TO 20

PULSOUT 13, 0

PULSOUT 12, 0

PAUSE 20

NEXT

RETURN