quadrature-encoder-course/lessons/02-using-encoder-feedback/02-closing-the-loop-with-a-pid/closing-the-loop-with-a-pid.md

919 B

title summary chapter order tags estimated_minutes
Closing the Loop with a PID Use encoder speed feedback to hold a target wheel speed with a simple controller. Using Encoder Feedback 2
control
pid
robotics
12

Closing the Loop with a PID

With encoder speed feedback in place, you can command a target speed and adjust motor output based on error.

The basic control loop is:

  • measure current speed
  • compute error = target - measured
  • update the controller
  • send the new motor command

Start simple. A proportional controller is often enough to prove the loop works before adding integral or derivative terms.

What good behavior looks like

  • the wheel reaches the target speed quickly
  • overshoot stays limited
  • the response remains stable when load changes

Checkpoint

Tune a controller so the wheel returns to the target speed after you briefly drag on the tire by hand.