Introduction: Encoder Commander
The Encoder Commander is a project I made to make it easy to work with motors with quadrature encoders.
The idea will be to plug a motor with encoder in and turn it on. Initially it will be in speed control mode so the big knob will control the speed and direction of the motor. So far not terribly exciting... just a speed controller with an analog input. But you can use the speed control to get the motor into the position you want for the first endpoint, press the endpoint A button, then get the motor into the position you want for the second endpoint and press the endpoint B button and Bob is your mother's brother, you are now in position control mode and the knob will move the motor back and forth proportionally between the endpoints you've set up.
It is worth noting that while you can plug two different styles of motor into the Encoder Commander, it is designed to only have one motor plugged in at a time.
Step 1: What You'll Need
Step 2: About PPR, CPR & Quadrature (Incramental) Encoders
I've put together this PDF to help understand the difference between PPR and CPR and understand what the usable resolution at the output shaft will be.
Also if you want to learn more about incremental encoders I'd steer you towards this great video:
Step 3: Deploy the Code
I like to deploy the code to the arduino first (even if it is just a blank sketch to start with). If I connect things to the arduino and there happens to be a sketch from a previous project on it, it could yield undesired results when powered on.
BTW have I mentioned how much I love codebender.cc? Seriously if you have not used it, go check it out and come back. Edit: I just learned that if you create a codebender account using this link I might someday earn a t-shirt :)
Step 4: Build the Box
I'll go ahead and let the photos do the talking. Most photos in this instructable have annotations - click the photos to see them.
Step 5: Electrical Prep
I like to get all the bits in order. Again click the photos for the notes.
Step 6: Add the Arduino and Power
Step 7: Add the Pot, Motor Controller, and Power Rails
Step 8: Motor Mounts & Ports
Step 9: Buttons & LEDs
Step 10: Wire It Up
I want to give a shout out to the folks at 123D Circuits for their help! Thanks to them the motors (with encoders) as well as the motor controller I used are now in the 123D Circuits component library!
Step 11: Finishing Touches
Now that you are all wired up you can go ahead and attach the top and sides.
While I was in the process of building & testing it I actually attached the top via a hinge rather than hard mounting it.
Step 12: Test It Out
Go ahead and test it out. Quadrature encoders are incremental encoders. You can think of them as counting up or down depending on which way the motor is turning. If you get into a runaway state (the motor spins forever never reaching the target) it is probably because the motor or the encoder channels are connected backwards. This would be like saying "OK you are at 10, now count backwards until you get to 20". Either reverse the motor + & - or reverse the encoder channels A & B and you should be good to go.
Also reversing the two reference (non-wiper) wires on the pot will change which direction the motor spins relative to the direction of the pot.
We have a be nice policy.
Please be positive and constructive.