Go Down

Topic: Arduino with 12 servos (Read 12826 times) previous topic - next topic

Ran Talbott

Just so you know:  I've been buying surplus by mail order from MPJA (Power Supply Depot) for many years,  and also dealt often with the Excess Solutions folks at the electronics swap meets back when I lived in Silicon Valley.

They're both good companies,  and I wouldn't hesitate to buy from either.

Given the costs of shipping,  though,  I would definitely suggest you look for an old AT-style PC to scavenge a power supply from first.  An AT is better than an ATX because you're more likely to find one for free,  and its main output will be 5V,  instead of 3.3V.



Aug 31, 2009, 11:11 am Last Edit: Aug 31, 2009, 11:12 am by Aniss Reason: 1
I was kinda getting hot on the idea of building a general purpose robotics lab bench supply out of this little fellow (or similar). This little 145W micro ATX supplies 5V-(up to)14A and goes for (down to) 11 us$. :)


On the other hand I probably wont need the 14A or the other voltage outputs..and I definately don't need a fan  :-/...so let's see..tomorrow I'll go check the local (Buenos Aires) marked and see what I can come up with ......


I will study mem's explanations more thoroughly later:

But they seem (after a short look) to correspond to my understandings. The servos are not controled by PWM but a simple digital signal of highs and lows where the distance (in ms) between the high-low shifts determines the servo position.

The PWM pins are digitally "simulated" analog i/o's used for controling the SPEED of continously rotating dc moters, or receive analog inputs.

Anyway that how I'd understood it...

And to mem:

Isn't it correct that since the newest arduino release one can use the STANDARD servo library (servo.h) to control up to 12 servos?


* Replaced the Servo library with one (MegaServo) by Michael Margolis. Supports up to 12 servos on most Arduino boards and 48 on the Mega.


Ran,  I had a quick look at the current pulses on an  HXT900 servo and got similar results to the trace in the link in your post. The motor current is a pulse of around  700ma for something like  40% of the time. This would imply an average current of around  350ma for a single servo when moving.  Two servos moving present a complex waveform but my very quick tests indicate that the average current with 12 servos looks like it would be under 5 amps.  When the servos are stationary but under load the pulses are only around 2ms long so the average total current in this case would probably drop down to under 1 amp.

The current Servo library is based on the MegaServo code and this does pulse each servo in succession so no two servos are pulsed at the same time.

I only have two of the servos HXt900 (aka TowerPro 90) servos so can't do a definitive test but I would guess that 5 amps power supply would probably be sufficient and an 8 amp supply would give extra headroom.


Isn't it correct that since the newest arduino release one can use the STANDARD servo library (servo.h) to control up to 12 servos?

That is correct (I wrote the Library)



Thanks mem..you've been of great help..

And I'll keep your estimate about the actual total current draw in mind when I go shopping tomorrow....


A follow up on the tale of the 12 servos...Never would have thought it would be so tricky and expensive to power these little things...

I managed to find one of these today (capable of 5V 8A):

...and apparently no fan necesary (I asked in the shop). Unfortunately it costs 30 us$ (without cable or anything) which is somewhat expensive (for a "dirty" solution like that)..

