Vision-based line following robot
← Back to Work GitHub →
Robotics · 2024

Vision-Based Line Following Robot

Autonomous robot that follows colored lines through a maze using a camera and real-time image processing — no dedicated color sensor.

Raspberry Pi OpenCV Picamera2 Differential Drive Computer Vision

This project built on an earlier line-following robot, replacing the dedicated color sensor with a camera-based vision system. The goal remained the same — navigate a maze with multiple colored lines and follow only the target path — but the sensing approach shifted entirely to real-time image processing.

The hardware used two DC motors driven by a Raspberry Pi via GPIO pins. A downward-facing camera captured live frames processed through OpenCV: grayscale conversion, Gaussian blur, and thresholding isolated the line, while contour detection identified the largest path region and computed its centroid.

Steering logic compared centroid position to the frame center — forward when centered, left or right when shifted, and a recovery behavior when no line was detected. All motion control including speed, direction, and continuous movement was programmed in Python using edge detection.

Hardware

  • Raspberry Pi
  • Picamera2
  • DC Motors
  • L298N Driver

Vision

  • OpenCV
  • Thresholding
  • Contour Detection
  • Centroid Tracking

Software

  • Python
  • GPIO Control
  • PWM Speed Control
  • Edge Detection

Robot navigating the colored line maze in real time.

Previous Project ← REMOTE NAVIGATION
Next Project COLOR SENSOR FOLLOWER →