Let's Make Robots!

Number of Servo's Attached to an Arduino.

Just a quick question that I'm struggling to get a straight answer from the intertubes about...

I'm looking at purchasing an arduino board to control some servo's, and wondering how many each can control?

For example: Uno R3 has 14 digital i/o pins (6PWM outputs), and 6 analog inputs. What does this mean exactly?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

The Arduino Servo Library will let you control up to 12 servos on the Uno and other standard controller using an ATmega8, ATmega168 or ATmega328. I'm not sure about Leonardo as I have never used it. Some of your analog pins can if necessary be used to drive servos as well since you analog pins A0 - A7 are digital pins D14 - D21. I mention A6 and A7 here as the SMD versions of the processors have 2 extra analog inputs.

Any Arduino Mega compatible controller using the ATmega1280 or ATmega2560 processor can drive up to 48 servos on any of 62 pins (D2 - D53 + A0 - A9).

If you want to drive servos from standard Arduino boards then you will need to make up a PCB or something to supply power to the servos and then run jumper wires from the Arduino to the servos. Make sure your Servo ground and controller grounds are connected. You may be able to buy a shield for the Aduino boards to simplify this.

If you want to make something with more than 12 servos then the Spider controller from DAGU is the best value for money. It is an Arduino Mega compatible board that has all 70 I/O pins broken out into servo compatible 3 pin male headers as well as a female header like standard Arduinos.

The Spider has a 5V @ 3A switchmode power supply that will run on any DC voltage from 7V - 30V and can drive up to 48 miniature servos or 28 standard servos.

If you want to build a Humanoid or Hexapod then your going to need heavy duty servos running directly from a 7.2V NiMh or 7.4V LiPo battery. A hexapod with 18 servos can easily draw currents that peak at 20 or 30A when your servos are under heavy load.

In that case The Spider has a shield that allows it to drive high powered servos directly from the battery and still drive smaller servos from the 5V supply.

 

 

Short answer is you can control as many as 48 servos using one Arduino (the Dagu Spider) with the right shield. Without a special shield and the right power configuration you can expect to get one or two to function. Nominally you would be able to control one servo per PWM channel but with the servo.h library there are some timer things happening that limit that further, however if you wanted to "bit bang" your servo control you might get 6 to work with an UNO, a STRONG battery and no shield.

PWM stands for Pulse Width Modulation. You can think of it as a way that digital signals mimic analog signals by varying the time between turning on or off the power. ALL Arduino I/O pins are technically digital, it's just that 6 of them have Analog to Digital converters built in when you use them as inputs. (Remember that when you think you're running low on digital pins and you just need one to a half dozen more.) The metaphor there is that they have a miniature power meter on them that tells the Arduino computer how much voltage is coming into that pin.