Introduction: Encoder Commander

About: I work at RobotZone ( the folks behind Actobotics and ServoCity.com ) in Winfield, KS. I love working on projects with my kids and seeing what they create.

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

QtyItem
990° Dual Side Mount (585470)
1Attachment Blocks B (585600)
2pattern plate (585002) (3x4 pattern)
2pattern plate (585580) (1x3 pattern)
4grommets for feet (636088)
1Arduino Component Mount (585010)
12.5mm ID x 5.5mm OD Panel Mount Jack (163-4303)
1DPST HD Toggle Switch (605049)
2Momentary Square Push Button Switch (605051)
some male header rows
21x4 female header rows
11x6 female header row
21x6 female header row (for the mini power rails)
a variety of jumper wires (I like the ones from adafruit.com)
1Arduino
23mm LEDs
1Potentiometer Board A
210k resistors
2220ohm resistors
heat shrink
1JST PHR-6 Equivalent male connector
118v7 Simple Motor Controller (605060)
1laser cut motor controller mount
32-56 x 0.25 standoffs for mounting the motor controller (534-1801B)
62-56 x 3/16 screws for mounting the motor controller (91251A076)
3dual screw plates (585472)
8#5 washers (90126A306)
8#6 nylon spacer (561-KSP92)
41" 6-32 screw (632124) for mounting the pot/motor controller assembly)
66-32 nuts (585474)
21/2" 6-32 screws (632114) for mounting the mini power rails
85/16 inch 6-32 screw (632108) for mounting the motor wire ports, and motor mounts
51/4" pan head 6-32 screw (90272A144)
161/4" socket head 6-32 screw (632106) for the enclosure assembly
193/8" socket head 6-32 screw (632110) for the enclosure assembly
1laser cut top plate (mostly aesthetics, but it does hold the LEDs nicely)
1laser cut side plates (optional)
1pot knob (optional)
Last but not least pick the motor with encoder that is right for you:
Heavy Duty Planetary Gear Motor with Encoders
Planetary Gear Motors with Encoders

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.

Happy Commanding!