Sanity Check on Rotary Encoders


Had a "starter kit" encoder that I could not get to work reliably until I found this lib. Give it a shot:

Rotary encoders do not need debouncing, and should not be debounced like a button. Quadrature encoder
signals are inherently correct during contact bounce - the position oscillates between neighbouring
counts without ever being in error.

So all you normally need to do is add one count of hysteresis to handle this (or the situation where
the contact is intermittent at the parked position due to vibration).

A well made encoder has correctly placed detents so that at a detent the count is stable, and there
are always 4 counts per detent (counting every transistion).

But most encoders are not this precise, so the one-count hysteresis thing is usually worth having.

I did the code for a project using a rotary encoder, the project owner did the hardware. We had issues getting the encoder and the Arduino to cooperate which were solved by passing the encoder signals through Schmitt triggers which cleaned up the signals nicely. They're jellybean components, might be worth a try.