background image

Chapter 3: SumoBot Sensors and Border Detection · Page 23   

Chapter 3: SumoBot Sensors and Border Detection 

 
Once the SumoBot is moving, the next task is to scan the playing surface to make sure 
that it doesn't drive itself out of the ring.  The task is accomplished by two specialized 
line detection sensors called QTIs.  The QTI uses a reflective infrared sensor to allow the 
SumoBot to "look" for the ring's border. 

LINE SENSOR THEORY 

The Parallax QTI uses a QRD1114 infrared (IR) reflective sensor to determine the 
reflectivity of the surface below it.  When the SumoBot is over the black playing field or 
start lines (Shikiri), the reflectivity is very low; when the QTI is over the white border 
(Tawara), the reflectivity is very high and will cause a different reading from the sensor. 
 
Figure 3.1 shows the schematic for the Parallax QTI line sensor. 
 

Figure 3.1:  QTI Line Sensor Schematic 

 

 

 

 
The QTI sensor is activated by placing 5V (Vdd) on the W pin.  This will cause current to 
flow through the 470 

 resistor to the LED side of the QRD1114.  IR light reflecting of 

the surface below will cause a change in the ability for current to flow through the 
phototransistor side of the QRD1114.  The transistor, in effect, behaves like an IR 
controlled resistance. 
 
The BASIC Stamp has a specific command designed to read a variable resistance called 

RCTIME

.  When coupled with a capacitor, the BASIC Stamp can measure a variable 

resistance by timing the charge or discharge rate of the connected capacitor.   

Summary of Contents for Boe-Bot

Page 1: ...SumoBot Mini Sumo Robotics Assembly Documentation and Programming VERSION 2 1...

Page 2: ...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 BA...

Page 3: ...llax provides editable Word documents to our translating partners and attempts to time the translations to coordinate with our publications Robotics Designed exclusively for Parallax robots this forum...

Page 4: ......

Page 5: ...ervo Works 11 Time Measurement and Voltage Levels 11 SumoBot Motion Test 16 Challenge Yourself 21 Chapter 3 SumoBot Sensors and Border Detection 23 Line Sensor Theory 23 Our First Operational Sumo Pro...

Page 6: ...Page vi SumoBot Mini Sumo Robotics Appendix B Standard Mini Sumo Competition Rules 55 Appendix C Mini Sumo Ring 65 Appendix D SumoBot PCB Schematic 67...

Page 7: ...ler version about half the size and weight of the lightweight class to be used as a robot Sumo demonstrator The result of their work was a very small Sumo robot that measured just 8 cm by 8 cm and mas...

Page 8: ...ssed in an introductory format designed to impart a conceptual understanding along with some hands on experience Those who intend to delve further into industrial technology electronics or robotics ar...

Page 9: ...Preface Page ix...

Page 10: ......

Page 11: ...bles as well state oriented design A well designed program means you can easily tune the software for the right mechanical control in just a few places rather than rewriting your entire program A surf...

Page 12: ...EQUIRED A Parallax screwdriver is included in your kit You may find a pair of needle nose pliers and a wire stripper to be useful not included ABOUT PARTS IN THE SUMOBOT KIT Appendix A includes a part...

Page 13: ...s and nuts The screws will be countersunk into the battery pack when tightened and should be out of the way of the batteries Step 2 Install the Servo Motors Parts Required 2 Parallax Continuous Rotati...

Page 14: ...s SumoBot chassis Using a 4 40 3 8 pan head machine screw attach each stand off to the rear of the SumoBot chassis Step 4 Install the Front SumoBot PCB Stand offs Parts Required 2 5 8 round standoffs...

Page 15: ...holes on the SumoBot chassis Secure the rear side of the SumoBot PCB to the 5 8 standoffs with two 3 8 pan head machine screws Holding the chassis upside down place a nylon washer onto the end of eac...

Page 16: ...wheel onto the servo splines Secure each wheel with the small black Phillips head screw Step 8 Mount the Scoop Parts Required SumoBot scoop 2 4 40 1 4 long pan head machine screws 2 4 40 nuts SumoBot...

