Datasheet

Page 108ยท Applied Robotics with the SumoBot
With some creative programming, you can actually check as many QTIs as you want, and
it will only a fraction of the time that it takes to check just one QTI with the
RCTIME
command when it's detecting black. This activity will show you how.
The Pulse-Decay Trick
Figure 3-14 is a repeat of Figure 3-10, a schematic for what's happening inside the QTIs
after Vdd has been applied to its on/off input, P10.
Figure 3-14
Simplified Version of
the QTI circuit
Below is a routine that calibrates only the left QTI. After turning the device on by setting
P10 high, P9 is also set high, which pushes the value of V
0
toward 5 V. After a 1 ms
pause, the
RCTIME command measures the time it takes for V
0
to decay to 1.4 V. The
amount of time it takes gets stored in the
time variable. The threshold variable is set
equal to 1/4 the value of the
time variable.
HIGH 10
HIGH 9
PAUSE 1
RCTIME 9, 1, time
threshold = time / 4
The program could next use the RCTIME command and compare the decay time to the
threshold time. If the decay time is greater than the threshold time, the program can
assume the QTI is detecting black. If the decay time is less than the threshold time, the
program can assume the QTI is detecting white.