- Angle
- 0.0°
- Target
- 0°
- Error
- 0.0°
- Motor
- 0.00 V
A simulated DC motor holds an arm at a target angle, or spins a flywheel at a target speed. Change the P, I and D gains and watch how the response changes.
Each one loads a set of gains and conditions in position mode. Read what to watch for, then press Load.
Every millisecond the controller reads the encoder, compares it with the setpoint, and sets the motor voltage. The difference is the error, e.
Kp·e. Big error, big push. Alone it leaves a small offset whenever a steady load (like gravity) needs a constant voltage to hold.
Ki·∫e. Keeps growing while any error remains, so it finds the holding voltage by itself. Slow to react, and it can overshoot.
Kd·de/dt. Opposes fast change, acting like a shock absorber. Reduces overshoot, but noisy sensors make it jittery.
Model: J·θ̈ = 50·u − 2·θ̇ − load − disturbance (rad/s², u in volts, clamped to ±12 V). The controller and physics run at 1 kHz with a 10 ms derivative filter. Units are scaled for teaching, not a specific motor datasheet.