Motor Encoders

A motor encoder is what turns a regular motor into a “Smart Motor.” A basic motor can only spin — it cannot track how fast it is going, which direction it is turning, or how far it has traveled. An encoder adds that intelligence.

Without motor encoders, it is very hard to drive precisely or control a robot arm accurately. With them, you can tell your robot to drive exactly 24 inches or rotate a lift arm exactly 90 degrees!

Vex Motor Encoder

Why does this matter?

Every precise autonomous routine depends on encoders. They are the robot’s sense of “how much did I move?” Without that information, autonomous driving is just guessing.

How it Works

Most VEX encoders use optical technology. Here is what happens inside the motor:

  1. A small wheel with slots cut into it sits on the motor’s rotating shaft.
  2. A tiny light beam shines at the wheel from one side.
  3. As the motor spins, the wheel spins too, causing the light beam to flicker on and off through the slots.
  4. The encoder counts each flicker as a tick.

Motor Encoder Diagram

The encoder actually has two light sensors placed slightly apart. By checking which sensor detects the light first, the encoder can tell whether the motor is spinning clockwise or counterclockwise, and how fast.

Types of VEX Encoders

VEX IQ Smart Motor:

  • The encoder is built inside the motor casing.
  • Resolution: 0.375 degrees — meaning the encoder detects even tiny movements. This allows smooth, precise control of arms and drivetrains.

VEX V5 Smart Motor:

  • Also built inside the motor casing.
  • V5 motors have swappable internal gear cartridges. The cartridge you use changes how many ticks are counted per full rotation:
    • Red Cartridge → 1800 ticks per rotation (slow and powerful)
    • Green Cartridge → 900 ticks per rotation (balanced)
    • Blue Cartridge → 300 ticks per rotation (fast and light)

The Math

Most VEX coding tools (like VEXcode Pro or PROS) automatically convert ticks into degrees or rotations for you. But if you are building custom code, here is the formula to convert raw ticks into degrees:

$$ \text{Degrees} = \text{Ticks Measured} \times \left(\frac{360}{\text{Ticks Per Revolution}}\right) $$

What You Can Measure

From an encoder, your code can read three useful values:

  • Position: The total number of degrees or rotations the motor has turned since the program started.
  • Velocity: How fast the motor is currently spinning, in RPM (Rotations Per Minute) or as a percentage.
  • isDone: Checks whether the motor has finished moving to its commanded target position — very useful for making sure one action finishes before the next one starts.

Limitations

Encoders only track the rotation of the motor’s internal gears. If the wheels slip on the field — for example, during a hard push from another robot — the motor is still spinning but the robot is not actually moving. The encoder still counts those ticks, making the robot think it has moved further than it really has.

See Odometry and Localization to learn how to handle this problem.