PID Controller
Control output from proportional, integral and derivative of the error.
Formula
Variables
Example
Tuning K_p, K_i, K_d balances speed, overshoot and stability.
How it works
A PID controller computes a correction signal from three pieces of information: how large the current error is, how long that error has persisted, and how quickly it is changing. The proportional term reacts immediately to the present error, the integral term removes long-term bias by accumulating past error, and the derivative term anticipates future behavior by damping rapid changes. Together they form a practical feedback law because they combine fast response, steady-state accuracy, and stability in one control rule.
When to use it
Use a PID controller when you need a system to track a target value or reject disturbances using feedback, such as in motor speed control, temperature regulation, drone attitude control, or robotic position control. It is especially useful when the plant is too complex for a simple exact model, but you can measure the error over time.
Worked example, step by step
Given: K_p = 2.5, K_i = 0.8, K_d = 0.3 Current error: e = 4 Past error area over time: \int e\,dt = 6 Error rate of change: de/dt = -1.5 Step 1: Proportional term K_p e = 2.5 \times 4 = 10 Step 2: Integral term K_i \int e\,dt = 0.8 \times 6 = 4.8 Step 3: Derivative term K_d \frac{de}{dt} = 0.3 \times (-1.5) = -0.45 Step 4: Add the three contributions u(t) = 10 + 4.8 - 0.45 = 14.35 Final answer: the controller output is u(t) = 14.35
Common mistakes to avoid
- Forgetting that the integral term depends on accumulated error over time, not just the current error
- Using the raw derivative of noisy measurements without filtering, which can make the control signal unstable
- Choosing gains independently of the physical system, leading to overshoot, slow settling, or oscillation
Did You Know?
PID control dates to ship autopilots of the 1920s and still runs the vast majority of industrial systems today.
Share this formula
More in Robotics & Control
View allDegrees of Freedom
IntermediateIndependent motions of a mechanism from bodies and constraints.
Gear Reduction Torque
IntermediateOutput torque after gear reduction, allowing for efficiency.
Encoder Resolution
BasicSmallest angle a rotary encoder can resolve.
DC Motor Torque
IntermediateTorque of a DC motor is proportional to current.
Motor Back-EMF
AdvancedVoltage a spinning motor generates against its supply.
Forward Kinematics (2-Link)
AdvancedEnd-effector position from joint angles of a two-link arm.