Arduino Forum

Forum 2005-2010 (read only) => Hardware => Interfacing => Topic started by: theycallmepost on Jul 23, 2007, 09:53 pm

Title: rotary encoder chatter
Post by: theycallmepost on Jul 23, 2007, 09:53 pm
Hey guys,

I have cannibalized an old mouse and am attempting to use the scroll wheel for a project.

The problem that I am having is in trying to use the code from the playground...

It seems that no matter which direction I turn the wheel, the encoder0Pos value increases - in random intervals.

The little reading I have done online about this leads me to believe this is due to switch "chatter" within the encoder itself.

My question for those more knowledgeable than I:  What can I do to eliminate this 'chatter' ???

-post
Title: Re: rotary encoder chatter
Post by: Daniel on Jul 23, 2007, 09:56 pm
hi

how did you set the slot-detectors up? You need two, slightly out of phase, to detect direction.

D
Title: Re: rotary encoder chatter
Post by: theycallmepost on Jul 23, 2007, 11:12 pm
The encoder I am using has three pins to interface with: A, B, and common.

I first wired up the encoder as such to test:

A -> resistor -> GND
B -> resistor -> GND
common -> 5V

As expected, when I rotated the wheel, the results were (keep in mind visible to the eye):

Clockwise:   A and B on, only B, both off
Counter:      only B, A and B on, both off

So it seems that the code from the playground should work adequately, or am I totally off?
Title: Re: rotary encoder chatter
Post by: Daniel on Jul 24, 2007, 12:52 am
hi

can you post a pic of how you have it wired up? You might need some kind of buffering on the output of the slot encoders.

Two things particular to encoders come to mind:
- if the encoders are exposed to ambient light this can cause problems
- encoders sometimes work fine with regular linear motion, but not so well with finger motion, as the finger can cause the encoder to oscillate between positions. This might be cleaned up with software in the computer or the mouse's processing chip.

D