Quad Encoder not reading properly

I bought 2 vex optical shaft encoders and received them the other day. I did some programming and I’m sure there’s nothing wrong with the programming.

The problem is, when I turn it on, it works fine, then few more time I turn it, the encoder starts reading off. There’s 90 “clicks” on the wheel right? Like I turn the wheel clockwise, then counter clockwise, and clock wise, it reads 1 off each time. How fast / slow does the optical shaft encoder read?

I think it’s the speed of my wheel, cause it’s going really slow. How slow can the optical shaft encoder read? Wheel is turning roughly 20rpm, and I need complete accuracy, down to the last click. Is there anyway to solve the problem?

I’ve checked the encoder several times and cleaned it with pressured air, switched different encoders several times, redid the the programming several times, comes up with the same problem.

Any help would be appreciated.

Start by posting your Code… Screen Shots are OK, but the actual Code is better… If using EasyC, please indicate Version and Include BOTH files for your Project.

I am assuming that you are reading Both Encoders, and there might be a “bug” in the Quad Encoder function, dealing with changing direction.

Read the Optical Encoder Inventor Guide sheets and the Wikipedia section Incremental Rotary Encoder for more information on how they work…

Quad encoders I believe have 360 clicks v/s the optical which have 90.

I am pretty sure that they are just 90. I bought some a few months ago…

The documentation still says 90 Clicks per revolution…

“The Quadrature Shaft Encoder detects the rotation of an axle that passes through it. It has a resolution of 360 counts per revolution (2 count intervals), and can distinguish between clockwise and counterclockwise rotation.”

SOURCE: http://www.robotc.net/education/curriculum/vex/pdfs/Quadrature%20Encoders.pdf

The device may physically have 90 knotches but because of the phase shift RobotC counts 360 clicks per rotation.

Mmmm… The VexLabs Documentation is not so clear… I was thinking of them as two 90 Count Encoders, but you are right, in that you can detect four states, verses the one state… 90 times 4 is 360…

I need to look at that WPILIB code for Quad Encoders…