# Candy Vending machine, how to limit the amount of servos needed?

I'm making some plans for a vending machine that is to be used for dispensing candy in my home.I went for the spiral method (please tell me if there's a better method).

I got all the plans laid out and i got most of it working already.

The problem is: I want to limit the number of servos this project is using. Servos are expensive and they take precious pins on the arduino i'm using for the project.

The question is: I have 9 spirals for candy and i would need 9 servos to turn them and release candy (nom nom).

Is there some ingenious way to limit the amount of servos and still be able to rotate all the spirals independently?

This is basically what i'm making, just smaller :)

I edited it to include a little flash file i made of a rail system using 2 servos and an aktuator.

sort by: active | newest | oldest
Nov 14, 2010. 3:42 AMsteveastrouk says:
Here's a circuit using a 2803.
Oct 18, 2010. 5:48 AMsteveastrouk says:
HI Eirinn,

What do you need clearing up ? A walkthrough the circuit again, or how the darlingtons need wiring ??

Steve
Aug 12, 2010. 8:00 AMRe-design says:
Use stepper motors. I've seen them surplus for as little as \$2 each. Try to get a dozen of the same kind so that they are all alike and you have a couple of spares if needed.
Aug 13, 2010. 7:11 PMRe-design says:
Aug 11, 2010. 11:41 AMkelseymh says:
Since the number of spirals is relatively small (9, not 50), what about something like this? Put the main servo motor on a movable stage, controlled with something less expensive like a pin actuator. Have a gear on the servo axis engage with a stack of N gears adjacent, and use the actuator to move the servo from position to position.

If you use relatively thick gears, separated by their own width, then the servo can't engage two at once, and you get a fair bit of slop in the alignment tolerance.

Theoretically, you could use the tri-state output from a single pin to drive the actuator (+ == forward, 0 = center, - == backward), if it was set up that way.

What isn't obvious to me is whether this is cheaper than servos or not. A quick Google search found pneumatic actuators for \$15-20, or \$100 or more!

Aug 11, 2010. 12:12 PMsteveastrouk says:
Forget the "servo" bit, all you need is a motor that turns a shaft once or whatever. Why does it need to be a servo.
Aug 12, 2010. 9:56 PMorksecurity says:
Usually, the spiral is set such that a single complete rotation dispenses one unit of product. Then all you need is a motor with a cam and a microswitch such that once it starts running it continues running until it completes that rotation and the cam turns it off again. Motors and microswitches can be scavenged a lot more easily than servos, and are less complicated to operate.
Aug 11, 2010. 1:20 PMsteveastrouk says:
Could do with a picture of what you're doing to give you some better ideas
Aug 11, 2010. 2:03 PMsteveastrouk says:
Alright, here's a simple circuit, for a single spiral. It needs a double pole, double throw relay, and little switch which is bumped by the spiral after one revolution.

Switch on the transistor, for long enough that the spiral turns off the switch.
The relay latches ON.
Turn off the transistor.
Now the spiral will turn, until the bump switch is hit, this opens the relay, and the spiral stops.

The limit switch must be CLOSED until the spiral has turned once.

Steve
Aug 12, 2010. 9:57 PMorksecurity says:
.... That's what I was thinking; you described it better than I.
Aug 12, 2010. 8:43 AMsteveastrouk says:
Try this one.
Aug 12, 2010. 8:19 AMsteveastrouk says:
Yes, a plain DC motor.

Speed ? Feed the motor from an LM317 adjustable regulator. I can add that to the diagram later if you like.

You can use a "ULN2803" to drive the relays, I'll add that too.

Steve
Aug 12, 2010. 11:03 AMsteveastrouk says:
Getting the mechanics right would be very tricky.
Aug 13, 2010. 4:37 AMsteveastrouk says:
Aug 13, 2010. 4:14 AMsteveastrouk says:
Just ask, I'll happily clarify it for you. The point is, with the spiral system, you have to have continuous rotation, which the servo isn't designed to do, and costs more than it needs.
Aug 13, 2010. 8:23 AMsteveastrouk says:
How much do they cost, and how much extra programming will you need ? All these things I drew need is a pulse to say "dispense one candy bag"...... Steve
Aug 27, 2010. 5:06 AMsteveastrouk says:
It doesn't matter, because the microswitch will resynch the thing regardless of speed.

