Back to Portfolio
Control Systems Project | PID | Arduino Robot Car

Auto-Pacing PID Robot Car

An Arduino-based robot car that uses ultrasonic distance sensing and PID motor-speed control to maintain a target following distance from an obstacle.

This EE333 control systems project focused on closed-loop feedback, controller tuning, hardware testing, and measurable response improvements.

25 in Target following distance
4 sec Approximate settling time
2 in Approximate final overshoot
0 in Approximate steady-state error

Project Overview

Problem

The goal was to design a feedback-controlled robot car that could automatically adjust its speed to maintain a fixed distance from an obstacle.

The system needed to respond smoothly, avoid large overshoot, settle quickly, and hold the target distance with minimal steady-state error.

Solution

The robot used an ultrasonic sensor to measure distance, an Arduino Uno to calculate control output, and a TB6612FNG motor driver to control the DC motors.

A PID controller was tuned through testing and iteration to improve the car’s response and reduce overshoot while maintaining the target distance.

Hardware

Major Components

  • Arduino Uno R3
  • HC-SR04 ultrasonic distance sensor
  • TB6612FNG motor driver
  • Four DC gear motors
  • Robot car chassis
  • IO expansion board
  • Battery power source

System Behavior

  • Measure distance from the obstacle using ultrasonic sensing.
  • Compare measured distance against the target distance.
  • Calculate error between measured and target distance.
  • Apply PID control to determine motor-speed response.
  • Drive motors forward, backward, or stop based on control output.

Robot Car Photo

Auto-Pacing PID robot car hardware

Auto-Pacing PID robot car hardware showing the Arduino-based control system, ultrasonic sensor, motor driver wiring, chassis, and DC motor setup.

Control Design

PID Controller

PID Control Ultrasonic Feedback PWM Motor Control Hardware Testing

The controller used the distance error between the measured position and the desired target distance to adjust motor behavior. The proportional term responded to present error, the integral term helped reduce steady-state error, and the derivative term helped reduce aggressive motion and improve stability.

Final tuned gains:

  • Kp: 20
  • Ki: 0.1
  • Kd: 10

Testing and Results

Initial Working Version

The first successful version verified that the ultrasonic sensor, Arduino, motor driver, and robot chassis could work together as a closed-loop distance-control system.

Controller Tuning

The PID gains were adjusted through trial-and-error testing to reduce overshoot, improve stability, and shorten the settling time.

Improved Final Response

After tuning, the final response achieved approximately 4 seconds of settling time, approximately 2 inches of overshoot, and approximately zero steady-state error.

Design Outcome

The project demonstrated how control-system theory can be applied to a real physical system using embedded firmware, sensors, actuators, and iterative testing.

Demo Videos

Initial Success Demo

Early working version used to validate ultrasonic sensing, motor response, and the first successful closed-loop behavior before final PID tuning.

Watch Demo

Final Tuned PID Demo

Final version after PID tuning, showing improved distance tracking, reduced overshoot, and more stable target-distance behavior.

Watch Demo

Technologies and Skills Demonstrated

Technologies

Arduino Uno C/C++ HC-SR04 TB6612FNG PWM DC Motors Serial Monitor

Skills

PID Control Embedded Firmware Closed-Loop Feedback Controller Tuning Sensor Integration Hardware Debugging System Testing

Project Outcome

The Auto-Pacing PID Robot Car successfully demonstrated closed-loop distance control using an ultrasonic sensor, embedded firmware, and motor-speed control. The final tuning improved the system response to approximately 4 seconds of settling time, approximately 2 inches of overshoot, and approximately zero steady-state error.

This project strengthened my understanding of practical control systems by connecting PID theory with real hardware behavior, sensor noise, motor response, and iterative tuning.