Projects with Blocks·Tutorial 4 of 5

Line Follower

Advanced

Program your robot to follow a dark line on a light surface using the two TCRT5000 line sensors. The robot steers by adjusting motor speeds based on which sensor detects the line.

35 min5 steps
Line SensorMotorsSteeringRobotProjectAdvanced
0 of 5 steps

Step 1 of 5

Connect your board

Power on your Beaver Board — the OLED will show a PIN code. Click Connect in the toolbar, choose Connect via Bluetooth, and select your board. If it's your first time, enter the PIN shown on the screen.

The line sensors point downward from the chassis — left on GP4, right on GP5. Place the robot on the floor over your line track.

Make a test track with black electrical tape on white paper or card. Curves should be gentle — tight corners can confuse the sensors. Aim for a loop about 50 cm wide.