Using Shaft Encoders

We have a pretty cool system worked out this year I think. We are using left and right motor drive and we have extreamly precise shaft encoders attached the each motor. I have written the code to control the motors depending on what each shaft encoder is reading. A calculation converts the joystick unsigned char into ticks per 26.2 millisecond loop and then the shaft encoders deciede whether the wheels are going slower or faster then the wanted ticks per loop coming from the joystick. If the joystick ticks and the actual shaft encoder ticks are not equal they are adjusted till they are. What this means is that we can achieve perfectly straight driving and perfect turns. This is also a huge advantage in autonomous mode because we can hand a sub routine a string of values telling the shaft encoders what the motors should be doing and the routine executes it flawlessly. It’s much better working in distances than working in loop cycles. Hooray for this years robot control. :smiley:

Would you know how to setup these shaft encoders?


I’m not sure you are going to get an answer. The gentleman who started this thread has not posted in over 9 months so he is probably not active.

Your question is kinda vague.

Do an advanced search for “encoder” for the last few weeks and you will get some good info. If you still have questions, please ask away.

Hey guys, I’m the one that started this thread about a year ago. I have since graduated from high school and I don’t believe that my old high school is participating this year. But I would be happy to answer any questions you may have on shaft encoders. We got pretty good with them. Ask away!

Does anyone have a picture of how these are physically tied in with the motors? I want to show the team how it worked for others-directly off a drive shaft, using chains or belts, etc.

Where you can connect will have alot to do with your encoder. Some can support higher RPM (like 5000 RPm). Some of the cheap ones can only support 100 RPM or so.

D. Viddy - I assume you used the fast c routines to read the encoders. Could you elaborate?

I uploaded a photo of our encoder mount to the 2004 robot gallery.

The red encoder has the large white gear mounted on it’s shaft and the two are mounted by a simple bracket to the robot base. The large white gear is driven by the small white gear mounted on the shaft itself.

Encoders are great, but you have to be careful how you mount them because they don’t handle side loads very well. One way not to mount them is with a sprocket coupled to your drivetrain’s chain.