Best method for controlling 4 separate servo motors?

As the title says pretty much, I have done some reading around but cant seem to find much on servo's, just steppers and regular DC motors. Would the best method be to use Arduino's with shields, a single Arduino for each motor with a separate power supply or just one Arduino for all 4 servo's? Not really sure what shields to use if they were necessary, or in fact what Arduino to use. Any help would be greatly appreciated!

Cheers

What sort of servos? Control from what?

If standard hobby type (TowerPro SG90 etc) then you can easily connect 4 or more to an Arduino with a suitable power supply. I'm new round here and I've had no problems. I've used Nanos with up to 6 servos but just about any Arduino will do. The standard Servo library works well.

Have a look at Servo - Arduino Reference and the example sketches Knob and Sweep.

Steve

Servos are some standard hobby ones, Hitec, managed to get them all working in turn off one Arduino. Thank for the help.

New issue I was having is that the Arduino I am using only has one 5v output pin. I have tried setting up pins 2 through 5 as output pins using pinMode and digitalWrite, but they wont seem to power the servos at all. At them moment I have the one 5v pin leading into a breadboard and then take leads to each servo from there, but I would like to eliminate the breadboard and just have a dedicated power pin for each servo. Is that possible?

No. The maximum current recommended for an output pin is 40mA and half that if you want your Arduino to have a long life. Rule of thumb is to budget one Amp per servo, so you’re over an order of magnitude out.

The Arduino can control four servos, but it cannot power them. You will need a separate supply for them.

Are you trying to power the servos from the arduino? This is the single biggest reason for failure with servos on the arduino.
Don’t do it.
Here is a pic that shows how you can wire up multiple servos using an external power source.
ServoDiagram.jpg

Yes, I was, was using 4 servos (not at the same time) from the same Arduino. Is the issue powering multiple servos from a single Arduino, or is it advised that you dont power even a single servo?

If the issue is surrounding powering multiple servos from a single Arduino then could I just use 4 Arduinos, one for each servo, or would this still run the risk of failure.

chickwolf:
Yes, I was, was using 4 servos (not at the same time) from the same Arduino. Is the issue powering multiple servos from a single Arduino, or is it advised that you dont power even a single servo?

If the issue is surrounding powering multiple servos from a single Arduino then could I just use 4 Arduinos, one for each servo, or would this still run the risk of failure.

Its not a case of how many Arduinos you need, its the case of how big a power supply you need.
One Arduino will control all of your servos, but you need a separate power supply to power all your servos.
The gnd of the Arduino must be connected to the gnd of the servo power supply.
Tom... :slight_smile:

Just to clarify, I have been using the Arduino to control and power the four Servos thus far without issue. What issues can arise from using the Arduinos to power the servos as well as control them?

chickwolf:
What issues can arise from using the Arduinos to power the servos as well as control them?

I think Spengler said it best - Try to imagine all life as you know it stopping instantaneously and every molecule in your body exploding at the speed of light.

OK, silly movie quotes aside, even with one servo powered from the arduino 5v pin, you are likely to run into problems when you actually have a load on the servo.
Best case scenario, the servo under load quickly exceeds the capacity of the 5v regulator on the arduino and it shuts down.

Or you risk damaging or destroying your Arduino. The damage may not be immediately apparent- it may simply reduce the lifespan of the device.

Ok, that makes a lot of sense, what is the best method of powering the servos then? Would I get a dedicated supply for each one, one for them all? Is there a shield board I can get where the servos connections go in one side and then the supply can slot into the other? Want to use a supply much like the one for the Arduino itself (not the very same one though).

Cheers for all the help!

You CAN use the same supply.

But it is easy to do with 2 different supplies as I show in the diagram on reply #4.

One supply with enough voltage can feed both the arduino and the serovs.
You would need to regulate it down to 5v to feed the servos.
You would need to make sure the right voltage is used to feed the arduino.
Someone with better knowledge might suggest decoupling - I only know it is often needed and put it in place when others suggest it.

Hi,
One supply to power them all. (Lord Of The Rings???)

At the moment if you are using your Arduino to power the servos, and the Arduino is powered through your USB, then your PC is powering the servos, you PC USB 5V is not rated for servos.

If you have a supply to your Arduino through Vin or the DC socket, you are relying on the linear 5V regulator on the Arduino board, and it is not rated to run servos.

So a completely separate supply is the best.

Tom.... :slight_smile:

Adafruit makes a shield that can control 16 servos. Haven't tried it myself.

I had looked at that shield, has anyone had any experience with using it?

Had a look at it and is probably the best option I feel, anyone know where they can be ordered in the UK? Have check RS, Farmell and Proto-pic but couldn't see one, any ideas?

Amazon has if for a bit over 16 (funny L unit of currency)

Fantastic! Thats great, was worried I would have to order it from across the pond. One last thing, what power supply should I use for the shield? Is there a dedicated one for it or do I need something else.

edit: I am looking at 5v, 1A supplys, would this be ok?

edit: I am looking at 5v, 1A supplys, would this be ok?

If you get one for each servo, yes.

About the power supply, we really do not know much about your project.
Are you looking for something that can plug in the wall?
Batteries?

4 D-cells would work.
Bigger Lithium batteries and a buck regulator like this one would get you 5A at 5V.