Page 17: ...enter chassis slot Step 10 Install the QTI Line Sensors Parts Required 2 QTI line sensors 2 4 40 1 4 long pan head machine screws SumoBot chassis Using two 4 40 1 4 pan head machine screws attach the...

Page 18: ...ine Sensor X4 Right QTI Line Sensor Connect the battery pack wires to SumoBot PCB connector X1 The battery pack s white striped lead connects to the terminal Note Previous versions of the SumoBot PCB...

Page 19: ...position power switch The state of each position is shown below The three position switch has a middle position that powers the entire circuit except the servos A complete schematic of the SumoBot PCB...

Page 20: ......

Page 21: ...also has internal mechanical linkages for position feedback so that the electronic circuit that controls the DC motor inside the servo knows where to turn to in response to a pulse train SumoBot motio...

Page 22: ...atteries and it is connected to the positive terminal of the battery pack Vdd is regulated to 5 volts by the SumoBot PCB s onboard voltage regulator and it will be used with Vss to supply power to cir...

Page 23: ...e pulses Negative pulses would involve a resting state that s high with pulses that drop low The ideal pause between servo pulses is 20 milliseconds but can be anything between 10 and 40 milliseconds...

Page 24: ...nough to cause an excessive load on the BASIC Stamp s regulator circuitry causing it to reset or behave erratically For Mini Sumo competition precise speed control is not a requirement The goal is to...

Page 25: ...de Main DO PULSOUT LMotor LStop stop left PULSOUT RMotor RStop stop right PAUSE 20 LOOP END Move the SumoBot power switch to position 2 and then download the code using the Run command from the Run me...

Page 26: ...me to test the SumoBot for essential motion control Load the following program into the BASIC Stamp Editor and then download it to the SumoBot SumoBot_2 2_Motor_Test BS2 STAMP BS2 PBASIC 2 5 I O Defin...

Page 27: ...utputs LOW RMotor PAUSE 2000 time to disconnect cable Program Code Main FOR pulses 1 TO 65 fwd slow 12 inches PULSOUT LMotor LFwdSlow PULSOUT RMotor RFwdSlow PAUSE 20 NEXT FOR pulses 1 TO 30 pivot 90...

Page 28: ...This program code starts as well coded programs do by defining connection and value constants used in the program This methodology creates programs that are easier to read maintain and debug In the ca...

Page 29: ...tructed using a FOR NEXT control loop to give the motors enough time to perform the actual movements You may notice that the SumoBot does not move precisely as the code dictates that it should Do not...

Page 30: ...Mini Sumo Robotics Figure 2 6 BASIC Stamp Editor with SumoBot_ 2 2_Motor_Test BS2 Note The figure above shows the edit window set to split pane mode so that two sections of the program may be viewed...

Page 31: ...that your SumoBot travels straight at low and high speeds 2 Determine the proper loop count to cause the SumoBot to turn 30 degrees 45 degrees and 90 degrees 3 Using the information in 2 above see if...

Page 32: ......

Page 33: ...very low when the QTI is over the white border Tawara the reflectivity is very high and will cause a different reading from the sensor Figure 3 1 shows the schematic for the Parallax QTI line sensor F...

Page 34: ...value When the QTI is positioned over the white border line the current flow through the phototransistor is high so the capacitor charge time is fast and RCTIME returns a small value Load and run pro...

Page 35: ...capacitor is fully discharged RCTIME makes the R line an input and allows the capacitor to begin to charge the plate connected to the R line will move toward Vss While the capacitor is charging the R...

Page 36: ...called from any point in the program The routine should also be developed to return either a True 1 or False 0 value if the QTI is over the Sumo ring border To see this in action load and run program...

Page 37: ...vate sensors HIGH RLinePwr HIGH LLineIn discharge caps HIGH RLineIn PAUSE 1 RCTIME LLineIn 1 lLine read left sensor RCTIME RLineIn 1 rLine read right sensor LOW LLinePwr deactivate sensors LOW RLinePw...

Page 38: ...er the index value of 1 is moved into lbLeft We could use an IF THEN ELSE coding technique to accomplish the same thing Left_Conv IF lLine 1000 THEN lbLeft 0 ELSE lbLeft 1 ENDIF As you can see using L...

