Experiment 4 Line Following

Share for us

Experimental Principle

The line follower module is an 8-channel IR sensor one. It will send different signals when it detects the black line and white surfaces. When a certain sensor detects a black line, the corresponding signal will be generated and then passed to the car, thus the car would turn its direction accordingly to follow the line by servo rotation.

Experimental Procedures

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


1. If the surrounding is too dark, you can turn on the LED built in the module as shown below (no need to turn on normally).

2. If the front wheels do not turn when you place the car above the black lines, but it does when the module is tilt closer to the line, in other words there signal of black line detection is too weak, just adjust the potentiometer below to try. Normally you don’t need to adjust.

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

It will stop when no black line is detected, so for better performance you can draw a closed path like a number 8-shaped route or a circle.