This circuit, which was developed to monitor the traffic of bumblebees in and out of the hive, differentiates a -to-b motion from b-to-a motion. When used with an optical decoder, the circuit distinguishes clockwise from counterclockwise rotation and provides a resolution of one output pulse per quadrature cycle.
Q1 and Q2 are mounted so that a moving object first blocks one phototransistor, then both, then the other. Depending on the direction in which the object is moving, either IC1B or IC1D emits a negative pulse when the moving object blocks the second sensor. An object can get as far as condition 3 and retreat without producing an output pulse; that is, the circuit ignores any probing or jittery motion. If an object gets as far as condition 4, however, a retreat will produce an opposite-direction pulse.
The time constants R3C1 and R4C2 set the output pulse width. A 100 Kohm/100pF combination, for example, produces 10-us pulses. Select a value for pullup resistors R1 and R2 from the 10 K to 100 Kohm range, according to the sensitivity your application requires.