The quadrature signals A and B can be decoded to yield the direction of rotation as hown in Figure 6. A single-track code disk is simpler and cheaper to manufacture. It is also useful as a reference to define a home base or zero position.įigure 5 illustrates two separate tracks for the A and B channels, but a more common configuration uses a single track with the A and B sensors offset a 1/4 cycle on the track to yield the same signal pattern.
CONTOH PROGRAM ROTARY ENCODER FULL
Often a third output channel, called INDEX, yields one pulse per revolution, which is useful in counting full revolutions. The signals from the two channels are a 1/4 cycle out of phase with each other and are known as quadrature signals. The A and B channels are used to determine the direction of rotation by assessing which channels “leads” the other. By counting the number of pulses and knowing the resolution of the disk, the angular motion can be measured. The code disk pattern and output signals A and B are illustrated in Figure 5. As the shaft rotates, pulse trains occur on these channels at a frequency proportional to the shaft speed, and the phase relationship between the signals yields the direction of rotation. It consists of two tracks and two sensors whose outputs are called channels A and B. The incremental encoder, sometimes called a relative encoder, is simpler in design than the absolute encoder.
CONTOH PROGRAM ROTARY ENCODER MANUAL
~ Keyes KY-040 Arduino Rotary Encoder User Manual If B changed states first, the switch is rotating in a counter clockwise direction. If A changed states first, the switch is rotating in a clockwise direction. If we were to represent the opening an closing of the switches as wave forms, it would look something like this.Įssentially, determining which switch changed states first is how the direction of rotation is determined.