Braking: Turn AA2 around, and put the common connection to the motor, the normally closed contact to the motor supply and the normally open to ground. Now its dynamic braked, and stops very fast.

You can't switch more than a few mA with an arduino pin directly, they have to drive transistors, or ULN 2803s to drive anything significant.
Aug 27, 2010. 8:33 AMsteveastrouk says:
The servos I've seen only more 120 Degrees at most, when altered to "constant rotation" they are off, forwards, or backwards.

Here's how the circuit works.

The transistor is a switch here. Switch it on - pulse it for half a second at most.

What happens ? The relay closes.
What happens ? The contacts AA1 and AA2 switch over. The limit switch stays closed.
What happens ? The motor turns, because AA2 is closed. The relay LOCKS on, because AA1 is closed.

Turn off the transistor switch.

What happens ? The relay STAYS energised, the motor STAYS on, because AA2 and AA1 stay closed.

The limit switch opens.
What happens ? the relay OPENS, AA1 opens, AA2 opens. The motor stops.

The cycle completes.
Oct 11, 2010. 3:04 PMsteveastrouk says:
Well there's these, which work out about 1 Euro each.
http://uk.farnell.com/multicomp/hrm1-s-dc12v/relay-pcb-dpco-12vdc/dp/9479953

Oct 12, 2010. 8:10 AMsteveastrouk says:

http://elektronik-lavpris.dk/product_info.php?products_id=88723&language=en
Oct 12, 2010. 8:08 AMsteveastrouk says:
Nah, they'll take anyones money. RS used to be VERY sniffy, but times is hard....

Double pole double throw - two switches, each with changeover contacts.

Steve
Oct 12, 2010. 2:20 PMsteveastrouk says:
Use a "ULN2803" to run 8 relays - sorry, you need 2 for nine relays !

Steve
Oct 13, 2010. 4:04 AMsteveastrouk says:
I'm not sure i know why the transistors have to be coupled to the relays (i know you've tried to explain it earlier).

because its not a good idea to put relay loads on processor pins. The 2803 contains all the transistors you need.

Steve
Oct 13, 2010. 8:31 AMsteveastrouk says:
You don't get the isolated but related switches that the design needs, unless you do it the way I've drawn it, and the designers intended.

Transistors are a great solution for currents up to several hundred amps, in the right conditions: this isn't one of 'em. An all transistor solution is possible, but here it would likely be more expensive and less reliable.

Steve
Oct 14, 2010. 10:17 AMsteveastrouk says:
Looks like all you need there.

Well, I2C is an addressed protocol, just change the address of your Atmega to make sure it doesn't clash with the RTC.

Steve
Oct 14, 2010. 11:25 PMsteveastrouk says:
Nope. Won't do the same job as the relay drivers. Not enough current carrying capacity
Aug 11, 2010. 10:15 AMsteveastrouk says:
There are several ingenious ways of doing it, it depends how good your coding skills are - a serial/parallel converter, like the 595 gate will let you run 8 or 16 or more servos on the SPI pins on the arduino.

I don't know what happens to a servo if you take the PWM input off, and tie it high or low ? Will it freeze, or will it just slam to one end or the other ?

Steve
Aug 11, 2010. 12:14 PMsteveastrouk says:
Servos don't have a polarity, they expect a PWM signal, with a 50Hz frequency, and a 20--200uSec period AFAIR. Steve
Aug 11, 2010. 10:17 AMkelseymh says:

I don't think you can limit the number of servos, not without some even more tricky (and control-pin consuming!) "gearshift" system. But you might be able to reduce the number of control pins from 9 to 4.

For the real electronics experts out there -- would a charlieplexing setup work for this application? (Charlieplexing allows n tristate controller pins to drive up to n2-n LEDs.)

Instead of LEDs, I'm picturing just regular diodes to restrict the current to just the desired channel, with the servo on the "output" side of the diode. The controller wouldn't need to do the fast-flicker POV stuff that charlieplexing ususally entails, just hold the output pins in the right state for the servo to make one rotation.

There is probably some obvious engineering reason why this is a bad idea, but I'm throwing it out there anyway.

Aug 11, 2010. 10:29 AMsteveastrouk says:
I can't see how charlie-plexing helps here, Some form of multiplex, sure, but a C-plex not really - its an LED drving scheme and little else.