Chapter 8: Robot Control with Distance Detection
· Page 273
Figure 8-3
Testing
Distance
Detection
Output
Examples
Keep in mind that these distance measurements are relative and not necessarily
precise or evenly spaced.
However, they will give the Boe-Bot a good enough sense of
object distance for following, tracking, and other activities.
√
Enter, save, and run TestLeftFrequencySweep.bs2.
√
Use a sheet of paper or card facing the IR LED/detector to test the distance
detection.
√
Start with the sheet very close to the IR LED, perhaps ¼ in (or 1 cm) away from
the IR LED. Your Zone in the Debug Terminal should either be 0 or 1.
√
Gradually move the sheet of paper away from the IR LED and make a note of
each distance that causes the zone value to get larger.
Zones 1-4
typically fall in the range of 6 to 12 in (15 to 30 cm) for the shielded LEDs with a 1
k
Ω
resistor. Older shrink wrap LED distances will be less. As long as objects can be
detected up to 4 in (10 cm) away, the experiments in this chapter will work. If the distance
detector range is less than that, which is likely if you have shrink wrapped IR LEDS, try
reducing your series resistance from 1 k
Ω
to 470
Ω
or 220
Ω
.
' -----[ Title ]--------------------------------------------------------------
' Robotics with the Boe-Bot - TestLeftFrequencySweep.bs2
' Test IR detector distance responses to frequency sweep.
' {$STAMP BS2} ' Stamp directive.
' {$PBASIC 2.5} ' PBASIC directive.