Wiki source code of Tracker ver 3.0 Manual
Last modified by Eric Nantel on 2023/02/08 13:43
Show last authors
| 1 | {{html wiki="false" clean="true"}} |
| 2 | <body> |
| 3 | |
| 4 | <div id="container"> |
| 5 | <p align="center"><span class="headlg">Tracker ver 3.0 Manual.</span> |
| 6 | </p><p align="center">Author: Jim Frye<br> |
| 7 | Date: <!--webbot bot="Timestamp" s-type="EDITED" s-format="%B %d, %Y" startspan -->October 20, 2009<!--webbot bot="Timestamp" i-CheckSum="31103" endspan --></p> |
| 8 | <table border="0" width="100%"> |
| 9 | <tbody><tr> |
| 10 | <td width="50%" align="center"><span class="headmd">Table of Contents</span></td> |
| 11 | <td width="50%" align="center"><span class="headmd">Links</span></td> |
| 12 | </tr> |
| 13 | <tr> |
| 14 | <td width="50%"> |
| 15 | <ul class="toc"> |
| 16 | <li><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#trackerlay">Tracker</a> |
| 17 | <ul class="toc"> |
| 18 | <li class="toc"><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#trackerfeat">Mounting the Tracker Sensor</a></li> |
| 19 | <li class="toc"><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#testing">Testing the Tracker Sensor</a></li> |
| 20 | </ul> |
| 21 | </li> |
| 22 | <li><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#usingtrack">Using the Tracker</a> |
| 23 | <ul class="toc"> |
| 24 | <li class="toc"><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#theory">The Theory</a></li> |
| 25 | <li class="toc"><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#course">Making a Course</a></li> |
| 26 | <li class="toc"><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#moreinfo">Additional Information</a></li> |
| 27 | </ul> |
| 28 | </li> |
| 29 | <!--<li><a href="#trouble">Troubleshooting</a> |
| 30 | <ul class="toc"> |
| 31 | <li class="toc"><a href="#gentroub">General Troubleshooting</a></li> |
| 32 | </ul> |
| 33 | </li>--> |
| 34 | <li><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#program">Programming Examples</a> |
| 35 | <ul class="toc"> |
| 36 | <li class="toc"><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#bs2_01">Basic Stamp 2: Simple</a></li> |
| 37 | <li class="toc"><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/#bs2_02">Basic Stamp 2: Advanced</a></li> |
| 38 | </ul> |
| 39 | </li> |
| 40 | </ul> |
| 41 | </td> |
| 42 | <td width="50%" valign="top"> |
| 43 | <ul class="toc"> |
| 44 | <li><a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/WebHome/tra01v7.pdf" target="_blank">Tracker Schematic (pdf)</a></li> |
| 45 | </ul> |
| 46 | </td> |
| 47 | </tr> |
| 48 | </tbody></table> |
| 49 | <hr width="95%" color="#808080"> |
| 50 | <p align="center"><span class="headmd"><a name="trackerlay">Tracker.</a></span></p> |
| 51 | <p><img border="0" src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/WebHome/trackm01.gif" width="477" height="800"></p> |
| 52 | <p><span class="headsm"><a name="trackerfeat">Mounting the Tracker Sensor</a></span></p> |
| 53 | <p>The sensor can be mounted the the underside of a robot chassis toward the front of the vehicle. Position the sensor close to the floor with the |
| 54 | red LEDs facing up. The sensor will operate in an extremely wide range from about 0.5" from the floor to almost touching the surface. The |
| 55 | sensor appears to be immune to normal ambient lighting, although it may be necessary to shield the sensor from extremes.</p> |
| 56 | <p><img border="0" src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/WebHome/trackm02.jpg" width="400" height="300"></p> |
| 57 | <hr width="95%" color="#808080"> |
| 58 | <p><span class="headsm"><a name="testing">Testing the Tracker Sensor</a></span></p> |
| 59 | The sensor can easily be tested by following this simple step-by-step procedure. |
| 60 | <ol> |
| 61 | <li>Prepare a test bed using a sheet of white paper and a short section of black electrical tape.</li> |
| 62 | <li>Apply a regulated 5vdc to the red wire and ground to the black wire.</li> |
| 63 | <li>Hold the sensor about 0.25" above the white paper and notice the red LEDs turn on. If not, quickly remove power and double-check your |
| 64 | wiring.</li> |
| 65 | <li>Move the sensor over the electrical tape positioning each of the three IR sensor pairs over the tape one at a time. You will notice the LED |
| 66 | that's positioned over the tape go out and come back on as it's moved back to the white section of the paper.</li> |
| 67 | <li>You can connect the outputs to a microcontroller to test them, or just connect the outputs to a volt meter. Each output will go high when |
| 68 | positioned over white, and low when positioned over black.</li> |
| 69 | </ol> |
| 70 | <hr width="95%" color="#808080"> |
| 71 | <p align="center"><span class="headmd"><a name="usingtrack">Using the Tracker</a></span></p> |
| 72 | <p><span class="headsm"><a name="theory">The Theory</a></span></p> |
| 73 | <p>The theory behind line tracking is actually pretty simple. An infrared LED is paired with an infrared detector. The LED is illuminated and |
| 74 | directed to the surface where the line is to be detected. The detector is biased on and fed into a comparator to clean up the signal.</p> |
| 75 | <p>In order to keep the electronics as simple as possible a 74HC14 Schmidt-trigger hex inverter will replace the comparator circuitry. The very high |
| 76 | input impedance, built in hysteresis and low parts count makes the CMOS version an excellent alternative.</p> |
| 77 | <p><span class="headsm"><a name="course">Making a Course</a></span></p> |
| 78 | <p>Here is a list of the verified materials that can be used to make a line tracking course. I am sure with experimentation, other materials can be |
| 79 | used with equally successful results.</p> |
| 80 | <ul> |
| 81 | <li>Black electrical tape on white or light colored floor tile</li> |
| 82 | <li>Black electrical tape on white 3mm Sintra PVC. A 4x8' sheet can be cut into 32 12" square panels. Each panel can have a straight or |
| 83 | turning pattern, so the course can be changed. A radius of 6" can easily be made. This combination makes a great, durable, portable, and |
| 84 | re-configurable line tracking course.</li> |
| 85 | <li>Black Sharpie marker on end rolls of newsprint or butcher paper. With this material the course can be made as long as needed. Use this for |
| 86 | line tracking dragsters.</li> |
| 87 | </ul> |
| 88 | <p><span class="headsm"><a name="moreinfo">Additional Information</a></span></p> |
| 89 | <p>The programming is very simple. The outputs go low when the LED/IR Detector pair is positioned over a black surface, and high when positioned |
| 90 | over a white surface. Check for detection of a line. If the center surface sees the line, go forward. If the left sensor sees the line, turn left. |
| 91 | If the right sensor sees the line, turn right. You will want the robot to remember which sensor saw the line last and continue to make corrections |
| 92 | in order to negotiate turns where the line will be out of the sensors' view for a limited amount of time. I have included some sample files for the |
| 93 | Basic Stamp. There is even some code that can handle a search for the line if it loses it completely. Experiment with the code and have fun.</p> |
| 94 | <p><img border="0" src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/servo-erector-set-system/ses-electronics/ses-sensors/tracker-v3.0/WebHome/trackm03.jpg" width="400" height="300"></p> |
| 95 | <!--<hr width="95%" color="#808080"> |
| 96 | <p align="center"><span class="headmd"><a name="trouble">Troubleshooting</a></span></p> |
| 97 | <p><span class="headsm"><a name="gentroub">General Troubleshooting</a></span></p> |
| 98 | <p>[Copied from Bot Board page:] The green power (PWR) LED should glow if the regulator is getting the proper power. You must make sure to connect |
| 99 | the battery or wall pack with the proper polarity. This means the red wire is positive (+) and the black wire is ground (-). <font color="#FF0000">If |
| 100 | you connect the battery or wall pack with the polarity reversed, the regulator and the microcontroller can be instantaneously and permanently |
| 101 | damaged!</font> Check your wiring carefully before applying power.</p> |
| 102 | <p>The maximum voltage for VL is 9.6vdc. If you use a higher voltage the regulator may overheat and you could get burned!</p> |
| 103 | <p>Orient the microcontroller with its Pin 1 oriented toward the arrow by the Reset button. If the microcontroller is installed backwards it will |
| 104 | not be damaged by the Bot Board, but it will not be recognized by the IDE.</p>--> |
| 105 | <hr width="95%" color="#808080"> |
| 106 | <p align="center"><span class="headmd"><a name="program">Programming Examples</a></span></p> |
| 107 | <p><span class="headsm"><a name="bs2_01">Basic Stamp 2: Simple Line Following</a></span></p> |
| 108 | <div class="code"> |
| 109 | <p>'program: ltrack1.bas<br> |
| 110 | 'This program does simple line following. |
| 111 | </p><p>symbol error_level = b0<br> |
| 112 | symbol left_sensor = pin5<br> |
| 113 | symbol center_sensor = pin6<br> |
| 114 | symbol right_sensor = pin7<br> |
| 115 | low 0 'Left Servo<br> |
| 116 | low 1 'Right Servo</p> |
| 117 | <p>start: 'Line seen, correct direction<br> |
| 118 | if left_sensor = 0 then a<br> |
| 119 | if right_sensor = 0 then b<br> |
| 120 | if center_sensor = 0 then c<br> |
| 121 | 'Line not seen, do last action<br> |
| 122 | if error_level = 1 then a<br> |
| 123 | if error_level = 2 then b<br> |
| 124 | if error_level = 3 then c<br> |
| 125 | goto start</p> |
| 126 | <p>a: error_level = 1<br> |
| 127 | pulsout 0,150 'Left wheel stop<br> |
| 128 | pulsout 1,200 'Right wheel forward<br> |
| 129 | pause 10<br> |
| 130 | goto start</p> |
| 131 | <p>b: error_level = 2<br> |
| 132 | pulsout 0,200 'Left wheel forward<br> |
| 133 | pulsout 1,150 'Right wheel stop<br> |
| 134 | pause 10<br> |
| 135 | goto start</p> |
| 136 | <p>c: error_level = 3<br> |
| 137 | pulsout 0,200 'Left wheel forward<br> |
| 138 | pulsout 1,200 'Right wheel forward<br> |
| 139 | pause 10<br> |
| 140 | goto start</p> |
| 141 | </div> |
| 142 | <p><span class="headsm"><a name="bs2_02">Basic Stamp 2: Advanced Line Following</a></span></p> |
| 143 | <div class="code"> |
| 144 | <p>'program: ltrack2.bas<br> |
| 145 | 'This program does advanced line<br> |
| 146 | 'following. If it loses the line it will<br> |
| 147 | 'do a search for it.</p> |
| 148 | <p>symbol x = b0<br> |
| 149 | symbol y = b1<br> |
| 150 | symbol correct = b2<br> |
| 151 | symbol lost = b3<br> |
| 152 | symbol left = pin5<br> |
| 153 | symbol center = pin6<br> |
| 154 | symbol right = pin7<br> |
| 155 | low 0 'Left Servo<br> |
| 156 | low 1 'Right Servo<br> |
| 157 | lost = 1<br> |
| 158 | correct = 1</p> |
| 159 | <p>'Line seen, correct position<br> |
| 160 | start:<br> |
| 161 | if right = 0 then on_trac_right<br> |
| 162 | start1:<br> |
| 163 | if left = 0 then on_trac_left<br> |
| 164 | start2:<br> |
| 165 | if center = 0 then on_trac_center</p> |
| 166 | <p>'Line not seen, do last action<br> |
| 167 | lost = lost + 1<br> |
| 168 | if lost = 40 then find_line<br> |
| 169 | if correct = 1 then off_trac_center<br> |
| 170 | if correct = 2 then off_trac_left<br> |
| 171 | if correct = 3 then off_trac_right<br> |
| 172 | goto start</p> |
| 173 | <p>on_trac_center:<br> |
| 174 | correct = 1<br> |
| 175 | lost = 0<br> |
| 176 | gosub forward<br> |
| 177 | goto start<br> |
| 178 | on_trac_left:<br> |
| 179 | correct = 2<br> |
| 180 | lost = 0<br> |
| 181 | gosub left_turn<br> |
| 182 | goto start1<br> |
| 183 | on_trac_right:<br> |
| 184 | correct = 3<br> |
| 185 | lost = 0<br> |
| 186 | gosub right_turn<br> |
| 187 | goto start2</p> |
| 188 | <p>off_trac_center:<br> |
| 189 | correct = 1<br> |
| 190 | gosub forward<br> |
| 191 | goto start<br> |
| 192 | off_trac_left:<br> |
| 193 | correct = 2<br> |
| 194 | gosub left_turn<br> |
| 195 | goto start<br> |
| 196 | off_trac_right:<br> |
| 197 | correct = 3<br> |
| 198 | gosub right_turn<br> |
| 199 | goto start</p> |
| 200 | <p>find_line:<br> |
| 201 | for x=1 to 50<br> |
| 202 | gosub look<br> |
| 203 | gosub left_spin<br> |
| 204 | next<br> |
| 205 | for x=1 to 100<br> |
| 206 | gosub look<br> |
| 207 | gosub right_spin<br> |
| 208 | next<br> |
| 209 | for x=1 to 50<br> |
| 210 | gosub look<br> |
| 211 | gosub left_spin<br> |
| 212 | next<br> |
| 213 | for x=1 to 50<br> |
| 214 | gosub look<br> |
| 215 | gosub forward<br> |
| 216 | next<br> |
| 217 | goto find_line</p> |
| 218 | <p>look:<br> |
| 219 | if right = 0 then start<br> |
| 220 | if left = 0 then start<br> |
| 221 | if center = 0 then start<br> |
| 222 | return</p> |
| 223 | <p>forward:<br> |
| 224 | pulsout 0,200 'Left wheel forward<br> |
| 225 | pulsout 1,200 'Right wheel forward<br> |
| 226 | pause 10<br> |
| 227 | return</p> |
| 228 | <p>left_turn:<br> |
| 229 | pulsout 0,150 'Left wheel stop<br> |
| 230 | pulsout 1,200 'Right wheel forward<br> |
| 231 | pause 10<br> |
| 232 | return</p> |
| 233 | <p>right_turn:<br> |
| 234 | pulsout 0,200 'Left wheel forward<br> |
| 235 | pulsout 1,150 'Right wheel stop<br> |
| 236 | pause 10<br> |
| 237 | return</p> |
| 238 | <p>left_spin:<br> |
| 239 | pulsout 0,100 'Left wheel reverse<br> |
| 240 | pulsout 1,200 'Right wheel forward<br> |
| 241 | pause 10<br> |
| 242 | return</p> |
| 243 | <p>right_spin:<br> |
| 244 | pulsout 0,200 'Left wheel forward<br> |
| 245 | pulsout 1,100 'Right wheel reverse<br> |
| 246 | pause 10<br> |
| 247 | Return</p> |
| 248 | </div> |
| 249 | </div> |
| 250 | </body> |
| 251 | {{/html}} |

