How to Estimate Encoder Velocity Without Making Stupid Mistakes: Part I
Here's a common problem: you have a quadrature encoder to measure the angular position of a motor, and you want to know both the position and the velocity. How do you do it? Some people do it poorly -- this article is how not to be one of...
Summary
This blog explains common pitfalls and correct methods for estimating angular velocity from quadrature encoders. It shows the trade-offs between count-difference and period-measurement approaches and gives practical firmware techniques to compute stable, low-latency velocity for motor control.
Key Takeaways
- Choose between time-based (period) and position-difference (delta-count) methods depending on speed range and latency requirements.
- Account for quantization, sampling aliasing, and measurement jitter when differentiating encoder counts.
- Apply appropriate filtering (e.g., exponential/alpha filters or complementary filters) to reduce noise without introducing unacceptable lag.
- Use hardware timer capture and interrupt strategies correctly to get precise timestamping and avoid missed pulses.
- Test velocity algorithms across the full speed range and edge cases (low speed, direction changes, and stoppage) to reveal estimation failures.
Who Should Read This
Firmware and control engineers with some embedded experience who need reliable encoder-based velocity estimates for motor control or sensor interfacing.
Still RelevantIntermediate
Related Documents
- Consistent Overhead Byte Stuffing TimelessIntermediate
- PID Without a PhD TimelessIntermediate
- Introduction to Embedded Systems - A Cyber-Physical Systems Approach Still RelevantIntermediate
- Can an RTOS be really real-time? TimelessAdvanced
- Memory Mapped I/O in C TimelessIntermediate








