How to Encode DC Motor?

I am working on a vending machine project and I will be in need of 9 small motors. I want these to be very small, but they will need enough torque to turn a coil that pushes about 8 - 10 “Fun Size” candy bars. I figure I can calibrate the motors so that when I apply a certain voltage for a certain time, I will get one full rotation of the coil, thus dispensing one candy bar. But I can see that over time, the coil will most likely need to be reset, as I will probably NOT be getting exactly 1 rotation, but maybe more like 1.01 rotations each time. So I was wondering if anyone could suggest a solution to this problem. Is there a simple encoder solution I could use to make sure I get one exact rotation each time? Or even just a simple mechanical solution to allow the coil to turn, but then lock it when it reaches the starting point again?

I am also hoping somebody may have a good source for cheap DC mini motors. I need 9 of them, and would like them to have gearing already attached to create torque. Servos are too expensive. I am planning on using a shift register (or 2) to control the motors with minimal output pins. I also need pins to drive an LCD and a 12 or 16 key keypad. So I need to reduce my pin usage. Are there any good old devices I could get for cheap off Craigslist that would have good motors for this? I salvaged some from some old projectors, and I plan on testing with those, but I really want 9 matching motors.

Thank you!

You could put a magnet on the coil, and a reed switch that pulls an input pin low. Stop driving the motor when the switch trips amd then clears; than any switch can be read in parallel on the same input pin. Can find shift registers with pretty hefty drive current (TPIC6C595, TPIC6D595 for example), might be enough current to drive your motors.

Try the salvage places like,,, etc.

wind screen wipers have the same problem, they must always end at the same place.

they achieve this by 'turning off' the motor when the arm is at the bottom, and the motor on when the arm is not at the bottom, to make a sweep, 'just' have a switch in parallel that turns on the motor and just make it long enough to get the arm out of the off point, then turn off the parallel switch, and the motor will perform one cycle and stop always in the same place.

a reed switch or opt sencor makes a great 'off' switch.

What about the ULN2803? I will need to control 9 DC motors, one direction only. I also need to be able to somehow change the motor speed using a resistor or through the Arduino program if needed, but once I find a nice speed, that will be permanent. No need to ever change that again.

I was going to use 2 x 74HC595 shift registers connected to 9 x TIP120 transistors. Is there an IC that has this all integrated and can control 9 motors in this way? I only need to go one direction at a set speed, and only one motor at a time, although it would be nice if it could also activate all 9 for a few seconds. I don't need any motor to be on for more than a couple seconds each.

There are a lot of tiny open-frame gear motors available on eBay, with many gear ratios, all metal gear trains, and a selection of voltages from 3 to about 12. Pretty good value. Larger gear-motors too, but cost more of course. Example of what I mean:

For some applications stepper motors are more handy (but this costs more and are harder to drive).

If I use a high power register like this (, and use the Arduino to activate one of the 8 motors connected to the register, how can I permanently set a speed for each motor? Can I use resistors someplace in the circuit to limit the voltage to each motor? I want to dial-in the speed before hand, and then it will never need to change after that.

When looking at motors, I see they are rated at different voltages and with different RPMs. I want something that will take 5V or less, and turn at 30 to 60 RPMs, maybe 90 RPMs max. No faster than that. What motor shoudl I be looking at? One of the 6V or 3V motors? Is that rating the MAX it can handle?