Quadrature encoders are incremental encoders that you can use to measure the speed and direction of a rotating shaft. They convert the angular rotation of the shaft to digital pulses that tell you which direction the shaft moves. By measuring the time difference between the pulses, you can derive the speed. You can use quadrature encoders in bidirectional position sensing and length measuring applications. You can decode quadrature signals to use them as a sensory input to a system to determine the speed, acceleration, and position of the rotary devices. The three types of decoding — X1, X2, and X4 — provide 1, 2, or 4 pulses, respectively, at each rotational cycle. X4 decoding is only supported as it provides the highest accuracy and angular resolution.
This example shows how to use the MATLAB® Support Package for Arduino® Hardware to control a 12-step rotary encoder with a built-in push button.
This example shows how to use the MATLAB® Support Package for Arduino® Hardware to steer a two-wheel Arduino-based robot with closed-loop control.