A little curiosity. A whole lot of making.Robotics, CNC & connected ideas
robodatech.
← Learning library
Control

Make motion follow a target.

Learn error, feedback, proportional control, integral action, derivative damping, and the practical limits of a real robot.

Close the loopTargetControlMotorMeasured feedbackMeasure the result. Correct the error.
Concept illustration. Check the component datasheet before wiring.
Try it yourself

Change an input.
See what follows.

A simplified learning model. Values describe the model, not a connected robot.

Close the loop around something you can measure.

An open-loop command asks for effort, such as a PWM duty cycle. A closed-loop controller measures the result, compares it with a target, and adjusts the effort. For wheel speed, an encoder supplies feedback; for a joint, use an appropriate angle sensor. Position, speed, and current are different quantities and need distinct units and limits.

e = target − measurement
u = Kp·e + Ki·∫e dt + Kd·de/dt

Understand each term

P · Respond to error

Proportional gain increases effort when error grows. Low gain is gentle but slow; excessive gain can excite oscillation in a real mechanism with delay or inertia.

I · Remove persistent error

Integral action accumulates error to compensate for constant loads. Clamp or condition the integral when the actuator saturates so it does not keep winding up.

D · Dampen rapid change

Derivative action reacts to the rate of change. It is sensitive to noisy measurements, so filtering and derivative-on-measurement are common practical choices.

Read this model correctly

The experiment uses only proportional control on the normalized first-order plant dy/dt = −y + u, with u = Kp(1 − y). Its exact response is y(t) = Kp/(1 + Kp) × (1 − exp(−(1 + Kp)t)). A gain of 2 settles at 2/3 of the target; a gain of 0 produces no motion. This deliberately simple model has no delay, saturation, noise, or oscillatory dynamics and cannot predict whether your physical robot is stable.

Tune on the real mechanism

  1. Verify sensor polarity, units, and update period with the actuator disabled.
  2. Set conservative output and speed limits. Begin with I and D at zero.
  3. Increase P gradually while logging target, measurement, error, and output.
  4. Add a small integral term only when persistent error needs correction; implement anti-windup.
  5. Add filtered damping when required, then retest under different loads.
  6. Test sensor loss, stale commands, saturation, and recovery before normal operation.

A network connection should not be the only way to stop an actuator. Keep local watchdog and driver-disable behavior independent of high-level planning.

Go to the source

Manufacturer and project documentation. Reviewed 20 September 2026; check your exact board revision and software release.

Keep building

Good ideas start here.

Free robotics lessons, CNC build notes and product updates. Confirm your email to join. Unsubscribe anytime.