Page 39: ...N Spin_Left IF lineBits 10 THEN Spin_Right IF lineBits 11 THEN About_Face and accomplishes the same objective With simple programs like this one using SELECT CASE is a clean solution As programs grow...

Page 40: ...left line sensor power LLineIn PIN 9 left line sensor input RLinePwr PIN 7 right line sensor power RLineIn PIN 8 right line sensor input StartLED PIN 0 display start delay Constants LFwdFast CON 1000...

Page 41: ...motor control temp VAR Byte EEPROM Data RunStatus DATA 00 run status Initialization Reset READ RunStatus temp read current status temp temp invert status WRITE RunStatus temp save for next reset IF te...

Page 42: ...OTO Main END Subroutines Read_Line_Sensors HIGH LLinePwr activate sensors HIGH RLinePwr HIGH LLineIn discharge caps HIGH RLineIn PAUSE 1 RCTIME LLineIn 1 lLine read left sensor RCTIME RLineIn 1 rLine...

Page 43: ...not start until five seconds after the command is given by the judge This code is very simple it lights the LED to show that the SumoBot is preparing to start and inserts a five second PAUSE At the en...

Page 44: ...Page 34 SumoBot Mini Sumo Robotics CHALLENGE YOURSELF 1 Experiment with the Spin_Left and Spin_Right routines so that the SumoBot generally moves toward the center after touching the border...

Page 45: ...car s headlights in several respects When the light from a car s headlights reflects off obstacles your eyes detect the obstacles and your brain processes them and makes your body guide the car accor...

Page 46: ...the 555 timer circuit is more complex and less functional than the circuit we will use in this and the next chapter For example the method of IR detection introduced here can be used for distance dete...

Page 47: ...he protective shell standoff and shield The purpose of this assembly is to prevent stray IR from falling directly onto the detector and causing a false positive reading Figure 4 1 IR LED Standoff and...

Page 48: ...that the 220 resistors are already built into the SumoBot PCB just plug in the IR emitters and your SumoBot will be ready When aligning the IR emitter headlights it s a good idea to angle them slight...

Page 49: ...rmal output state when it sees no IR signal is high logic 1 When the IR detector sees the 38 5 kHz harmonic sent by the IR LED its output will drop from high to low logic 0 Of course if the IR does no...

Page 50: ...n object or not If it bounces off an object and is seen by the IR detector the IR detector sends a low signal to I O pin LfIrIn Otherwise the IR detector sends a high signal to LfIrIn The bitwise inve...

Page 51: ...15 right IR LED output RtIrIn PIN 14 right IR sensor input Constants LFwdFast CON 1000 left motor fwd fast LFwdSlow CON 800 left motor fwd slow LStop CON 750 left motor stop LRevSlow CON 700 left moto...

Page 52: ...in left slow DEBUG HOME Scan Left CLREOL PULSOUT LMotor LRevSlow PULSOUT RMotor RFwdSlow PAUSE 20 GOTO Main Follow_Right spin right fast DEBUG HOME Follow Right CLREOL PULSOUT LMotor LFwdFast PULSOUT...

Page 53: ...s detected the SumoBot will go into scanning mode The code at Scan will look for the opponent in the last known direction held in the variable lastIr When a target is detected the SumoBot will move qu...

Page 54: ......

Page 55: ...tition The program in this chapter brings all the SumoBot robot s systems together and adds some intelligent control Start by adding a piezo speaker as shown in Figures 5 1 and 5 2 then load and run p...

Page 56: ...LFwdFast CON 1000 left motor fwd fast LFwdSlow CON 800 left motor fwd slow LStop CON 750 left motor stop LRevSlow CON 700 left motor rev slow LRevFast CON 500 left motor rev fast RFwdFast CON 500 rig...

Page 57: ...ad_Line_Sensors blackThresh lLine 10 rLine 10 LOW LMotor make more pins outputs LOW RMotor Start_Delay five second delay FOR temp 1 TO 5 HIGH StartLED show active PAUSE 900 INPUT StartLED blink each s...

