April's Boe-Bot

Just another WordPress.com site

My Boe-Bot Video

http://www.youtube.com/watch?v=ISTeckDsmqw

January 18, 2011 Posted by | Uncategorized | Leave a comment

Day 34 My Boe-Bot Journey Ends

My final revised program:

‘ {$STAMP BS2}

‘ {$PBASIC 2.5}

DEBUG “Program running!”

pulseCount VAR Word

GOSUB First_circle

GOSUB Second_circle

GOSUB Third_circle

END

First_circle:

FREQOUT 4, 2000, 3000

HIGH 1

FOR pulseCount = 1 TO 410

PULSOUT 13, 850

PULSOUT 12, 714

LOW 1

PAUSE 20

NEXT

RETURN

Second_circle:

FREQOUT 4, 2000, 3000

HIGH 1

FOR pulseCount = 1 TO 315

PULSOUT 13, 850

PULSOUT 12, 718

LOW 1

PAUSE 20

NEXT

RETURN

Third_circle:

FREQOUT 4, 2000, 3000

HIGH 1

FOR pulseCount = 1 TO 186

PULSOUT 13, 850

PULSOUT 12, 730

LOW 1

PAUSE 20

NEXT

RETURN

I chose to program my Boe-Bot to navigate in circles after trying out the triangle routine. The triangle took me quite a while to figure out, which turned out to be pretty straight forward in the end because the exact values were actually possible to calculate beforehand, with the same amount of degrees in each turn. So, I wanted to try circles which do not have the same number values, and can only be achieved through the iterative process, just like when we first tuned each maneuver. After numerous trials and modifying, I settled with the values which came the closest to bringing the Boe-Bot to the middle of the spiral. I think what kept us working longer was trying to perfect each maneuver, and making sure the following ones wouldn’t fall short due to some variables. I’m just really glad how those long hours with the Boe-Bot brought to everyone’s success; the cheers after each completed routine reflected each one’s satisfaction. As I disassembled my Boe-Bot in the end, it made me realize how much we’ve learned. Going through each part of the robot reminded me of the different activities we’ve done from just working with the Board of Education, to the actual building, then the programming. This Boe-Bot experience has definitely been a challenging, yet exciting one.

December 21, 2010 Posted by | Uncategorized | Leave a comment

Day 33

As the final assessment for our understanding of chapters 1 – 5,  we had to create our own maneuvers and write a program for it to be executed. I decided to make my Boe-Bot navigate a spiral with the piezo speaker making a sound and an LED lighting up before every circle with a smaller diameter was executed. My program consisted of three subroutines – one for each consecutive circle. The first subroutine had the largest pulseCount and PULSOUT duration values, since the first circle has the largest circumference. Relatively, the third subroutine had the smallest pulseCount and PULSOUT duration values because the last circle has the smallest circumference. (Only the right servo’s PULSOUT duration value had to be changed, while the left servo remained at full speed throughout the routine, because I made my Boe-Bot move clockwise.) When I first ran the program the Boe-Bot veered right and moved in circles, but not quite in a spiral. The major adjustments I had to make were these values, which controls how long each subroutine lasts and how long each diameter should be.

December 21, 2010 Posted by | Uncategorized | Leave a comment

Day 32

The third activity programs the BASIC Stamp not only to detect whether a whisker is pressed, but also to react to the inputs. So when the Boe-Bot bumps into something and the whiskers are pressed, it is programmed to turn and move toward another direction. In other words, it’s programmed to make decisions – again by using subroutines and the IF…THEN statement. The Boe-Bot continues to move forward until one or both of its whiskers are pressed. If both IN5 and IN7 are pressed, then it is commanded to back up and turn left twice, making a U-turn. If only IN5 is pressed, then it backs up and turns right once. And if only IN7 is pressed, then it backs up and turns left. After modifying the program, we added the HIGH and LOW commands to make the LEDs indicate which whisker is pressed and show which maneuver it’s in. It’s interesting how the path of the Boe-Bot for this navigation program has no specific pattern or routine to follow because it completely depends on how far and how often it hits an obstacle. Since it’s free to roam, the fourth activity then shows how to program the Boe-Bot to escape if it’s stuck in a corner. This program calls for “nesting” the IF…THEN statements, which allows the program to check for one condition, and within that condition.

December 18, 2010 Posted by | Uncategorized | Leave a comment

Day 31

The next chapter is about tactile navigation using whiskers, which gives the Boe-Bot a sense of touch. The first activity guides through building and mounting the whiskers, and adding the whiskers circuit on the prototyping area. Using the resistors and jumpers reminded me of the previous circuits we’ve done, including the different parts such as the power terminals and I/O pins. One new hardware we used is the 3-pin header, which detects a whisker being pressed. To test the whiskers, the program should include input register variables (IN5 and IN7 – because the circuit is connected to P5 and P7), which stores a value of 1 if the whisker is not pressed and a value of 0 if the whisker is pressed. These values can be seen by using the command DEBUG BIN1 before the variable. BIN1 is a formatter which stands for and commands the Debug Terminal to display one binary digit (1 or 0). The second activity guides through building another circuit which includes two LEDs that should turn on and off according to the whisker inputs. The LEDs serve as the output signal which corresponds to the whiskers as the input signal. The LED for my left whisker initially didn’t work because I forgot to add one jumper. To test the LED and whisker circuit, the program should include the IF…THEN statements. IF IN7 = 0 THEN its corresponding LED should light up, or ELSE it should not.

December 14, 2010 Posted by | Uncategorized | Leave a comment

Day 30

Using the first EEPROM navigation program, I continued to work on my triangle routine. I added ramp up, ramp down, and a couple more turns as subroutines. From previous trials, a 30° turn was too short for an equilateral triangle. Remembering that all three angles of a triangle should add up to 180°, each angle should be 60°. However, that too was still not enough to make the Boe-Bot navigate a perfect triangle. So, I used two 60° turns, and “voila!” The Boe-Bot actually had to turn a total of 120° each time so that the remaining 60° makes that angle inside the triangle (this is if the Boe-Bot is turning counterclockwise). My DATA directive looked like: FSSFSSF. If it turned clockwise, it would have turned 240° instead. One group did this and it was just different to see how the Boe-Bot almost rotated a full circle at each turn. There are many ways to approach and execute a navigation program. Now, if I add a ramp up subroutine to the same routine, I’ll have to change the pulse count of the forward command a little less to keep the same distance.

December 12, 2010 Posted by | Uncategorized | Leave a comment

Day 29

Today’s activity used the EEPROM again, but replaced the subroutines with a single code block with word variables instead. The code block actually looks similar to a previous one we’ve done – with the pulse width values separated by colons. But I think what kind of complicates this program is the use of many word variables and labels. Not so much on making minor spelling mistakes, but you need to make sure that the variables are being added right in the correct places. Nonetheless, this approach definitely serves its purpose to make programs – which require repetition of maneuvers – much shorter. This program made the Boe-Bot do the usual forward, left, right, and backward routine. After replacing the DATA directive with that also given in the book, my Boe-Bot moved forward in a straight line from a full speed to a gradual full stop, then moved backward in the same manner. Lastly, I made a chart and tried a new “choreography.” I made my Boe-Bot move forward, backward, and turn left four times as to navigate a cross. The first two turns were pretty accurate but the last turns were always shorter.

December 10, 2010 Posted by | Uncategorized | Leave a comment

Day 28

EEPROM, which stands for Electrically Erasable Programmable Read Only Memory, is one of the two chips on the BASIC Stamp. Its primary function is to store programs (up to a total of 2048 bytes). As I mentioned in my last post, EEPROM navigation makes it easier to program a routine as each maneuver is given a one-letter reference code. This new approach also requires new commands such as the DATA directive (which is followed by a line of code letters always ending with a “Q” for quit), the READ command (which is used to get the stored code letters out of the EEPROM), and the SELECT…CASE…ENDSELECT command (which selects the appropriate code letter with the corresponding subroutine to be executed). The Memory Map can be selected from the Run pull-down menu to provide another format of the stored instructions, both in ASCII codes and in the chosen code letters.

I like how we all lined up our Boe-Bot’s and tried to run the program all at the same time. Although the maneuvers weren’t new, it was interesting and neat to watch them all move together.

I used the same EEPROM program as a continuation of writing a routine to make the Boe-Bot navigate in a triangle. I got the first two turns done, but the last one was off by turning more than it should have. Just one more adjustment and I’ll be done with the triangle!

December 6, 2010 Posted by | Uncategorized | Leave a comment

Day 27

Another chapter done, another review to do. As I went through the questions at the end I was pretty surprised at how much we’ve been working on this chapter. The first few questions made it seem like we’ve done it quite a while ago, but really we’ve just been working on the activities continuously. Some questions have also been asked in class a couple of times which made them easy. The exercises were pretty straight forward, but the projects were a little challenging; I had to think through each maneuver the Boe-Bot would make, and I got to practice writing programs using subroutines. I started one that would make the Boe-Bot navigate along a triangle. I’ve practiced on making the Boe-Bot turn a certain amount of degrees, so I’ll just have to add a couple more turns and forward commands to complete the whole routine. Later, I also want to try and finish a routine that would make it go in a circle – more thinking.

Just to go back a little, the last activity of this chapter introduced another way of writing programs; programs which are much shorter than the ones we’ve been using and which avoid repeating subroutines. Each maneuver is actually given a letter code, while new commands and word variables are also used. I’ll describe the new concepts after I try the EEPROM Navitation example program.

December 4, 2010 Posted by | Uncategorized | Leave a comment

Day 26

The “dead reckoning” contest asked to modify a previous program to make our Boe-Bot drive in a square, facing forwards on the first two sides and backwards on the second two sides. So, I made my Boe-Bot go forward, turn left the first time, right the second time, and left again the third time.The values we achieved when we tuned the maneuvers had to be used to make sure that our Boe-Bots’ movements were as accurate as possible. It took me a couple of trials to test and change the EndValues of the turns. Even though my Boe-Bot’s turns were a little off, it still ended right where it started. I just hope this performance will be good enough for the next chapter’s navigations which involve avoiding obstacles.

November 30, 2010 Posted by | Uncategorized | Leave a comment