Skip to content

kishan-grewal/rover-controller

Repository files navigation

Rover Controller - Complete How-To Guide

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.


Images

Front View Side View
Robot Front Robot Side

Demo Video

See Obsidian in action:
Watch on YouTube


Overview

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)

Hardware

  • 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

Wiring Summary

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

Software Setup

  1. Clone repo and select branch (main = line following, dist = wall following).
  2. Open rover_controller.ino in Arduino IDE.
  3. Select Arduino GIGA R1 WiFi board.
  4. Upload firmware and open Serial Monitor (115200 baud).

Code Architecture

  • pid_controller.cpp/h -> Generic PID module (reusable across robots)
  • QTRSensorArray.cpp/h -> Normalised reflectance sensor handling
  • distance_sensor.cpp/h -> IR distance sensing + filtering
  • wifi_logic.cpp/h -> Optional UDP control interface

Behaviour Logic

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

Tuning & Customisation

  • 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)

Calibration

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.


License

MIT License


Author

Kishan Grewal
GitHub: github.com/kishan-grewal

About

Term 3 group project: Arduino controller for a line-following, obstacle-avoiding rover using C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors