
Page 4
The comparator will output will be high (1) or low (0), depending on which of the two input pins has the
higher voltage. If the minus input (voltage from IR detector) is higher than the plus input, the
comparator output will go low. If the plus input (threshold pot) is higher than the minus input, then the
output will go high. The purpose of the threshold potentiometer is to allow you to adjust for course
reflectivity and ambient lighting conditions.
When a detector “sees” a highly reflective surface, the current flow through the transistor is high so the
voltage goes low. If it falls below the threshold pot setting, the comparator will output a low (0). If the
detector is over a surface that absorbs the IR light from the LED, the current through the transistor will
be low, causing detector output voltage to increase. If the output voltage goes higher than the threshold
pot setting, the comparator will output a high (1).
In review, reflective surfaces will cause the Line Follower module to output a low (0); non-reflective
surfaces will output a high (1). We can modify this behavior with PBASIC code to suit the type of “track”
Important Note
: The IR LEDs are under direct control of the BASIC Stamp. It is the programmer’s
responsibility to ensure that only one LED is lit at a time. Allowing multiple LEDs to light will cause
inaccurate and unpredictable results. Figure 4 shows the connections between the BASIC Stamp and the
Line Follower module.
Figure 4: Line Follower Module Connections to the BASIC Stamp
LF Function
Stamp Pin
Direction
Outer Right LED
P2
Output
Inner Right LED
P3
Output
Center LED
P4
Output
Inner Left LED
P5
Output
Outer Left LED
P6
Output
Line Detect
P9
Input