PCB and I recommend using one of the cut
resistor leads for it. The IREDs and
phototransistors are not flush to the PCB.
Instead, they stand above it. Their exact
height is not critical, but half an inch is
sufficient. Watch their polarities though;
the line follower will not work if they are
soldered to the PCB in reverse.
After soldering the line follower, cover
the IREDs and phototransistors with a short
length of plastic tube (1/2 inch long). To
keep the tube in place over them, I either put
a drop of hot glue on them or wrap them
with a thin strip of tape before sliding the tubing
over. Remember how you soldered the IREDs and
phototransistors standing above the PCB? That’s
so you can bend them towards each other until
they aim at the same spot on the ground. Once
properly aligned, I often put some hot glue
around them to hold them in position.
There are three mounting holes in the line
follower PCB (they’re the black circles in the parts
placement diagram). Some #2-56 hardware and spacers are
all that is needed to mount the PCB to the robot’s nose.
Alternatively, you could use a sheet of Foamies in place of
Use the following code to check the quality of the
alignment between the IRED-phototransistor pairs as you
tweak them. When properly aligned, Pin0 and Pin1 will be
0 when there’s a white space beneath them, and a 1 when
there is a black space beneath them.
A line follower board in its native habitat, at the bottom of a robot’s nose.
Parts placement for the CheapBot line follower.
B0 = PIN0
B1 = PIN1
Sertxd (“Pin0: “, #B0, “ Pin1: “, #B1, CR)
Line Follower Sample Code
Here’s an example of the code that will make a
CheapBot- 14 robot follow a line and then stop when it
reaches the “T” at the end:
It’s pretty simple. The 330 ohm resistors set the brightness
of the IREDs, and the 47K pull-up resistors limit the current
flowing through the phototransistors (if they conduct)
or through the I/O pins of the robot controller (if the
phototransistors aren’t conducting).
IF Detectors = 0 THEN Check_Line_Follower
IF Detectors = 1 THEN Line_Right
IF Detectors = 2 THEN Line_Left
Detectors = 0
RightDetect = PIN0
LeftDetect = PIN1
This proximity detector is based on a design in the
book Mobile Robots by Jones, Seiger, and Flynn (1999).
SERVO 08.2009 53