An advanced line following robot with PID control




This tutorial details the process of building a line following robot. The robot can follow both black and white lines. It uses a sensor array to sense the line and a PID control to follow the line. With the help of a PID control the robot does not follow the line by oscillating to the left and to the right like conventional line followers but follows the line smoothly without wavering too much the left and right, conserving battery power while at the same time following the line much more faster.

Here is a video of the robot


Specifications and features


  • The robot can follow both black and white lines.
  • It has uses an 8 sensor array to follow the line.
  • It is controlled by an Atmega16 running at 1 MHz.
  • The program is written in C using WinAVR.
  • It has an average speed of 0.5 ms-1 and a top speed of almost 0.9 ms-1.
  • It is powered by 8 Ni-Mh batteries connected in series, giving around 9.5 – 10.5 V.
  • It uses PID control to follow the line.
  • A LCD screen on the robot outputs the values of the PID variables, speed, maximum and minimum speed, etc.


Note: This robot is aimed at intermediate robot builders who have built a robot or two and played quite a bit with microcontrollers. Building this robot will be quite a tough for a beginner, so if you have not built a robot before, try building the $40 robot, the $50 robot or any of the simple robots in the members tutorials section before trying to build this robot. I write this note because I have been getting a lot of mails from people who are trying to build this robot, without prior experience in robotics and have got stuck somewhere and have no clue about what is wrong or how to proceed.