Adaptive AgroTech Interactive learning series
Browser simulation
Control systems / Visual laboratory 01

See feedback in motion.

Two identical motor joints. One follows a command. One checks the result.

Space play / pause R replay

The motor bench Shared target · shared load

0.00 s

A  Open loop

Command → motor

No feedback
0.0°
Measured angle
0.0°
Target − angle
Drive
0.00 V

B  Closed loop

Command → measure → correct

PID active
0.0°
Measured angle
0.0°
Target − angle
Drive
0.00 V
Target0°Feedforward0.00 VMotor jointAngle0°Measurement is displayed, but never used for correction Target0°target for feedforward+−errorPID + FF0.00 VMotor jointAngle0°ENCODER FEEDBACK
↗

Press Run. The dashed pointer is the target; the colored arm is the actual angle.

Watch the response Hover to inspect

TargetA · Open loopB · PID
Hover over the plot to compare both motors at the same instant.
PID peak overshoot—Measured after the reference step
PID time inside band0.00 sWithin ±1.8° · continuous so far
Current load on both motors0.000 N·mActs in the negative direction

Inside the PID controller Live contribution to the motor voltage

Left = negative   ·   Right = positive
P · present error+0.00 V

A larger gap creates a larger push.

−12 V+12 V
I · accumulated error+0.00 V

Builds the extra drive needed under load.

−12 V+12 V
D · measured motion+0.00 V

Brakes fast movement near the target.

−12 V+12 V
Drive = clip( feedforward 0.00 + P + I + D, ±12 V )0.00 V
Model, units & how to read the experiment
J θ̈ + b θ̇ + k θ = Kᵥ V − τₗVₒₚₑₙ = k r / KᵥVₚᵢᴅ = clip(Vₒₚₑₙ + Kₚe + Kᵢ∫e dt − Kd ω̂, ±12 V)

This is a spring-return DC motor joint, not a hobby-servo PWM emulator. The spring gives the open-loop plant a finite resting angle. Both plants have the same inertia, damping, spring, voltage limit and external load. The encoder on A is for display only.

Reduced mechanical teaching model: armature electrical dynamics are omitted, and effective damping includes motor back-EMF. Default J = 0.025 kg·m², b = 0.045 N·m·s/rad, k = 0.12 N·m/rad, Kᵥ = 0.12 N·m/V. These are illustrative parameters, not identified hardware. Internal angles use radians; the screen shows degrees.

Error e = r − θ. Gain units: Kₚ [V/rad], Kᵢ [V/(rad·s)], Kd [V·s/rad]. D uses filtered encoder velocity, so a target step does not produce derivative kick. Conditional integration prevents further windup into saturation. Contribution bars clip visually at ±12 V; numbers show the full contribution.

A fixed 10 ms controller step is independent of screen refresh and playback speed. Each control interval uses two 5 ms RK4 plant steps. The controller reads the encoder before each plant advance; live contribution values refer to that most recent control sample. Square period = 8 s; sine period = 6 s. Both start after 0.5 s. All rotations are positive counterclockwise; no artificial angle stop is imposed.

Peak overshoot is the greatest excursion beyond a fixed target, divided by the initial step size, measured so far. It is cleared or marked unavailable after settings or disturbances change. Time inside band is a continuous dwell time, not a guaranteed settling time. The tolerance is max(1°, 2% of the step size). Chart window and CSV retain the latest 120 s of samples.

Background: University of Michigan · DC motor modeling · MathWorks · PID anti-windup. This lab adds a spring-return load and an illustrative reduced model.