Page 58: ...ulses 1 TO 30 turn around PULSOUT LMotor LFwdFast PULSOUT RMotor RRevFast PAUSE 20 NEXT lastIr 00 GOTO Lunge IR Processing Search_For_Opponent GOSUB Read_IR_Sensors If opponent is not in view scan las...

Page 59: ...t lastIR irBits GOTO Main Lunge locked on go get him FOR pulses 1 TO 25 PULSOUT LMotor LFwdFast PULSOUT RMotor RFwdFast GOSUB Read_Line_Sensors IF lineBits 11 THEN Match_Over in sight we re on the lin...

Page 60: ...modulate right IR LED irRight RtIrIn read input 1 target RETURN Creep_Forward FOR pulses 1 TO 20 PULSOUT LMotor LFwdSlow PULSOUT RMotor RFwdSlow PAUSE 20 NEXT RETURN HOW IT WORKS After the Reset code...

Page 61: ...gic previously developed will be used When the border is touched the lastIr variable is cleared so the SumoBot will move toward the center after turning in from the border The Search_For_Opponent rout...

Page 62: ...ake plenty of fresh batteries to each contest you participate in When fully assembled and loaded with batteries the SumoBot will weigh less than the 500 gram 17 6 oz limit imposed by standard Mini Sum...

Page 63: ...een LED 1 150 04710 470 ohm resistor 1 4 watt 2 900 00001 Piezo speaker 1 800 00016 Jumper wires bag of 10 1 550 27400 SumoBot Printed Circuit Board with BASIC Stamp 2 1 753 00001 Battery Pack with Ti...

Page 64: ...Page 54 SumoBot Mini Sumo Robotics 700 00015 Nylon washer 2 Miscellaneous 122 27400 SumoBot Manual 1 800 00003 Serial programming cable 1 27000 Parallax CD 1 700 00064 Parallax Screwdriver 1...

Page 65: ...dges will decide which team wins A single person can also compete with a Robot Sumo with the same rules that apply to teams Section 2 Requirements for the Ring Area Article 2 Definition of Ring Area T...

Page 66: ...re tube of 10 cm wide and 10 cm deep A robot can be of any height A robot must not be in such a design that its body will be physically separated into pieces when a match starts The robot with such a...

Page 67: ...by putting into a robot s body such devices as a jamming device 2 Do not use parts that could break or damage the Ring Do not use parts that are intended to damage the opponent s robot or its operator...

Page 68: ...was called for or lots were employed Section 5 Match Procedure Article 8 Start With the chief judge s instructions the two teams bow in the Outer Ring For example stand facing each other outside the...

Page 69: ...e 12 An extended match shall be for 3 minutes if called by the Judge Article 13 The following are not included in the time of the Match 1 The time elapsed after the chief judge announces Yuko and befo...

Page 70: ...ds with no progress being made If it is not clear if progress is being made or not the Judge can extend the time limit for a clinch or orbiting robots up to 30 seconds 5 2 Both robots move without mak...

Page 71: ...re than 30 seconds before resuming the match unless the Judge announces a time extension 2 3 Start operating the robot before the chief judge announces the start of the match for remote controlled rob...

Page 72: ...me should continue in case of injury or accident shall be decided by the judges and the Committee members The decision process shall take no longer than five minutes Article 24 Yuko Given to the Playe...

Page 73: ...body while the robot is in competition Section 13 Miscellaneous Article 28 Flexibility of Rules As long as the concept and fundamentals of the rules are observed the rules shall be so flexible that t...

Page 74: ......

Page 75: ...lose to the official dimension and can be used to create a suitable practice ring Mini Sumo Ring Specifications Diameter 77 cm 30 3 in Height 2 5 cm 1 in Surface Hard Rubber Colors o Ring Black o Shik...

Page 76: ......

Page 77: ...Appendix D SumoBot PCB Schematic Page 67 Appendix D SumoBot PCB Schematic...

Page 78: ...Mouser Electronics Authorized Distributor Click to View Pricing Inventory Delivery Lifecycle Information Parallax 27400 27402 122 27400...

Reviews: