Parallax, Inc. Presentation based on: “Robotics: with the Boe-Bot" www.parallax.com 599 Menlo Drive Suite 100 Rocklin, CA 95765
Copyrights and Trademarks This documentation is copyright 2004 by Parallax, Inc. By downloading or obtaining a printed copy of this documentation or software you agree that it is to be used exclusively with Parallax products. Any other uses are not permitted and may represent a violation of Parallax copyrights, legally punishable according to Federal copyright or intellectual property laws. Any duplication of this documentation for commercial uses is expressly prohibited by Parallax, Inc. Duplication for educational use is permitted subject to the following conditions: Parallax grants the user a conditional right to download, duplicate, and distribute this text without Parallax's permission. This right is based on the following conditions: the document, or any portion thereof, may not be duplicated for commercial use; it may be duplicated only for educational purposes when used solely in conjunction with Parallax products, and the user may recover from the student only the cost of duplication. BASIC Stamp, Stamps in Class, and Board of Education are registered trademarks of Parallax, Inc. If you decide to use the names BASIC Stamp, Stamps in Class, and/or Board of Education on your web page or in printed material, you must state that "BASIC Stamp is a registered trademark of Parallax, Inc.," "Stamps in Class is a registered trademark of Parallax, Inc.," and/or "Board of Education is a registered trademark of Parallax, Inc.," respectively, upon the first appearance of the trademark name. Other brand and product names are trademarks or registered trademarks of their respective holders.
What's New In Robotics New Servos Adjustable potentiometer Faster, quieter, draw less power New Board of Education Power Switch Jumper New Wheels and Tires New Whiskers New Infrared Emitters New Text – v2.0 PBASIC 2.5 Not used in Robotics! v.1.5 text
Select the Servo Power Supply New jumper - connects servo power to either Vin – Battery Voltage Vdd – Regulated 5V supply Select Vin for use with 4 AA batteries Pull jumper off pins, then push onto Vin pin
Center the Boe-Bot Servos Plug the battery pack into the BOE Note the correct polarity Plug the servos in to the BOE Important!! Black wire closest to breadboard! Turn the switch to Position 1 Enter and Run "CenterServoP12.bs2" pg. 65 Repeat for "CenterServoP13.bs2" pg. 66
Center the Boe-Bot Servos Move the switch to Position 2 If the servos do not stay still, adjust them with your Parallax screwdriver Do not push too hard Use the Phillips end Adjust each servo so it stays completely still
Build the Boe-Bot Build the robot by following instructions from your manual (pages 85-99) Explain they’ll find some little differences on the manual because they have improved hardware.
Build the Start/Reset Indicator Brownout Batteries drop below 5.2 V Brownout detector circuit resets the BASIC Stamp Program starts over from beginning Low Battery Indicator Add speaker to Boe-Bot "Beep" first thing in program If Boe-Bot beeps during navigation, must have reset Thus batteries are low Figure 3-18 p 102
Test the Low Battery Indicator Run "StartResetIndicator.bs2" Test by pressing the Reset button on the BOE Should beep each time reset DEBUG CLS, "Beep!!!" ' Display while speaker beeps. FREQOUT 4, 2000, 3000 ' Signal program start/reset. DO ' DO...LOOP DEBUG CR, "Waiting for reset…" ' Display message PAUSE 500 ' every 0.5 seconds LOOP
Servo Positioning Pulse Width Direction of Rotation PULSOUT Period Determined by the width of the pulse Distance Each pulse causes the servo to rotate a small amount Speed Maximum at 1.3 and 1.7 ms. Decreases as approaches 1.5 ms Pulse Width Direction of Rotation PULSOUT Period 1.3 ms Clockwise 650 1.5 ms Stopped 750 1.7 ms Counter-clockwise 850 km – p. 73 new text
Controlling Distance Run "BoeBotForwardThreeSeconds.bs2" Follow the instructions on p. 118 to make the Boe-Bot go half as far forward Add code to make the Boe-Bot go backward, left, and right, as shown on pages 119-120 FOR counter = 1 TO 122 PULSOUT 13, 850 PULSOUT 12, 650 PAUSE 20 NEXT put new code here
EEPROM Navigation Run "EEPROMNavigation.bs2" p. 141 Modify the DATA directive to make your own motion sequence DATA "FFFBBLFFRFFQ" F = Forward, B = Backward, L = Left, R = Right, Q = Quit DO READ address, instruction address = address + 1 SELECT instruction CASE "F": GOSUB Forward CASE "B": GOSUB Backward CASE "L": GOSUB Left_Turn CASE "R": GOSUB Right_Turn ENDSELECT LOOP UNTIL instruction = "Q" address VAR Byte instruction VAR Byte ' Address: 0123456789 ' |||||||||| DATA "FLFFRBLBBQ" km – modify code listing
Tactile Navigation with Whiskers Activities: Building and Testing the Whiskers Page 154-165 See also wiring diagram next slide km – Remove this slide?
Build the Whisker Circuit km -- Figure 5-4 and 5-5 p. 156-7 With added LEDs Figure 5-9 5-10 p. 162-3
Testing the Whiskers Run "TestWhiskers.bs2" p.160 Press on each whisker and examine the Debug Terminal output. Each whisker should display 1 when not pressed, 0 when pressed. Position the whisker wires to make good contact with the headers DEBUG "WHISKER STATES", CR, "Left Right", CR, "------ ------" DO DEBUG CRSRXY, 0, 3, "P5 = ", BIN1 IN5, " P7 = ", BIN1 IN7 PAUSE 50 LOOP p. 159 replace code listing
Navigation With Whiskers Run "Roaming with Whiskers.bs2" Compare with pushbuttons exercise from the previous day DO IF (IN5 = 0) AND (IN7 = 0) THEN ' Both whiskers detect obstacle GOSUB Back_Up ' Back up & U-turn (left twice) GOSUB Turn_Left ELSEIF (IN5 = 0) THEN ' Left whisker contacts GOSUB Back_Up ' Back up & turn right GOSUB Turn_Right ELSEIF (IN7 = 0) THEN ' Right whisker contacts GOSUB Back_Up ' Back up & turn left ELSE ' Both whiskers 1, no contacts GOSUB Forward_Pulse ' Apply a forward pulse ENDIF ' and check again LOOP
Navigation with Infrared Headlights Activities: Understanding Infrared Object Detection Building and Testing the IR Circuit Object Detection and Avoidance Object Detection and Avoidance in Real-Time
Using Infrared Headlights to See the Road IR reflect off obstacles IR LED emits light in infrared region (780 nm) Detector shows "0" if detects IR, "1" otherwise Detector tuned to 38,500 Hz only km – new diagram Figure 7-1 p. 218
Building and testing the IR Pairs Figure 7-4 7-5 p. 220-221 Run "TestLeftIrPair.bs2" Follow directions on p. 223 to test right IR pair
How the IR Test Program Works ' Robotics with the Boe-Bot - TestLeftIrPair.bs2 ' Test IR object detection circuits, IR LED connected to P8 ' and detector connected to P9. ' {$STAMP BS2} ' {$PBASIC 2.5} irDetectLeft VAR Bit DO FREQOUT 8, 1, 38500 irDetectLeft = IN9 DEBUG HOME, "irDetectLeft = ", BIN1 irDetectLeft PAUSE 100 LOOP TestLeftIRPair.bs2 p. 222
Object Detection and Avoidance Run "RoamingWithIr.bs2" IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN GOSUB Back_Up GOSUB Turn_Left ELSEIF (irDetectLeft = 0) THEN GOSUB Turn_Right ELSEIF (irDetectRight = 0) THEN ELSE GOSUB Forward_Pulse ENDIF RoamingWithIr.bs2 Place the Boe-Bot on the floor Your Boe-Bot should roam around and avoid objects
Again the Boe-Bot should roam around and avoid objects Fast IR Roaming Run "FastIRRoaming.bs2" Again the Boe-Bot should roam around and avoid objects Observe: How does this behavior differ from that of "RoamingWithIr.bs2"? IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN pulseLeft = 650 pulseRight = 850 ELSEIF (irDetectLeft = 0) THEN pulseLeft = 850 ELSEIF (irDetectRight = 0) THEN pulseRight = 650 ELSE ENDIF "FastIRRoaming.bs2"
Understanding Filter Sensitivity Figure 8-1 p. 248 Figure 8-2 p. 249 TestLeftFrequencySweep.bs2 Screen Shot? Figure 8-3 p. 251
Testing Distance Detection Run "TestLeftFrequencySweep.bs2" Place the Boe-Bot in front of some obstacle (Wall, book, etc) Observe the readings change as you move the Boe-Bot closer to and further away from the obstacle
Boe-Bot Shadow Vehicle Follow the detailed instructions on p. 259-260 In summary: Run "FollowingBoeBot.bs2" Place a sheet of paper in front of your Boe-Bot Move the paper around The Boe-Bot should follow the paper at a constant distance If the Boe-Bot backs away instead, contact the instructor for assistance. Your right/left servos are probably reversed.
Boe-Bot Follow-the-Leader Place sticky notes on the back of all Boe-Bots Now select two or three Boe-Bots from the class to be "Leader" Boe-Bots Create "Leader" Boe-Bots by following the instructions on p. 263 All other Boe-Bots keep the previous program, "FollowingBoeBot.bs2" The "Shadow" Boe-Bots will follow the "Leader" Boe-Bots See how many Boe-Bots will follow in a row, like a train FollowingBoeBot.bs2
Create Stripe-Following Boe-Bots Following a Stripe Create Stripe-Following Boe-Bots Follow the instructions on pp. 264-271 Make sure to point IR pairs downward as detailed in text Figure 8-7 p. 264 – The Course Figure 8-8 p. 265 – The IR Pairs going downward ?
Focus on Proportional Control The Boe-Bot will follow a moving object by maintaining a constant distance from it. The amount of correction is directly proportional to the error. That is, the Boe-Bot will speed up or slow down a varying amount, depending on how far away the object is. Distance Reading Meaning Left Wheel PULSOUT Wheel Direction Robot motion Far Away 650 Clockwise Backward fast 2 Desired distance 680 Backward slow 5 Very close 750 Stopped 820 Counter-clockwise Forward slow 850 Forward fast New servo params
Proportional Control Block Diagram Desired Distance Measured Boe-Bot is… What to do… Error Output Adjustment Left Servo Robot Motion 2 4 A bit too close Go backward 2–4 = -2 -35 * -2 = -70 750 + (-70) = 680 Backwards slow 5 Much too close 2-5 = -3 -35 * -3 = -105 750 + (-105) = 645 Backwards fast 1 Much too far away Go forward ? A bit too far away Figure 8-5 p. 258 – Left Figure 8-4 p. 256 - Right
The End We hope you enjoyed this Educator's Course Don't hesitate to contact us for any reason!