O'Reilly logo

Make a Mind-Controlled Arduino Robot by Kimmo Karvinen, Tero Karvinen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Line Avoidance

To make your bot stay in the arena, you must teach it to avoid a black line. Then you can build an arena with big white paper as the floor and black tape as the border.

Connect the Reflection Sensor

Let’s connect the reflection sensor to Arduino. Prepare the cable by cutting the end that doesn’t fit to the sensor. In our case, the small white connector fit to the sensor and we left it in place. The big black connector didn’t fit anywhere, so we cut it away. Strip the free wires for connecting to Arduino (Figure 2-6).

Stripped sensor wire

Figure 2-6. Stripped sensor wire

Connect free sensor wires to Arduino as shown in the circuit diagram for helloreflection.pde (Figure 2-7). Connect the red plus wire to +5V, and the black ground wire to GND. Connect the green data wire to D4. (Figure 2-8). Use the ScrewShield to keep the wires in place (Figure 2-9).

Circuit diagram for helloreflection.pde

Figure 2-7. Circuit diagram for helloreflection.pde

Reflection sensor connected

Figure 2-8. Reflection sensor connected

Free wires connected to Arduino with ScrewShield

Figure 2-9. Free wires connected to Arduino with ScrewShield

Hello Reflection

For line avoidance, we use a typical reflectivity sensor. We read it with Arduino’s

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required