Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

This cheat sheet covers how robots measure motion using encoders and use feedback to control motors accurately. Robotics students need these ideas to make drivetrains, arms, lifts, and wheels move to the right position or speed. Encoders turn rotation into measurable counts, while feedback systems compare what the robot did to what it was commanded to do.

A strong reference helps students connect sensor readings, formulas, and control decisions during building and programming.

Key Facts

  • Encoder resolution is the number of counts measured per shaft revolution, often written as counts per revolution or CPR.
  • For a wheel, distance traveled = wheel circumference x wheel rotations, and wheel circumference = pi x wheel diameter.
  • Wheel rotations = encoder counts / counts per revolution when the encoder is mounted directly on the wheel shaft.
  • If gearing is used, output rotations = motor encoder rotations / gear ratio when gear ratio = motor rotations / output rotations.
  • Average velocity can be found with velocity = change in position / change in time.
  • Feedback error is calculated as error = setpoint - measured value.
  • A proportional controller uses output = kP x error, where kP controls how strongly the robot reacts to error.
  • A PID controller uses output = kP x error + kI x accumulated error + kD x rate of change of error.

Vocabulary

Encoder
A sensor that converts rotation or linear motion into digital counts a robot can measure.
Counts per revolution
The number of encoder counts produced during one full rotation of a shaft.
Setpoint
The target position, speed, or angle that the robot is trying to reach.
Feedback
Information from sensors that tells the controller what the robot is actually doing.
Error
The difference between the target value and the measured value, found with error = setpoint - measured value.
PID control
A feedback control method that combines proportional, integral, and derivative terms to reduce error.

Common Mistakes to Avoid

  • Ignoring gear ratio, which is wrong because motor encoder counts may not equal wheel or arm output rotations after gearing.
  • Using diameter instead of circumference for distance, which is wrong because one wheel rotation moves the robot forward by the wheel circumference.
  • Reversing the error calculation, which is wrong because error = setpoint - measured value determines the direction of correction.
  • Setting kP too high, which is wrong because the robot may overshoot, oscillate, or become unstable instead of settling smoothly.
  • Calculating velocity from total position only, which is wrong because velocity depends on change in position over a specific change in time.

Practice Questions

  1. 1 A wheel encoder measures 1440 counts per revolution. If the robot records 3600 counts, how many wheel rotations occurred?
  2. 2 A robot wheel has a diameter of 10 cm and turns 8 full rotations. Using pi = 3.14, how far does the robot travel?
  3. 3 A motor encoder measures 2048 counts per motor revolution. The gearbox ratio is 4:1, meaning 4 motor rotations produce 1 output rotation. How many counts are measured for 3 output rotations?
  4. 4 Why does a robot using encoder feedback usually drive straighter than a robot that only sends the same power to both motors?

Understanding Encoder & Feedback Systems Reference

Many incremental encoders use two signal channels called A and B. Their pulses are offset slightly in time. The controller checks which channel changes first to determine direction.

This is called quadrature encoding. It lets the robot tell forward motion from reverse motion, even when a shaft turns only a small amount. Different devices count pulses in different ways.

One controller may count one edge of each pulse, while another counts every rising and falling edge on both channels. This changes the reported count total.

Students should always check the manufacturer documentation and their programming library before using a resolution value in a distance calculation. A mismatch can make every movement appear four times too long or too short.

The location of the encoder matters as much as its resolution. An encoder on a motor shaft measures motor motion. It does not directly prove that the final wheel, arm, or lift moved as expected.

Gears can have backlash, which is a small loose region where the input turns before the output begins to move. Chains and belts can stretch or skip. A wheel can slip on smooth flooring.

These effects create a difference between measured shaft rotation and real robot movement. For a drivetrain, a carefully measured wheel diameter is often more useful than the printed diameter because tire compression changes the effective size. Testing a known travel distance and adjusting the conversion factor is a normal calibration step.

A control program reads sensors repeatedly at a fixed time interval. Position values show where a mechanism is. Comparing recent position samples gives a velocity estimate.

Very short sample intervals can make velocity readings jump because even one count of change has a large effect. Longer intervals give smoother readings but make the response less immediate. Some programs use a moving average or another filter to reduce noise.

Filtering should be modest. Too much filtering delays the measurement, so the controller reacts to old information. Motor commands have limits as well.

A command cannot exceed the available battery voltage. When a controller asks for more than the motor can provide, the output is clipped, which affects how the mechanism responds.

PID terms solve different control problems. Proportional action provides the main push toward a target. If it is too weak, the mechanism feels slow.

If it is too strong, the mechanism can overshoot and oscillate. Integral action helps remove a small steady error caused by friction, gravity, or an uneven load. It can build up while a motor is stalled or while the output is limited.

This is called integral windup, and it can cause a sudden jump when motion becomes possible. Derivative action responds to rapid changes and can reduce overshoot, but encoder noise can make it unstable. Students usually tune proportional gain first, then add a small amount of derivative if needed, and use integral only when a steady error remains.

They should confirm sensor direction before tuning. A measured position that decreases when the command expects it to increase turns correction into runaway motion.