Optic encoder - Rotation

In the following you can see the channel A ( above ) and the Channel B ( middle) output of an optic encoder that is connected on a rotating shaft. My questions is: Does the impulse width impact the way you need to count the distance? To me , it seem that channel A is in advance from channel B therefore I just need to add distance to my current total distance ( convention A in avance on B = increment in position)

Could you see it as the distance going back and forward therefore explaining the larger pulse on channel A and smaller pulse on channel B?

[EDIT] Here is the link to the encoder that will be used

Encoder Datasheet

• Yes, it moves fwd and bkw on the picture. You can count at each transition of A or B, in literature is named as 4x mode. – Marko Buršič Oct 10 '15 at 17:50

You need to count edges. Between them you are below resolution, so you don't know anything more accurately than counted edges. On your image the encoder moves two counts forward and two backwards.

If you are actually getting the output you show, while the shaft is turning in one direction, you have a faulty encoder and should replace it. Compare your drawing to the waveforms in the data sheet. For rotation at uniform speed the two traces should be square waves with a 90 degree phase shift, and this is nothing like what you show.

• Well the speed is variable – MathieuL Oct 10 '15 at 22:56
• @MathieuL - Then the waveform stops being a nice square wave, but the sequence of edges remains the same. If your output looks as you say it does, you have a bad encoder. – WhatRoughBeast Oct 10 '15 at 23:23

A link to the encoder data sheet could and more details to this answer. You typically do not measure Pulse Width with an encoder.

There are many types of encoders; Absolute Position, Incremental, etc.

They also have many options; A Channel, B Channel, Z Channel, Quadrature, Pulses Per Revolution (PPR), etc.

Typically you have the encoder attached to something, a wheel, a gear, the actual motor. From the PPR you can calculate the angular change, multiply that by the "distance per angle" and you have the actual linear distance. There can be many factors that affect the accuracy of this calculation; Slip, backlash etc.

With a quadrature encode you can detect direction (CW or CCW) with A leading B or B leading A.