Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Line-Following Robot

A compact, beginner-friendly line-following robot project maintained by the Cicuitology Club. This repository contains code, wiring guidance, and assembly notes for building a simple robot that follows a high-contrast path using infrared reflectance sensors and basic PID control.

Features

  • Simple, well-documented Arduino/C++ code for line following
  • Sensor calibration and tuning guidance
  • Wiring diagrams and recommended parts list
  • Tips for improving reliability and speed

Hardware (suggested)

  • Microcontroller: Arduino Uno / Nano or compatible
  • Motors: 2 DC gear motors with motor driver (L298N, TB6612, or similar)
  • Sensors: 3 or 5 IR reflectance sensors (e.g., QTR-1A / QTR-8A) or TCRT5000 modules
  • Power: 6V–7.4V battery pack (NiMH or 2S LiPo with regulator)
  • Chassis: small robot chassis with caster or ball wheel
  • Misc: jumper wires, screws, breadboard or PCB mount, battery connector

Wiring Overview

  • Connect left and right motors to the motor driver outputs.
  • Connect motor driver inputs to two PWM-capable pins on the Arduino for speed control, plus two digital pins for direction if needed.
  • Connect the IR sensors' VCC to 5V, GND to GND, and sensor outputs to Arduino analog/digital pins as used in the code.
  • Power the motors from the battery via the motor driver VIN; keep Arduino powered via USB or a regulated 5V supply (do not power the Arduino 5V from an unregulated battery).

Refer to the Line_Following_Code folder for the exact pin mapping used in the example sketches.

Software / Code

The repository includes a Line_Following_Code directory containing Arduino sketches and helper libraries. The example sketch implements a basic line-following algorithm using sensor readings and a corrective steering term (P or simple PID).

Build & Upload

  1. Open the Arduino IDE (version 1.8+ or Arduino CLI).
  2. Open the main sketch from Line_Following_Code.
  3. Select the correct board and serial port.
  4. Upload the sketch.

For Arduino CLI:

arduino-cli compile --fqbn arduino:avr:uno ./Line_Following_Code/YourSketch
arduino-cli upload -p COM3 --fqbn arduino:avr:uno ./Line_Following_Code/YourSketch

Replace YourSketch with the sketch folder name and COM3 with your port.

Calibrating Sensors

  • Place the robot over the line and run the calibration routine (if included) to read min/max sensor values.
  • Use averaged readings and adjust thresholds used by the control algorithm.
  • Tune the proportional (P) or PID gains incrementally: increase P until oscillation, then add small I/D terms if needed.

Troubleshooting

  • Robot veers off: verify sensor voltages and wiring, check sensor height above surface (≈3–6 mm), and ensure good contrast between line and background.
  • Motor jitter: add small delay or smoothing to PWM updates, check motor driver current limits, ensure solid power supply.
  • Inconsistent readings: clean sensors, ensure stable lighting or use IR modules less sensitive to ambient light.

Project Structure

  • Line_Following_Code/ — Arduino sketches and libraries
  • Line Following Guide.pdf — design/assembly guide (if present in repo)

Contributing

Contributions, improvements, and documentation fixes are welcome. Please open issues for bugs or feature requests and submit pull requests for code changes.

License

This project is open — please add a LICENSE file to specify the preferred license (MIT, Apache-2.0, etc.).

Contact

Maintained by the Cicuitology Club. For questions, open an issue or contact the repository administrators.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages