Encoder direction problem

Status
Not open for further replies.

brakecane

New member
Hello,

I'm trying to use the Encoder.h library with Teensy. The program compiles without any errors and sort of works but not very reliably. I am using a standard rotary encoder and connecting the output of the encoder directly to pins 7 and 8.

My code monitors the encoder in a loop and does a serial print on whether it is turned clockwise or counter clockwise. So, when I turn the encoder in one direction, it reports the wrong direction about 25% of the time. Has anyone here encountered a similar problem?
 
Difficult to say since there are tons of different Encoder.h libraries out there in the wild... one common problem with wrong readings is with cheap mechanical rotary encoders where mechanical contact bouncing may lead to extra-pulses. Some libraries do handle that, others don’t and expect you to debounce your encoder in hardware, i.e. with 2 RC low-pass filters and optionally 2 Schmitt-Triggers.
 
How far does the encoder move in one click? Some will jump a fair number of steps per detente which can make life interesting. Posting your code and possibly a photo of your wiring would help here.
 
The problem (as usual) is that the OP did neither share his code, nor schematics, nor details about the used components (i.e. encoder data sheet)...

Knowing that there are many encoder libraries and an infinite number of encoder hardware, the OP did just not provide enough information to give qualified support. He also did not reply for more that 12 hours. I'm not sure if this is serious.
 
Status
Not open for further replies.
Back
Top