Blog Home

Experiments in PID control with an Arduino UNO R4 Minima-powered robot

Arduino TeamAugust 9th, 2023

In robotics and several other disciplines, PID (proportional-integral-derivative) control is a way for systems with closed-loop feedback to adjust themselves according to sensor data without overshooting the target. Drones, for example, use PID control to remain stable without wild oscillations caused by over-correction. But implementing PID control can feel overwhelming, so Adam Soileau from element14 Presents built a simple robot for some experimentation.

This robot’s only job is to drive forward until it sees a wall, then stop at a specific distance from that wall. That isn’t hard to achieve when a robot is moving at slow pace, because the code can tell the robot to stop moving the moment it reaches the target distance. But when moving fast, the robot has to take braking acceleration into account and that is much harder to predict. PID control is perfect for this situation, because it adjusts motor output in real-time according to the incoming sensor data.

In this case, that sensor data comes from an ultrasonic rangefinder mounted to the front of the 3D-printed robot. An Arduino UNO R4 Minima board receives that data and controls the robot’s two motors through H-bridge drivers. That hardware is very straightforward so that Soileau could focus on the PID control. Tuning that is all about balancing the three constant values to get the desired performance. Soileau spent some time working on the Arduino sketch to get the PID control integrated and was eventually able to make the robot act like it should.

If you’re interested in using PID control in your next robotics project, then Soileau’s video should help you get started.

Boards:Uno R4