Back to Projects

Line-Sensing Robot

Arduino line-follower with four IR reflectance sensors, motor shield, and live serial tuning

ArduinoPythonEmbedded Systems

Overview

A four-sensor line-following robot using an Adafruit motor shield and bang-bang hierarchical controller. Per-sensor threshold calibration, modular 3D-printed sensor mounts, and a serial interface for live speed tuning.

Specs

  • Sensors: Four TCRT5000 reflectance sensors, individually calibrated with per-sensor thresholds
  • Control: Hierarchical bang-bang logic (sharp/gentle turns, on-center) with LastTurnDirection recovery
  • Prototype features: Modular sensor mounts, serial speed tuning, and data logging for analysis

Calibration & Control

Each sensor was profiled on tape vs floor and thresholds set (left sensors ≈ 800, right sensors ≈ 710). The controller maps boolean sensor states into prioritized actions (u-turn, sharp, gentle corrections, or recovery), and logs time-stamped CSV data for offline analysis and plotting.

Implementation

  • Hardware: Arduino Uno, Adafruit v2 Motor Shield, two DC gearmotors, four TCRT5000 sensors
  • Software: Arduino controller with serial command 'sNNN' to update baseSpeed live; CSV logging of timestamps, sensor values, and motor commands
  • Mechanical: Iterative 3D-printed sensor mounts and optional housing (removed for performance during testing)

Project Media

Front view of the line-sensing robot showing the four IR sensor array and motor shield
Front view of the completed robot showing the four TCRT5000 IR reflectance sensors mounted at the leading edge, with the Adafruit v2 motor shield visible on the Arduino stack above.
Top view of the line-sensing robot showing wiring layout and component arrangement
Top-down view of the robot chassis showing the wiring layout, Arduino + motor shield stack, and the overall component arrangement used during testing and tuning sessions.
3D render of the modular sensor mount bracket designed for the TCRT5000 sensors
CAD render of the modular 3D-printed sensor mount bracket, designed to position the four TCRT5000 sensors at a consistent height and spacing above the track surface for reliable reflectance readings.
Circuit diagram or wiring schematic for the line-sensing robot
Circuit diagram showing the electrical connections between the Arduino, Adafruit motor shield, TCRT5000 sensors, and DC gearmotors, including pull-up resistor values used for analog threshold calibration.
Line-sensing robot navigating a closed-loop track, demonstrating the hierarchical bang-bang controller transitioning through sharp turn, gentle correction, and on-center modes in real time.

Documents

📄 PIE Mini Project 3 Report (PDF)
Full project report covering the line-sensing robot's hardware design, sensor calibration procedure, bang-bang control logic, and logged performance data from track testing.

Tools & Methods

ArduinoPython