Controlling Servo Motors

Can anyone tell me if it is possible to individually control 3-6 servo motors on a single microcontroller? I'm planning on building a robotic arm, and the answer to this question will decide if I am able to do that...[smiley=undecided.gif]

Yes that is possible. The latest servo library supports up to 12 servos from a Duemilanove or similar...

arduino.cc/en/Main/ReleaseNotes

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

The thing is though the board cannot supply so much current so you'll have to power the servos from an external source.

Here is a link to a topic I created recently asking similar questions which may be of help:

www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1251519060

Actually, scatch what I just said... :-X
Is there a microcontroller I can use that has enough pins to be able to control 6 or more servo motors along with the same number (6 or more) of potentiometers? It doesn't matter to me if I would need an external power source, although it would be preferable to have the electricity supplied by the board.
Would I be able to use a Roboduino or an Arduino Mega?

Is there a microcontroller I can use that has enough pins to be able to control 6 or more servo motors along with the same number (6 or more) of potentiometers?

Assuming by "servo motors" you mean R/C servos, yes, the Deumilenova will do this (up to six pots - if you need up to eight, use a Nano).
Current for six or more servos from a microcontroller is always going to be a problem; just use an extra set of NiMhs to power them.

ALL Arduino boards can drive up to 12 servos!! The Mega boards up to 48.

The Roboduino is no different than a standard Arduino board (eg. the Duemilanove) in that sense. But the pin layout is more convenient for attaching servos = less wire spaghetti.

Likewise ALL Arduino boards have 6 analog in's (which is where you would attach the potentiometers). 12 on the Mega boards. However it's possible to expand that number with an analog multiplexer. An 8 channel multiplexer only costs around 1 $. That way you can actually read 8 potentiometers from 1 analog in :slight_smile: However that also requieres 3 digital I/0's to control the multiplexer. But since you only used 6 digital I/O's so far (for 6 servos) you still have 8 to spare so that shouldn't be a problem.

Thank you very much for your help! As you can tell, I'm just a wannabe robotisist with a very limited knowledge on the subject of electronics...

So, let me get this straight:

  1. The Roboduino, the Arduino Duemilanove, and the Arduino Mega ALL have enough pins to control 6 R/C servos and 6 potentiometers.
  2. To add sufficient current to the servos, I will need to use batteries (NiMhs).
  3. Also, where would I attach the batteries? Is there a spot on the board itself, or would I need to hook everything up to a breadboard and attach them on there?

Your welcome...

  1. Yes (more than enough)

  2. You will need en external power source. Could be batteries. Could be an AC/DC adapter. I advice you to do a bit of research on the (peak) current draw of the particular servos you're using. Make sure your external source can supply the appropiate amount of current.

  3. I presume the RoboDuino has some way of connecting an external power source directly to it (if not that neat pin layout would be completely useless). Otherwise you'll have to figure out your own way of doing it. Could be a breadboard.

Last thing: it is important that the ground of the Arduino is connected to the ground of the external power source!!!

Aniss1001

Keep in mind, you can power the arduino through the VIN pin. Also, you can use any power that comes through the AC/DC adapter through the VIN pin.
Be careful when you're using adapters, as they can (more often than not) give more voltage than the adapter says. (12v adapter of mine is 17v. Another 9v adapter has about 13v. You don't want to fry any components :D)

BUT NOTE:
If you're trying to power the Arduino through the VIN pin, you need to have the power regulated to 5v.

When you're coming in through the DC plug in, you're going to need at least 7.5 volts (ish) any less and the regulator won't regulate correctly, resulting in a lower voltage.

You can also buy some 2.1mm barrel jacks, and then solder some connections from the battery packs to the barrel jacks.
(Not the best choice for recharging the batteries, unless you make your own charger with the same barrel jack, then that would be sexy.)

12v adapter of mine is 17v. Another 9v adapter has about 13v.

That sounds rather abormal? I just bought an old used AT power supply for a few bucks that I'm converting into my personal robotics lab bench supply :wink:

It seems to be a bit off too. Like 0.2 - 0.5 volts. I thought THAT was a lot. But compared to yours it's a steady little beast for sure..

What kind of adapter are you using? Doesn't it have any form of regulation?

you're going to need at least 7.5 volts (ish) any less and the regulator won't regulate correctly, resulting in a lower voltage.

If you are using the latest Arduino board (Duemilanove) then 6 volts or more will be sufficient (the regulator used on this board has a dropout voltage of 1 volt). But servos can draw more current then the onboard regulator can comfortably provide so you may need an external power supply for the servos.

Most servos have a maximum voltage rating of 6 volts so a regulated supply or batteries is best. I would not connect an unregulated power supply that provides more than 6 volts directly to a servo.
If using an external supply or batteries, don't forget to connect all the grounds (supply, arduino and servos) together.

12v adapter of mine is 17v. Another 9v adapter has about 13v.

Actually, I've seen this quite often. Under the load that the power supply originally came with (I get most of my power supplies from junk electronics) the output might be close to the label. The open voltage (which is what you measure with a multimeter) is often quite a bit higher. I don't understand enough about power supply design to know why, but I usually end up using voltage regulators that have a max input higher than the open voltage anyway.

I don't understand enough about power supply design to know why, but I usually end up using voltage regulators that have a max input higher than the open voltage anyway.

A typical 'wall wart' DC power module is just a unregulated DC power source. It has only a transformer, rectifier and filter capacitor inside. With no current being drawn from the module, the voltage will rise to the peak value of the secondary AC voltage (minus the rectifier diode drop) and will lower as more current is drawn the voltage will lower towards the rated voltage.

So this behaviour is normal and should be understood and dealt with in any design or usage of these kinds of power modules.

Lefty