Michael Walshe
Autonomous buggy, full build
EMBEDDED SYSTEMS · CONTROL · ELECTRONICS · ARDUINO

Autonomous Buggy GROUP PROJECT

An autonomous two-wheel robotic vehicle combining embedded control, wireless communication, ultrasonic sensing, wheel-encoder feedback and closed-loop PID control — built for 2E10 Engineering Design IV at Trinity College Dublin.

ARDUINO UNO R4 WIFI C++ / ARDUINO · PROCESSING PID · WIFI · ULTRASONIC · ENCODERS GOLD CHALLENGE ✓
← Back to projects

Project Overview

Working as part of an engineering team, I helped develop an autonomous two-wheel robotic vehicle capable of navigating independently, detecting obstacles, measuring its own movement, and operating under closed-loop control.

The project progressed through three increasingly complex stages — Bronze, Silver and Gold — each adding further sensing, communication and control requirements. The brief called for a buggy that combines environmental sensors with a control system to interpret that data and act on it.

System Architecture

The Arduino Uno R4 WiFi sat at the centre of the system — its exposed I/O made it straightforward to wire in sensors on one side and motor control on the other, while its onboard WiFi handled communication back to a laptop.

Arduino Uno R4 WiFi
Sensor Inputs — Ultrasonic sensor · Wheel encoders
Control Logic — Navigation · Distance measurement · PID
Motor Driver / H-Bridge
Left + Right DC Motors
Fritzing circuit diagram for the autonomous buggy Full circuit — battery pack, CD4040 encoder counter, ultrasonic sensor, H-Bridge and both DC motors wired to the Uno R4.

Development

01 BRONZE ✓

Autonomous Navigation

Independent DC motor control combined with ultrasonic obstacle detection. The buggy could:

  • Navigate the course in both directions
  • Detect obstacles and stop before collision
  • Start and stop remotely
  • Communicate vehicle events wirelessly
02 SILVER ✓

Encoder-Based Positioning

Added wheel-rotation feedback — a CD4040 binary counter reading pulses from a hall-effect encoder, shifted out over a register the Arduino could read directly — to move from basic autonomous behaviour toward measurable, closed-loop-ready motion.

The spec called for an analogue wheel-rotation measurement to be checked against a digital Arduino reading before trusting encoder data to navigate the course.

03 GOLD ✓

Closed-Loop Control

The final stage introduced PID control, turning the buggy into a proper closed-loop system, with two modes:

  • Speed Control — hold a reference speed set via the GUI
  • Object Following — track an object at a safe, steady distance

Distance and event data were transmitted wirelessly throughout — the core requirement of the Gold Challenge.

The Control Loop

The Gold challenge's speed control ran off a simple PID loop, comparing a piecewise reference speed profile against the actual speed measured from the wheel encoder:

float Kp = 2.0;
float Ki = 0.3;
float Kd = 0.1;

float computePID(float ref, float actual, float dt) {
  error = ref - actual;

  integral += error * dt;
  float derivative = (error - prevError) / dt;

  float output = Kp * error + Ki * integral + Kd * derivative;

  prevError = error;
  return output;
}

int timePoints[] = {0, 10, 30, 40, 45};
int speedRefs[]  = {20, 30, 10, 20, 10};

Every run logged a mean-squared error between reference and actual speed, printed once the 60-second run finished — a straightforward way to quantify how well the controller was actually tracking, rather than just eyeballing it.

↓ Download the full sketch (.ino)

Engineering Highlights

Embedded Control

Arduino / C++ software integrating sensing, decision-making and motor actuation.

📡

Wireless Communication

WiFi link between the Uno R4 and a laptop-based control interface.

📏

Sensor Integration

Ultrasonic ranging and wheel-rotation feedback feeding autonomous behaviour.

🎛

PID Control

Closed-loop speed and following-distance control for the Gold Challenge.

🔌

Electronics

H-Bridge motor control plus supporting analogue and digital circuitry.

🖥

GUI Development

Processing-based interface for command, monitoring and vehicle feedback.

FINAL RESULT

Gold Challenge Completed ✓

Autonomous navigation → Wireless control → Encoder feedback → Closed-loop PID control

This project shaped how I understand mechanical, electronic and software systems working together as one mechatronic whole — going from testing individual components in isolation to integrating, debugging and validating a buggy that actually had to work, end to end, on the day.

Arduino C++ PID Control Embedded Systems Electronics Sensors WiFi Processing Motor Control Prototyping