This is a sub-project I worked on for short awhile as a part of a bigger project of building a closed loop 3D printer.
Common 3D printer use stepping motor to control the linear motion. The position is assumed by counting the number of steps rotated. This approach often have alignment issue when the linear motion "skipped steps". Closed loop refers to measuring the position directly as a feedback, completing the control system. This design is very common in inkjet printers. Multiple quadrature optical encoder can often be found in an inkjet printer. It can be very accurate and cost efficient way to determining the position, and eliminate the needs of expensive stepping motors.
In order to use the Arduino to directly work the quadrature encoder, the Arduino must be operating in an interrupted mode. Normal operation of Arduino will be too slow to capture the counting (the Highs and Lows as the optical sensor moving along the encoder). With the interrupt mode, the Arduino acts more like a RTOS. Whenever there is a change in the optical sensor input, the interrupt will be triggered and the Arduino will prioritize running counting program first.
Here is product. I dissabled an inkjet printer and spend a few days to get it working. It can reach repeatitive accuracy of the quadrature encoder, which is about 0.1mm.