A quadrature decoder IC (integrated circuit) is an electronic component that is used to decode signals from optical rotary encoders. Optical rotary encoders are sensors that are used to determine the position or motion of a rotating shaft. They work by detecting the interruption of light by a patterned code wheel attached to the shaft. The encoder produces two square wave signals that are 90 degrees out of phase, known as the A and B phases. These signals are sent to the quadrature decoder IC to determine the direction of motion and number of increments that the shaft has rotated.
How quadrature encoders and decoders work
A quadrature encoder consists of an LED light source, a photodetector, and a rotating code wheel with alternating transparent and opaque sections. As the code wheel rotates, light from the LED passes through the transparent sections and is blocked by the opaque sections. This generates square wave signals from the photodetector that are fed into the quadrature decoder IC.
The decoder monitors the sequence of the A and B phase signals to determine which direction the code wheel is rotating. Here is how quadrature decoding works:
- When A leads B, the shaft is rotating in the clockwise direction
- When B leads A, the shaft is rotating in the counterclockwise direction
- Each full cycle of both A and B indicates a single increment of motion
By tracking the number of increments and the sequence of the phases, the quadrature decoder can provide both position and direction information for the rotating shaft.
Features and functions
Some key features and functions of quadrature decoder ICs:
- Decoding: Converts A/B quadrature signals into digital position and direction outputs
- Counter: Counts pulses to keep track of position
- Index output: Indicates when shaft is at a reference position
- State machine: Tracks state of A/B phases to determine direction
- Error detection: Flags errors like missing pulses or illegal state transitions
Many quadrature decoder chips also include additional capabilities:
- Quadrature counting modes: 1x, 2x, or 4x counting modes for enhanced resolution
- Digital noise filters: Rejects glitches or erratic transitions on the A/B inputs
- Zero position control: Resets counter to zero on index or Z phase signal
- Clock/direction mode: Allows simple clock/direction inputs instead of A/B quadrature
Key specifications
Some key specifications to look for when selecting a quadrature decoder IC:
- Counting speed: Maximum pulse rate that can be decoded
- Interface: Parallel or serial digital outputs
- Channels: Number of independent decoders on the chip
- Supply voltage: Typically 3.3V or 5V operation
- Package: Size and pin configuration of the IC package
- Index pulse: Compatible with active-high or active-low index signals
- Operating temperature range: Industrial (-40°C to 85°C) or commercial (0°C to 70°C)
Applications
Quadrature decoders are used across many industries and applications including:
- Motion control: Decoding signals from rotary encoders on motors, drives, CNC machines, robots, etc.
- Material handling: Conveyors, automated guided vehicles (AGVs)
- Process control: Valve position sensing, mixer/pump rotation monitoring
- Test & measurement: Signal decoding in instrumentation
- Automotive: Camshaft/crankshaft position and speed sensing
- Metrology: Precision motion control in scientific instruments
- HVAC: Damper and valve positioning
- Robotics: Wheel odometry, joint motion sensing
- Industrial automation: Feedback for servos, actuators, pneumatic cylinders
Some common rotary encoders used with quadrature decoder ICs:
- Optical incremental: Motion detection and positioning
- Optical absolute: Provides unique position code value
- Magnetic: Detects motion through magnetic sensing
- Mechanical: Uses electrical contacts/brushes
Popular quadrature decoder ICs
Some commonly used quadrature decoder integrated circuits:
IC | Description |
---|---|
LS7084 | Quad decoder with 16-bit counter from LSI Computer Systems |
HCTL-2000 | Dual 32-bit counter plus interpolator from Agilent/Broadcom |
MC14071 | Dual decoder with 16-bit up/down counter from ON Semiconductor |
MQD32Q04 | Dual 32-bit counter with error correction from Texas Instruments |
AS5152H | Magnetic rotary position sensor with decoder from AMS |
US Digital MA3 | 12-bit magnetic ring encoder with decoder IC |
Interfacing quadrature decoders
There are some common considerations when interfacing quadrature decoders:
- Power supply: Provide a clean, regulated voltage source to power the IC. Include bypass capacitors.
- A/B inputs: Route the A and B encoder signals to the decoder inputs. Use proper line termination and filtering.
- Index input (if used): Connect the index or Z signal from the encoder.
- Outputs: Read position data, status flags, and direction outputs from the decoder. Use latching outputs if needed to capture position.
- Clocking (if required): Provide a clock signal within the spec’d maximum frequency if the decoder IC uses a clock.
- Configuration: Set counting mode, filtering, and other configurations through control registers if available.
- PCB layout: Follow IC manufacturer guidelines for trace routing, minimizing noise, and power supply decoupling.
Proper wiring, grounding, and PCB layout is important for quadrature decoders to operate accurately.
Quadrature decoder PCB design
Here are some key PCB layout considerations for quadrature decoder ICs:
- Minimize trace lengths for encoder A/B signals and route away from noise sources
- Include ground plane(s) for return current paths
- Provide multiple vias to ground plane for each supply and ground pin
- Bypass supply pins with ceramic capacitors close to the package
- Route index and other critical digital signals away from A/B traces
- Avoid running A/B traces under or near the decoder IC
- Use impedance controlled routing for clock signals if present
- Keep high current digital traces away from encoder signals
- Consider separate analog and digital ground planes
- Include test points for key inputs and outputs
Proper PCB design is essential for quadrature decoders to reject noise and function reliably in industrial environments.
Quadrature decoding techniques
There are several techniques that can enhance the performance of quadrature decoding:
Interpolation
- Inserting extra counter increments between edges of A/B signals
- Improves resolution and accuracy beyond native encoder
- Useful for linedrivers or when updating position at slower rate than encoder response
Error correction
- Detecting illegal state transitions or missing pulses
- Prevents accumulation of position errors
- Important for dynamic applications with vibration/noise
Digital filtering
- Removing glitches, nullifying metastability on inputs
- Prevents extraneous counts from electrical noise
- Smooths position output from mechanical dithering
Watchdog timer
- Checks for valid state changes within set time period
- Prevents loss of position sync if signals freeze
Careful selection of decoder features and techniques allows optimizing precision and reliability for a given rotary encoder application.
Quadrature decoder interfacing examples
Here are a few examples of interfacing rotary encoders with different quadrature decoder ICs:
Optical encoder to LS7084
- 2048 CPR incremental optical encoder
- LS7084 quadrature decoder
- A and B signals to QA/QB inputs
- 16-bit Up/Dn counter outputs connected to microcontroller
- Index pulse provides zero reference
AS5152H magnetic decoder
- AS5152H 12-bit magnetic sensor + decoder
- SSI serial interface to controller
- Provides absolute 12-bit position with no separate encoder needed
- Handles automotive applications up to 8000 RPM
HCTL-2000 with servo drive
- 5000 PPR incremental encoder on servo motor
- HCTL-2000 decoder IC
- 32-bit position data sent over SPI to servo drive
- 10 MHz clocking for 1 μs position latency
- Interpolation used for finer 0.1 arcmin position resolution
Quadrature decoder ICs versus FPGAs
There are tradeoffs between implementing quadrature decoding in a dedicated IC versus an FPGA:
Quadrature Decoder ICs
- Simple, low cost discrete solution
- Built-in filtering and error checking features
- Fast counting speeds, microseconds output latency
- Limited interface options, less customizable
FPGAs
- Flexible, can integrate with other functions
- Fully customizable counting and interface logic
- Position computation speeds limited by FPGA performance
- More complex development process
In cost sensitive applications, decoder ICs provide the best value for adding rotary encoder inputs. FPGAs offer advantages when quadrature decoding is integrated into a larger function requiring programmable logic. High speed systems may also benefit from an FPGA implementation. So the ideal solution depends on the specific application requirements.
Quadrature Encoder to Analog Output Conversion
Quadrature encoders provide digital position information, but some applications require an analog voltage or current output proportional to position. Here are some techniques for converting from quadrature to analog:
Digital to Analog Converter (DAC)
- Use counter value from decoder as digital input to a DAC
- DAC acts as a digitally controlled voltage source
- Output scales linearly with position
PWM Output
- Generate PWM signal with duty cycle controlled by counter value
- Low pass filter PWM to reconstruct analog voltage
- Simple and low component count
Voltage Controlled Oscillator (VCO)
- Counter value adjusts frequency of VCO
- Output filtered to obtain analog voltage
- Very fast response speed possible
Software Conversion
- Microcontroller periodically reads counter value
- Position value written to on-chip DAC or PWM peripheral
- Provides flexibility to scale, linearize, or filter position signal
So in summary, both dedicated hardware and programmable software techniques exist to bridge the gap between digital quadrature decoders and analog interfacing.
Quadrature Decoder FAQ
Here are answers to some frequently asked questions about quadrature decoders:
What is the difference between 1x, 2x, and 4x decoding modes?
- 1x mode increments the counter once per full quadrature cycle
- 2x mode increments the counter on each edge transition
- 4x uses interpolation to increment 4x per cycle for higher resolution
How fast can quadrature decoders count?
- Counting speeds up to 10+ MHz are typical
- Maximum speed depends on decoder IC and CPR of encoder
- High resolution encoders generally have lower maximum RPM
Can multiple rotary encoders share a single decoder chip?
- Yes, some decoders have dual or quad decoding channels
- Channels can independently monitor multiple encoders
- Only limitation is maximum counting speed per channel
How are indexed quadrature encoders synchronized to the decoder?
- An index (Z) pulse resets the counter to a known position
- Usually aligned with a physical mark on the encoder
- Allows establishing an absolute zero position reference
What causes erratic decoder counts or positional errors?
- Noise getting into the A/B signals is the most common cause
- Poor wiring practices, lack of filtering, ground issues can contribute
- Encoder quality and PCB layout also affect robustness
What interface options exist for getting data out of decoders?
- Parallel latched counters, SPI or QSPI, BiSS-C serial, SSI
- Some decoders have built-in incremental encoder outputs
- Analog voltage/PWM outputs available on some ICs
Can quadrature decoders indicate direction of rotation?
Yes, by tracking the phase relationship between A and B signals, the decoder can provide direction logic outputs. This allows determining CW vs CCW motion.
So in summary, quadrature decoder ICs provide a simple and effective means of interfacing rotary encoders for digital position and motion sensing. Careful attention to installation practices and PCB design helps ensure reliable and accurate performance in industrial applications.