Quadrature Encoder

**Hey Guys,
I’m happy to announce the New Optical Shaft Encoder is now available for purchase.

The New Optical Shaft Encoder is a Quadrature Encoder. We have upgraded the single output to a dual output to make the old optical shaft encoder a Quadrature Encoder.**

these are cool, wish i had these during my comp. i couldve detected if i was being pushed and then lower a mechanism to push them back, hey teams, use this strategy!

How do I write a program to read the new Quadrature Optical Shaft Encoder? The program should detect the shaft changing directions. I couldn’t find updated code for this sensor on this website.

idk yet, but i think one output (to the microcontroller) is for one direction and then other for another direction, other than that i believe it operates the same as a normal one

No, the outputs are quadrature (aka 2-bit Grey Code). See pg4 of the new Inventor’s Guide insert.

In practice, you use one signal as an interrupt. When that fires, you know the encoder has moved. You then sample the other signal to get direction.

Though, I seem to recall that there are cases where this scheme can cause you to loose exact positioning (like if the shaft is slightly vibrating just between two encoding positions). I believe if you want perfect positioning data, you have to track every edge and run it through a simple state machine. I’ll try to find a reference and post back…

  • Dean

Page 4 of the manual for the sensor said that sample code to help you get started is available on the Vex website but the code for testing sensors isn’t updated for new sensors such as the new Quadrature Optical Shaft Encoder and the Potentiometer.

You can also read Optical Encoders using a Motor Controller IC such as the Microchip dsPIC30F2010, which has a Quadrature Encoder Input (QEI). I have used it to measure speed and direction of motors used in my robot applications. The dsPIC30F2010 also has 6 complementary PWM outputs that can drive all kinds of DC motors.

Hey,
I am trying to program a quadrature encoder to sense degrees and direction of rotation, but I’m having a bit of trouble. I plugged one end of the sensor into a digital port, but the ones and zeros don’t seem to correspond to any of the movements. It might be something obvious that I’m just missing, but I would appreciate any input possible.

This is cool but is it going to be programmable in easy c v2 via an update?

If there is an update then you won’t have to buy easy c pro to use the quadrature feature.

If you had read the rest of this thread you would know how to proggram the new encoder…

Specifically post #5

Robofreak asked about using quadrature with Easy C. As of release 2.0 of easy C, you can’t get direction info and there is no way of working with interrupts. Post 5 has nothing to do with Easy C. The question “when is it going to be available for Easy C?” is still very valid!

I have the old shaft encoders and now I can upgrade! lol

The upgrade for quad encoders is coming later this summer along with many of the other new vex sensors.