Beginner4–6 h (estimate)9 parts

Line-follower robot

Two IR sensors, two motors and a proportional steering rule.

Overview

A small two-wheel robot follows a dark line on a light floor. Two downward-facing infrared reflectance sensors tell the microcontroller whether the line is under the left or right sensor, and the robot steers by driving its two wheels at different speeds (differential drive).

You start with simple on/off steering and then upgrade to proportional steering, the same idea as the P term in PID.

You will learn

  • · Reading digital sensor modules
  • · Driving DC motors through an H-bridge with PWM
  • · Differential-drive steering
  • · Turning a rule ("line is left → turn left") into a control loop

Parts list

Part (generic)QtyNote
Arduino Uno-compatible board (5 V logic)1
IR reflectance sensor module with digital output (TCRT5000-type)2
Dual H-bridge DC motor driver module (L298N-type or TB6612FNG-type)1
Small DC gear motor with wheel2
Caster wheel or ball caster1
Robot chassis plate (acrylic, plywood or 3D-printed)1
Battery pack for the motors (e.g. 4×AA or a 2-cell Li-ion pack with protection)1Match it to your motors and driver.
Jumper wires, small breadboard, on/off switchas needed
Black electrical tape (about 19 mm wide) for the track1 roll

Generic part names only. Pinouts and logic levels vary between modules of the same type, so check the documentation of the exact module you have.

Tools

  • · USB cable and the Arduino IDE
  • · Small screwdriver set
  • · Multimeter
  • · Double-sided tape or screws to mount parts

Safety

  • · Lift the wheels off the table for the first motor test.
  • · Never short Li-ion battery terminals; use a pack with protection and the right charger.
  • · Connect all grounds (battery, driver, board) together.

Learn the ideas first

Full build

  1. 01Build the chassis and mount the motors
  2. 02Wire the motor driver and test each wheel
  3. 03Mount and adjust the IR sensors
  4. 04Bang-bang (on/off) line following
  5. 05Proportional steering and speed tuning
  6. 06Make a test track and measure lap times

Checking your account…