This repository contains the firmware, hardware design (PCB), and mechanical files (3D) for an autonomous Line Follower Robot. The robot utilizes a PID (Proportional-Integral-Derivative) control algorithm to accurately follow tracks, including complex turns and dashed lines.
The project demonstrates a full-stack robotics implementation, encompassing custom PCB design in EasyEDA, 3D modeling in Fusion 360, and embedded C++ programming.
| 3D Design (Fusion 360) | Real Implementation |
|---|---|
![]() |
![]() |
| Designed in Fusion 360 | Final Assembly with Custom PCB |
Based on the final implementation design:
| Component | Specification | Function |
|---|---|---|
| Microcontroller | Arduino Nano (ATmega328P) | Central processing unit. |
| Motor Driver | L293D | Controls motor direction and speed via PWM. |
| Sensors | 3x Photodiodes + LED Superbright | Detects line contrast (Black/White). |
| Actuators | 2x DC Motors N20 (60 RPM) | Low RPM chosen for higher torque and stability. |
| Power System | Li-Po Battery + Step-Down Module | Regulated to 8V for safety and stability. |
| Interface | OLED Display + Buzzer + 5 Buttons | Used for debugging, PID tuning, and mode selection. |
| PCB Design | Custom Shield (EasyEDA) | Integrates driver, sensor ports, and UI buttons. |
The robot uses a closed-loop control system to correct path errors in real-time. The PID parameters were tuned specifically for the 60 RPM motors:
- Kp (Proportional):
17.0- Provides immediate reaction to the current error. - Ki (Integral):
0.4- Corrects accumulated past errors (steady-state error). - Kd (Derivative):
0.3- Dampens the oscillation to prevent overshooting.
// PID Configuration Snippet
lf.setPID(17.0, 0.4, 0.3);
lf.polaritasMotor(1, 0); // Adjust based on motor wiring direction
