Experiment 3 Line Following

Share for us

This experiment adds five tracking modules to the first experiment to make the car follow the black line. After the assembly and circuits, you may wrap the wires up with the heat shrink tubing so the car can be lovelier in order with neat wiring.

The physical diagram of this experiment is as shown below:


-1 * Car model

-5 * Tracking module

-2 * 18650 battery

-1 * USB cable

– Serial Dupont wires

Experimental Principle

When one of the tracking module encounters a black line, the corresponding indicator will light up. The servo turns to the direction detected by the tracking module, and then the car will walk towards this direction.

Experimental Procedures

Step 1: Assemble Front Plate

1. Fasten the following acrylic plates with M3*12 screws and M3 nuts.   
2. After assembly, it is as shown below:  

Step 2. Connect 5 tracking modulesconnect GND of the 5 modules to GND, VCC to 5V, and D0 to A0-A4.

Tracking ModuleSensor Shield

1)     Connect the first tracking module:

2)     Connect the second tracking module:

3)     Connect the third tracking module:

4)     Connect the fourth tracking module:

5)     Connect the fifth tracking module:

Step 3The front plate is used to grab the sensors module.

1. Assemble the 5 tracking modules to the front plate with M3*8 screwsM3*20 copper standoffs, and M3*6 screws.     
2. After assembly, it is as shown below:     

Step 4. Mount the Front Plate to Car

1.Assemble the front plate to the car with M3*12 screws and M3 nuts   
2. After assembly, it is as shown below:   

The figure of completed assembly (no wire) is as shown below:

Connect the SunFounder Uno board to your computer. Download the sketch under the path Smart Car for Arduino\Code\3.Car_LineFollowing\Car_LineFollowing, and then remove the USB cable. Pressed the button on the switch module.


After you have finished all the connections, you need to adjust the sensitivity of the tracking module. You can draw a black line (it is better wider than or equally wide with the tracking module) on a white surface. Place the car on the white surface, and adjust the potentiometer on a tracking module. Then switch on the car.

If the following situation happens, the module is pretty sensitive: when the tracking module is over a white surface, the switch indicator will stay dim; once it encounters a black line, the LED will light up immediately, and go out the moment the module passes the black line. If the case is not like this, like the module being insensitive, spin the potentiometer in the opposite direction. In the same way, adjust the rest four tracking modules.

Now draw a black line on a large white board, and the car will go following the line.