Optical Shaft Encoder

In order to attach the Optical Shaft Encoder kit, I think that I need to use a longer axle. Any suggestions?

Yes, you can use a longer axle and have the Encoder mounted to the same axle that drives a wheel. That is the easiest method, but you could have the Optical Shaft Encoder attached to any axle in your drive train.

Is there a way to use a Op. to turn a motor and then have it return to a home position? I’m using this idea on my R2D2 and the dome needs to be able to return the dome to a forward (home) position.

The Optical Shaft Encoder can only determine revolutions of a shaft or axle. The Optical Encoder does not turn a motor; it can only determine how far the connected shaft motor has rotated. With this data you can write code to turn a motor until a certain position is reached and to reverse the motor until a certain position is reached. You must write the code to obtain this functionality.

The Optical Shaft Encoder instruction sheets indicate using the Interrupt bank but the instructions indicate you may be able to use a Digital port:

“You’ll need to plug your shaft encoder into any port in the Interrupt
bank on the Vex Microcontroller. Depending on your specific
application, you may be able to use any port in the Analog/Digital bank.”

What is the appropriate usage? Why would you use an interrupt versus a digital port? I tried the digital port with what seemed to be somewhat unpredictiable results.

The Radio Shack devices I purchased indicate 100 ticks per revolution yet this web site indicates 90… are there really different devices?

For Interrupt usage, see Interrupt posts https://vexforum.com/t/interupt-ports/12392/1 .

The correct number of ticks is 90. We have updated the Inventors Guide posted on our web site at [http://www.vexlabs.com/vex-robotics-optical-shaft-encoder-kit.shtml .

Yes, you add up the ticks and 90 equals 1 revolution.](http://www.vexlabs.com/vex-robotics-optical-shaft-encoder-kit.shtml .)

What is the best way to mount the Vex shaft encoder?

**There is no best way. The Vex Shaft Encoder comes with several mounting holes, and a square shaft hole.

The tough part is integrating it into your system as elegantly as possible.

We recommend you try sliding it onto the shaft into the place where you want it, then finding some way to hold it there, using the provided mounting holes.

One robot which we used the shaft encoder on, with great success is seen here:
http://www.vexlabs.com/images/vex-robots/bottlebot-3-700.gif**

Lets say i wanted to find the RPM of a shaft spinning to figure when to tell a servo to shift gears in a transmission. I know it tells distance but can it combine rotations and time?

Yes you can do this but you must write the code yourself to accomplish this task. Refer to the Invertors Guide for details on the operation of the sensor. Set up a counter to flag you every minute. You also need a counter for the number of pulses that are occurring from the sensor. Check and save the number of pulses every minute (and clear the count). Now divide this number of pulses by the number of pulses required for one revolution (90) and you will have your RPM.