You inspect a rotating optical code wheel, A/B photodetectors and a four-state decoder. Every ideal quadrature transition is decoded, including reverse rotation. You can inject swapped channels or a stuck B channel and compare the reported angle with the true shaft angle.
• A slotted optical code wheel, A and B optical read heads, a quadrature transition decoder, channel-level indicators and a once-per-revolution index detector. • Controls for shaft speed (-30 to 30 rpm), optical cycles per revolution (4-32) and signal condition (normal, swapped A and B, B stuck low). • Readouts of true unwrapped angle, decoded relative angle, signed x4 count, angular count increment and channel A and B levels. • Experiments: reverse rotation, swapped wiring, and a broken B channel.
x4 resolution = 360/(4N) degrees per count and the true angle is 6 × rpm × t degrees. The state index is floor(angle/resolution) on the signed unwrapped angle, stepping through the Gray sequence 00, 01, 11, 10. All crossed transitions are processed, and swapped channels reverse the counts.
This is an ideal digital encoder with exact crossing detection and no sampling aliasing, propagation delay, noise or missed optical edges. The relative count starts at zero. Stuck-channel decoding can oscillate or undercount, and the index is displayed but not used for homing.
No. It counts all four edges per A/B electrical cycle.
No. The index repeats once per revolution and the counter is relative.
The decoder reports the opposite direction, because swapped channels reverse the counts.
No. With B stuck low, one channel alone cannot provide reliable quadrature position or direction; decoding can oscillate or undercount.