Datasheet

Navigating with Infrared Headlights • Chapter 7
Robotics with the BOE Shield-Bot 243
the left IR detector does see the table, but the right one does not. So the code makes the
robot turn left for 0.375 seconds with
maneuver(-200, 200, 375). This should make it
avoid a drop-off that must have been detected on the right.
In response to
else if (irRight == 0), FastIrRoaming turns left for 20 ms, taking an
incremental step toward avoiding an obstacle on the right. At this point in the
if…else
if…else statement, we know that the right IR detector does see an object, but the left one
does not. Again, that’s because, it would have handled the condition where both IR detectors
see the table with the first if statement. So, the left IR detector does not see the object and
turns right for 0.375 seconds with
maneuver(200, -200, 375).
Your Turn
The 375 ms turns to avoid the table edge can be adjusted for different applications. For
example, if the BOE Shield-Bot is supposed to hug the edge of the table, smaller turns might
be useful. In a contest where the BOE Shield-Bot is supposed to push objects out of an area, a
larger turn (but not too large) would be better so that it zigzags back and forth across the
table.
You can modify the code to make shallower turns by using a smaller
msTime parameter
value in the
maneuver function calls. For example, if you change the 375
in
maneuver(-200, 200, 375) to 300, it will make shallower left turns. If you change it to
450, it will make sharper left turns.
Modify AvoidTableEdge so that it closely follows the edge of the simulated drop-
off course. Adjust the
msTime parameter values in calls to maneuver to make the
BOE Shield-Bot execute smaller turns when it sees the drop-off. How small can
you make the turn before it tries to fall off?
Experiment with pivoting away from the table edge to make the BOE Shield-Bot
roam inside the perimeter instead of following the edge.
Chapter 7 Summary
This chapter focused on using a pair of infrared LED emitters and receivers to broadcast and
detect reflections of 38.5 kHz modulated infrared light. Using this sensor system for robot
navigation used these concepts and skills:
Electronics
What an infrared LED is, and how to identify its anode and cathode
What a modulated infrared receiver is, and how to use it in a microcontroller
circuit
What effect resistor values have on LEDs when connected in series