please dont rip this site

Input sensors for position change

Quadrature Encoders

NEW: MassMind Magnetic High Speed Non-Contact Encoder

Quadrature Encoders typically consist of a spoked pickup wheel attached to the mechanical input. The spokes pass through a pair of optical interruption sensors consisting of:

which generate a pair of phase shifted output streams. This is called a Quadrature Encoder because they have 2 pulses spaced 90 degrees apart. The direction of movement is deturmined by noticing whether the A or B signal stream is leading.

                                 |  Reading point
             ___     ___     ___     ___     ___     ___     ___     _
Stream A|___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|
           ___     ___     ___     ___     ___     ___     ___     ___
Stream B__|   |___|   |___|   |___|   |___|   |___|   |___|   |___|

            Counter-clockwise <--|--> Clockwise

 (A;B)            Current:
Previous ||(0;0) (0;1) (1;0) (1;1)
 (0;0)   |   NC    CW   cCW   Err        NC=No change
 (0;1)   |  cCW    NC   Err    CW        CW=Clockwise
 (1;0)   |   CW   Err    NC   cCW       cCW=Counter-clockwise
 (1;1)   |  Err   cCW    CW    NC       Err=Error (ignored)

This scope trace shows A and B phase quadrature signals as a shaft is reversed from one direction to the other.

Morgans Reglerteknik, mrt at says:

To decode Quadrature Encoders: Generally,

Paul B. Webster says:

If you presume that it will occur due to slow processing, then you must allow that you have missed the actual direction of that move. In this case it is best to update the "previous" state with the current one, and wait for the next move. This would most likely happen when the encoder is moving rapidly and the next move will at least be registered as the correct direction. For a mouse, this is perfectly reasonable as absolute accuracy is not required in comparison to smooth movement.

If OTOH, you presume that a simultaneous change in state on both is a noise (debounce) phenomenon, than it is handled by *not* updating the previous state; when a reasonable "new" state is eventually detected, the movement direction is determined accordingly. This means however that if the encoder really *did* move two steps between polling, the next step will be indicated in the *wrong* direction.

Decoding Quadrature Encoders with a PIC

Decoding Quadrature Encoders with an SX +

Postscript for printing an encoder disk See also: Postscript@

December 2003 MassMind newsletter Useing a "vernear" arrangement of low resolution sensors to accuratly sense a high resolution pattern.

Grey Code / Single Track Grey Code Encoders

David A Cary Says: " "Quadrature Encoder Inside an R/C Servo" by Giuseppe Marullo has detailed photographs, schematics, and step-by-step instructions: "
James Newton replies: Now at


See also:

Mechanical Rotary Encoders can cost as little as $4.70. E.g. The GreyHill unit from Digikey (GH3071-ND) qty 1 +



file: /Techref/io/sensor/pos/enc/quadrature.htm, 6KB, , updated: 2017/5/31 17:17, local time: 2017/10/20 20:06,

 ©2017 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF=""> Quadrature Encoders</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2017 contributors:
o List host: MIT, Site host, Top posters @20171020 RussellMc, Van Horn, David, James Cameron, Sean Breheny, IVP, alan.b.pearce, Neil, David C Brown, Bob Blick, Denny Esterline,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!