Motors & motion ยท feedback

Close the loop with feedback

Question: How can a controller correct for a hill or changing load?

Understand the idea

A controller needs a target and a measurement. Their difference is error. For speed control, a wheel encoder measures rotation; for balance, an IMU estimates orientation. The controller updates its command from the error rather than relying on a fixed motor setting.

Proportional control responds to current error. More gain usually makes the response stronger, but excessive gain can cause oscillation. Integral action accumulates persistent error, helping remove a steady offset, but can build up while the output is saturated. Derivative action responds to how quickly error changes and can add damping, but noisy measurements make it sensitive.

Tune with a bounded, safe plant: log target, measurement, error, and output at a known sample rate. Change one gain at a time, begin conservatively, and include output limits and a safe stop. PID is a useful tool, not a substitute for understanding the mechanism.

Worked example

If target speed is 100 rpm and the encoder reports 82 rpm, error is 18 rpm. A proportional controller with Kp = 2 would request a correction of 36 command units, then clamp it to the driver's safe range.

Try it at the bench

  1. Use a small motor with encoder and a driver that supports its voltage/current. Keep wheels off the table.
  2. Record the target and measured speed at a fixed interval while changing the load gently.
  3. Increase proportional gain in small steps and observe response, overshoot, oscillation, and steady error. Do not raise gain until the mechanism is safely restrained.

Check your understanding

What is a likely symptom of too much proportional gain?

Show the answer

The system may overshoot repeatedly or oscillate because each correction is too aggressive for the plant's delay and inertia.

Browse all course lessons