Electronics 116: Encoders & Position Feedback Systems
A practical, engineering-focused guide to position feedback: rotary and linear encoders, how they work, how to read them reliably, and how to choose the right feedback system for motion control, robotics, CNC, and automation projects.
1) What is an encoder?
An encoder converts mechanical motion into an electrical signal that represents position, speed, or direction. It is the most common feedback device used in motion systems.
2) Why feedback matters
Without feedback, systems assume motion occurred as commanded. With feedback, systems verify motion and correct errors.
- Detect missed steps
- Maintain accuracy under load
- Enable closed-loop control
- Improve safety and reliability
3) Encoder types overview
| Type | Measures | Typical Use |
|---|---|---|
| Incremental | Relative movement | Speed & position tracking |
| Absolute | Absolute position | Robotics, CNC homing-free |
| Magnetic | Angle via magnetic field | Compact servo feedback |
| Optical | Light interruption | High-resolution motion |
4) Incremental encoders
Incremental encoders output pulses as the shaft rotates. Position is determined by counting pulses.
- Channels A and B (quadrature)
- Direction from phase difference
- Index pulse (Z) for reference
5) Absolute encoders
Absolute encoders output a unique value for each position. The position is known immediately on power-up.
- Single-turn or multi-turn
- Parallel or serial output
- No homing required
6) Rotary vs linear encoders
| Encoder | Measures | Examples |
|---|---|---|
| Rotary | Angular position | Motors, joints |
| Linear | Linear displacement | CNC axes, slides |
7) Resolution, CPR & accuracy
Encoder resolution is often expressed as CPR (Counts Per Revolution).
8) Encoder signals & interfaces
- Quadrature (A/B): Incremental encoders
- Index (Z): Reference point
- SPI / IΒ²C: Digital absolute encoders
- Analog: Sine/cosine outputs
9) Noise, shielding & wiring
Encoder signals are often low-level and susceptible to noise.
- Use twisted pairs for A/B signals
- Shield cables where possible
- Common ground reference
- Keep away from motor power wiring
10) Reading encoders with microcontrollers
Encoders can be read using:
- Interrupts (low speed)
- Hardware quadrature decoders
- Timer/counter peripherals
11) Encoder selection guide
- Hobby robotics: Incremental optical or magnetic encoder
- Servos: Magnetic absolute encoder
- CNC: High-resolution optical encoder
- Harsh environments: Magnetic or inductive encoder
12) Common problems & debugging
- Missed counts due to noise
- Incorrect CPR assumptions
- Poor mechanical coupling
- Floating grounds
- Over-speeding the MCU input