PID controller (Proportional-Integral-Derivative)
A control algorithm with three components that work together: Proportional (responds to current error), Integral (corrects past errors), and Derivative (predicts future error). It’s the standard way to control individual motors to reach target angles.
What it is:
A control algorithm that automatically adjusts a motor's power to reach and maintain a target angle (or position). It uses three separate "feedback mechanisms" working simultaneously to make precise, smooth adjustments.
The Three Components:
- Proportional (P) — Responds to current error
- Measures how far off you are right now from the target
- Action: Push harder the further you are from the goal
- Analogy: If you're 10° away from target, push with force 10. If you're 5° away, push with force 5
- Problem alone: You might overshoot or undershoot
- Integral (I) — Corrects past errors
- Tracks how long and how much you've been off target
- Action: If the error persists, keep increasing the correction force
- Analogy: If you've been 2° off for several seconds, add extra push to finally eliminate that stubborn offset
- Problem alone: Can cause oscillation (bouncing back and forth)
- Derivative (D) — Predicts future error
- Measures how quickly the error is changing
- Action: If error is shrinking fast, back off to avoid overshooting
- Analogy: If you're rapidly approaching the target, reduce power early so you don't crash past it
- Problem alone: Ignores persistent errors
How they work together:
The three components balance each other out. P gets you close, I eliminates stubborn offsets, and D prevents overshooting. Together, they smoothly and quickly drive the motor to the target angle and hold it there.
Why it's standard:
PID controllers are simple, reliable, and work for almost any motor or mechanical system—from robot joints to heating systems to cruise control in cars. They require minimal tuning and adapt well to changing conditions.
Share: