Skip to content
University of California, Davis Mechanical and Aerospace Engineering
ARMS Laboratory
EME154 · Interactive Lab

Motion, counts, and measured speed.

Follow the shaft through quadrature decoding, position sampling, and speed measurement.

Measurement settings

The U/D counter holds position counts. The timer prescaler divides the clock used to measure time between edges.

Playback is slowed for observation. Next event advances to an A/B edge or sampling boundary, whichever comes first. Home is a single index pulse per revolution, one A/B state wide. Each step uses physical simulated time. Drag the disc to move the shaft at the selected speed magnitude; use the speed field for keyboard control.

A/B and Home signals at the cursor

Predict before stepping

Two measurements of the same motion

Explore the predicted error curves for these settings →

Position samples

Raw counts wrap. Software adds the shortest signed difference between samples. “Actual Δ” is visible only because this is a simulation.

— Actual accumulated counts- - Software position
Time (ms)Raw countActual ΔInferred ΔSoftware position
Model assumptions

Ideal incremental encoder, uniform motion within each step, perfect edges, no missed interrupts, and no mechanical noise. Clockwise-positive is a chosen convention: 00 → 10 → 11 → 01. ×1 counts one edge per cycle, ×2 counts two, and ×4 counts all four. Home marks one physical shaft position once per revolution and is one A/B state wide. It does not by itself reset the position counter or make the encoder absolute. Counter zero is an assumed known starting position; this draft does not model a homing routine.

Pulse counting uses sampled modular position differences. Pulse duration uses quantized timestamps of decoded edges, with an ideal extended timer internally; the display flags intervals requiring overflow handling for the selected timer width. Reversal can make a single duration interval unrepresentative. Hardware latency, ISR costs, oscillator tolerance, and overflow-service code are outside this draft.