Line Following Robot using IR Sensor – Programming

Line Following Robot
Lesson Details
How to program and debug a line follower robot?


  • Writing a program to detect a black line a white region using IR sensors and follow it.
Classroom Bundle Used: STEM Classroom Bundle, STEM Mini Classroom Bundle
Download Resources

Lesson Overview

  • In this activity, students will make a line following robot that will follow a black line in the white region using IR sensors.
  • During the activity, students will go through the following activities:
    • Logic
    • Programming of the robot
    • Calibration of sensors and debugging of the robot.

Material Required

1 set of the following material per group of 3-5 students:

Lesson Outline

Logic - 10 minutes

Discuss the logic behind the programming of the robot, like when should the robot do the following things:

  • Move forward
  • Move backward
  • Turn left
  • Turn right
  • Stop
Programming the robot - 30 minutes
Calibration and debugging of the robot - 20 minutes

Download Lesson Resources

Next Lessons