This project documents a modular robot controller built for the Arduino GIGA R1 WiFi, powering Obsidian - a tracked rover on the DFRobot Black Gladiator chassis.
The controller supports line following, wall following, and transition behaviours using a PID-based control system and modular sensor logic.
Obsidian successfully demonstrated in the 2025 UCL Robotics competition (UCL East), completing line and wall-following challenges under real-world conditions.
| Front View | Side View |
|---|---|
![]() |
![]() |
The Rover Controller is a flexible robotics framework written in C++ for Arduino.
- PID line following with dual QTR sensor arrays
- Wall following & cornering with 5 IR distance sensors
- Modular codebase (sensors, PID, behaviour logic in independent classes)
- Branch-based behaviours:
main(line following),dist(wall following),test/obst(legacy)
- Arduino GIGA R1 WiFi
- 2× Pololu Motoron I2C motor drivers
- Dual QTR-9A reflectance sensor arrays
- 5× Sharp IR analog distance sensors (LF, LB, CF, RF, RB)
- 2 DC motors + optional hook actuator
- 10.9V battery pack
| Component | Pins |
|---|---|
| QTR Left | Digital 40-48 |
| QTR Right | Digital 24-32 |
| QTR LEDs | 22 (right), 38 (left) |
| Distance Sensors | A2-A6 |
| Button | 23 (pull-up input) |
| Motoron Drivers | I2C0 + I2C1 |
- Clone repo and select branch (
main= line following,dist= wall following). - Open
rover_controller.inoin Arduino IDE. - Select Arduino GIGA R1 WiFi board.
- Upload firmware and open Serial Monitor (115200 baud).
pid_controller.cpp/h-> Generic PID module (reusable across robots)QTRSensorArray.cpp/h-> Normalised reflectance sensor handlingdistance_sensor.cpp/h-> IR distance sensing + filteringwifi_logic.cpp/h-> Optional UDP control interface
Line Following (main branch):
- Dual QTR arrays sample at 100 Hz -> normalised position -> PID correction -> motor control
- Triple-line detection triggers transitions (e.g. hook raise)
Wall Following (dist branch):
- 5 IR sensors provide lateral + angular errors
- Two PID loops (distance & angle) combined for stable wall tracking
- Corner detection (centre sensor + low angle error) triggers 90° turn manoeuvre
- PID gains adjustable per module (
PIDController pid(Kp, Ki, Kd);) - Thresholds (
line_threshold,confidence) for sensor reliability - Easily extend transition logic (e.g. custom hook activation on marker detection)
Line Sensors:
qtrL.calibrate_time(3000);
qtrR.calibrate_time(3000);Sweep across surface to capture min/max reflectance.
Distance Sensors:
Built-in smoothing & validation; no manual calibration required.
MIT License
Kishan Grewal
GitHub: github.com/kishan-grewal


