🎛️ PID Control Loop Tuning Simulator

A simulated DC motor position control loop. Drag the Kp / Ki / Kd gain sliders or change the target step-input setpoint — the closed-loop step response is re-simulated and redrawn live, along with overshoot, rise time, settling time, and steady-state error readouts.

Presets:

Step Response — Motor Shaft Position vs Time

Actual position x(t) Setpoint (target) ±2% settling band
Overshoot
Rise time (10→90%)
Settling time (±2%)
Steady-state error

Controller Gains

6.0
Reacts to the current error. Higher Kp = faster, stiffer response, but pushed too high it causes overshoot and oscillation.
1.00
Accumulates past error over time to drive steady-state error to zero (needed here to overcome the motor's constant load torque). Too much Ki adds overshoot and slow oscillation.
0.20
Reacts to the rate of change of error, adding damping that resists overshoot. Too much Kd makes the response sluggish and amplifies sensor noise in a real system.
90°
The commanded motor shaft position (a step change from 0° at t=0).
Simulated plant: a second-order DC motor position model (moment of inertia + viscous damping) driven by the PID controller output, under a constant opposing load torque (e.g. gravity or friction on the shaft) — which is why a P-only controller (Ki = 0) always leaves a visible steady-state error. Fixed-timestep Euler integration, dt = 10 ms, actuator torque is saturated to a realistic maximum.