I also checked some ATX's and the cheapest ones here go for around 20 us$. But I was unable to find any below 400-450W. I'll probably not use more than 50 (at peaks) even if I add a few more servos and they all stall at the same time (according to mem's judgement?). So having a 450W beast running seems kinda crazy, quite a waste and perhaps even dangerous??

On the other hand I don't know enough about electricity to determine whether that's gonna be a problem. The 145W seemed pretty high to begin with. But 450 sounds just cracy..

The strange thing is that these 400+ beast could only supply 10A at 5V, while the ideal ATX of 145W could supply 14A at 5V?!

Perhaps related to what Ran mentioned earlier (that 5V is becoming less commonly used in modern PC's)..?!

I would definitely suggest you look for an old AT-style PC to scavenge a power supply from first.  An AT is better than an ATX because you're more likely to find one for free,  and its main output will be 5V,  instead of 3.3V.

And about shipping things to argentina. It's not just painfully slow and expensive. But also risky. So you'd wanna use one of the better shipping services, if you actually want to receive your stuff...which makes it more expensive. Then there is the customs. They generally add 50% to electronics goods (allthough you CAN get lucky and you wont pay anyhting). Furthermore they can take weeks (if not months) to "process your case"...

Alltogether a pretty bad setup :(

The other option is buying things here. It's generally (talking electronics) 50-100% more expensive than USA (worldwide) prices, and it's very difficult or imposssible finding anything just a bit out of the ordinary (like a 145W-399W ATX).

Why did I move here again  ??!!  :-/ ah yeah, the meat and wine is cheap as hell and of sublime quality... And the women are truly stunning..hehe :)

Anyway tomorrow I'll follow Ran's advice and go look for an old/used ATX/AT (if possible). And I'll also check out a local indutrial electronics parts shop for cheaper 5V 8A single output supplies...

Hasta luego


Hola Aniss.
check out the RC market. They got a thing called BEC.
i got Castlecreations BEC it can be driven from 5v to 25v and at 12V it has a peak at 7A, with output voltage from 4.8V to 9V. so if u want 6V and 5A on sec side u need 12V and 2.5A + some lost, on prime side.
Maybe not the thing your looking for... its early in the morning and i wanted to write something  ;D


Hola SteNull!

Sure sounds like a neat product... But it doesn't really solve my problem.  ;D

I need a stable, regulated, ac/dc converter 5V/8A (min.) for long hours of robot programming/experimentation. And they're just not so easy to come by.

But I think I've decided on the cheap solution: Building a robot power supply from an AT(X). I finally found a place that sells used AT/ATX supplies not too far from my flat:


The prices are in pesos (divide them by 3.8 and you've got us$), so they're pretty damn cheap. Plus they've got some very low Watt AT's as well. :)

Anyway thanks for the input...and goodnight...here it's 3.25 in the morning and I'm off to bed...


Sep 02, 2009, 01:55 am Last Edit: Sep 02, 2009, 06:01 am by Aniss Reason: 1
So I bought a cheap used AT 200W power supply (due to Mem's and Ran's) suggestions.

Here are the specs:

It has a total of 24 DC output wires, bundled into 4 or 6 header ouputs, like this:

I need help to identify all the colors.. here is how far I got:

4 x yellow -> 12V (max 8A) ... sometimes -5V???
7 x red -> 5V (max 20A)
1 x orange -> Power good or 3.3V or -5V???
10 x black -> Ground (0V)
1 x blue -> -12V
1 x white -> power good or -5V???

I'm a confused about the colors because I found contradicting info:



Yellow +12 volts
Black Common
Red +5 volts
Orange -5 volts
Blue -12 volts
White Power good



Pins (1-12):
Orange "Power Good"      
Red +5V
Yellow +12V
Blue -12V
Black Ground      
Black Ground
Black Ground
Black Ground
Black Ground
Yellow -5V <- This one is strange?!
Red      +5V
Red      +5V



+5 (RED)
-5 (WHITE)
+12 (YELLOW)
-12 (BLUE)
Ground (BLACK)
Switch (GREEN)
+3.3 V (ORANGE)



Red = +5V
Black = Ground (0V)
White = -5V
Yellow = +12V
Blue = -12V
Orange = +3.3V
Purple = +5V Standby (not used)
Gray = power is on (output)
Green = Turn DC on (input)

Ran Talbott

You've definitely got an XT or AT power supply there (I can tell from the motherboard connectors).

You can't depend completely on the wire color:  not everybody followed the standard.

But you can depend on the sequence of the wires in the connectors,  because anyone who didn't follow that standard would start fires  ;)

So use the connector info on this page.

You might also want to use something like this,  instead of the binding posts in your how-to article,  to save money on connectors.  Though it's less convenient,  so you may want to spend the extra cash.

Just use the power wires from the motherboard connectors:  don't bother with the ones from the disk drive connectors for now.  You might even want to save them for make quick connections to other projects later.

Oh,  and don't forget that fat 10 Ohm resistor:  most switching power supplies like to have a minimum load on them at all times to help maintain regulation.



I'm sorry, I just had to come post this here, kind of goes with hooking up alot of servos!



To Ran,

But you can depend on the sequence of the wires in the connectors,  because anyone who didn't follow that standard would start fires

In that case my AT supply may be a fire starter :) If this is the sequence you mean:

Pins (1-12):
Orange "Power Good"      
Red +5V
Yellow +12V
Blue -12V
Black Ground      
Black Ground
Black Ground
Black Ground
Black Ground
Yellow -5V <-strange??
Red +5V
Red +5V

Mine doesn't have a 12-pin connector. It has 3 x 4 pin connectors colored yellow, black, black, red (like they should be).

Then it has 2 x 6 pin connectors, which are colored:

Connector 1:
Pin 1: Orange
Pin 2: Red
Pin 3: Yellow
Pin 4: Blue
Pin 5: Black
Pin 6: Black

Connector 2:
Pin 1: Black
Pin 2: Black
Pin 3: White <- This should be black??
Pin 4: Red <- This should be yellow?? .. -5V??
Pin 5: Red
Pin 6: Red

On the other hand mine does correspond to this (allthough mine ISN'T supossed to have 24 pins but only 20?):


And this:


So it would seem the wires on my AT goes like:

Red: 5V
Yellow: 12V
Black: Ground
White: -5V
Blue: -12V
Orange: Power good
(no 3.3V)

But I have another question. I AM aware that I have to use a fat power resistor as you mention (between the red and ground I believe). But I'm not sure HOW big it has to be. The specs says nothing about the minimum power load. But apparently it varies greatly from AT(X) to AT(X). So I should actually get a resistor corresponding to the minimum load of MY AT?! Any suggestions here?


Sep 02, 2009, 12:18 pm Last Edit: Sep 02, 2009, 12:37 pm by Aniss Reason: 1
....And while I'm at it yet another question....

As seen on this photo:

...the AT has 2 AC plugs. The lower one is for my cable and I'm not sure whether the upper one is an output or a redundant input?

Each plug has 3 connections:

Lower plug:
1 Brown
2 Blue
3 Green

Upper plug:
1 Black
2 White
3 Green

The green wires on both plugs connects to the casing like this:

Lower plug-brown is connected to upper plug-brown. Lower plug-blue is connected to upper plug-white (see specs - wiring diagram).

Upper plug-white and black are both connected to the PCB board as well.

Now..couldn't I just REMOVE the UPPER plug and connect the lower plug-brown and blue directly to the PCB??!!

That way I could use the hole left as a small "interface" (5v-out, Ground, Power switch and a LED)...as well as gaining more workspace.

I'd also like to ask (since the AT has no power on switch) is it recommendable to make the power switch on the AC connection (like the specs' wiring diagram) OR simply placing it on the DC output ground? Perhaps both would be prudent?

Sorry for asking so many questions.... :-/

Go Up