Line Follower Robot with PID Controller

An autonomous line-following robot using TCRT-5000 IR sensors and PID control, built on Arduino for robotics competitions and education.

Overview

An autonomous robot that follows a predefined line path using TCRT-5000 IR sensors and a PID (Proportional–Integral–Derivative) control algorithm. Developed in two hardware versions with increasing complexity, it was used in inter-university robotics competitions and engineering education projects at KUET.

Features

  • Line following on black-on-white and white-on-black surfaces
  • PID-based speed and direction control for smooth cornering
  • Obstacle detection via ultrasonic sensor
  • Two hardware versions: v1 (basic differential drive), v2 (with tuned PID)

Tech Stack

Arduino Uno / Mega C++ TCRT-5000 IR Sensors L298N Motor Driver Ultrasonic Sensor PID Control

Hardware

Component Role
Arduino Uno Central microcontroller
TCRT-5000 IR sensor array (5-channel) Line detection
L298N H-bridge motor driver DC motor control
DC gear motors (×2) Drive wheels
Ultrasonic sensor (HC-SR04) Obstacle avoidance
7.4 V LiPo battery Power supply

The PID gains (K_p, K_i, K_d) were manually tuned on a test track to achieve smooth, stable tracking at moderate speed. The derivative term dampens oscillations at sharp curves, while the integral term corrects accumulated line-offset error on straight sections.

View on GitHub   Demo Video