Attaching the Line-Detecting Sensor

Cut a 3 cm piece from the aluminum pipe. To make sure that the pipe does not short-circuit the sensor, we’ll put a round piece of felt pad on the other end. Make a hole in the felt pad so that you can push the screw easily through it (Figure 1-12).

3 cm piece of aluminum pipe for the line-detecting sensor and a felt pad to prevent short circuits

Figure 1-12. 3 cm piece of aluminum pipe for the line-detecting sensor and a felt pad to prevent short circuits

Put a 3x42 mm screw through the pipe and secure the line detector in the front of the robot (Figure 1-13). The emitter/receiver part of the sensor has to be facing down.

Line-detecting sensor attached

Figure 1-13. Line-detecting sensor attached

Tip

How does the line-detecting sensor work? It has a infrared emitter and a infrared detector. Reflective surfaces bounce the infrared light back to the infrared detector. So we know there is no line. This does not happen with nonreflective surface, such as a black line. Generally reflective surfaces are white and nonreflective ones are black. Just keep in mind that this is not always the case. We have had black paper that was more reflective than our white tape. With three or more line-detecting sensors, you can make a line-following robot. Instead of just turning around like our robot, line followers try to keep the black line in the center sensor. If the side sensors detect the line, ...

Get Make a Mind-Controlled Arduino Robot now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.