Serial Servo Controller w/Arduino - Control Up To 12 Servos At Once Using the Arduino and a USB Connection

I'm going to show you how to use your Arduino to control up to 12 servos at once with minimal jitter.  Using a simple serial interface you can control the position of up to 12 servo channels.  Up to 10 snapshot positions can be saved and played back at any time.  Start up values for each servo can be saved as well.

There are two major parts to the application.  The first part I will discuss is the firmware and hardware.  This includes the Arduino and another board we will use to supply power to the servos.  It's important to isolate the servo power supply from the microprocessor power in case the servos need more current than the battery can supply (imagine all 12 servos stalling at once).  If the power supplies are the same you could have a brownout condition on your microprocessor depending what type of power supply you are using.  I will also show you the firmware required to run this application on the Arduino.

In the second part I will discuss some simple software that will allow you to control the firmware through serial commands.  This software provides an interface to the Arduino firmware to control the servos, save servo start up positions, even record a series of positions, or frames, (of all channels saved at once) to playback in sequence when desired.  The software is .Net based so make sure you have the latest .Net framework installed.  I will be supplying an installer and source code.  

Here is a video demo of the project:
Remove these adsRemove these ads by Signing Up
Cool project.
It would be nice to have a web interface so I could control it with any wifi enabled tablet. I think it can be done with php.
soshimo (author)  rocketman2213 years ago
Thanks for the feedback!

I wish I had made the command handling more modular, maybe that's something I can work on. That way you could abstract the handling out and use any transport mechanism you want. In this example it's RS232, for your idea it would TCP/IP. Heck, you could even go wireless with Zigbee or something and really have some power.
I was actually thinking of using some wireless serial transmitters from sparkfun to connect the arduino to a serial port on my server.
But I was considering making pan/tilt mounts with servos for a couple of small security cameras.
Alexisa99 months ago

How many amps can this supply?

Hi! Thank you for this great and useful instructable! It helped me a lot with my robotic project. The only difference is that I used an Adafruit 16 channel pwm servo controller so I modified the arduino sketch and now everything works fine! I would try to hack the control program to add 4 control channels but unfortunately I don't know what to do :( I'm wondering when the new version of the software with ramping control will come! I have another question: I would try to use a 2kb EEPROM, is it enough space? I'm sorry for all those questions and I hope you will have the patience to answer me!! Thank you again for the useful work!!!
Very cool project. Thanks a bunch for the lesson on Arduino controlled servos.
jtlol1 year ago
Hello again,
We are making progress. I unplugged the second servo and tested with just one connected to channel 0. I was able to control the servo position with the slider. When I connected the second servo again, I experienced the same problem as before with both servos just humming and neither responding to commands. EEPROM is on the way so I will be able to test the full solution once the multiple servo issue is resolved. Thank you again for being so responsive.
soshimo (author)  jtlol1 year ago
Hmm, sounds like you might have a connection problem with the second servo (or both). Double check that the servos are not sharing the same data line (that's the yellow wire) and that both lines go to separate ports on the Ardunio. Also, make sure that the grounds and servo power wires are connected correctly on both. I suspect that you might be getting crosstalk.
jtlol1 year ago
It starts to twitch by the way I don`t have an eeprom :(
soshimo (author)  jtlol1 year ago
Okay, the EEPROM is necessary to store the frames. You can still control the servos with the sliders though. When you say it starts to twitch, does that mean the servos are moving the entire travel? When you slide the sliders from 0 to 180 degrees do you see the servo moving appropriately?

On a side note, you can take the code from the C# software - it's open source - and just use the communication DLL from that in your own software, but in order to store and recall frames for later animation you will need an eeprom.
jtlol1 year ago
Thanks for the reply. Yes, I am using the Rev 3 Arduino. Software is 1.0.4. Servos are EXI S1123 9G Micro servo. I am getting entries in the terminal server window: Frame 0 stored, Frame 1 stored, etc. when I hit the Write Frame button and Finished Sequence. 10 Frames Played when I press the Playback button. The terminal reset menu item does seem to put the servo back into startup position, but that is all that seems to work. Am I using the software correctly?
soshimo (author)  jtlol1 year ago
Okay, that's all good information. So it thinks it's talking to the eeprom. That may or may not be the case :). Let's see if the software is actually talking to the hardware correctly and work back from there. When you move the vertical slider of a channel that is attached to a servo do you see the servo move? What does the terminal window say after you move the slider?
jtlol1 year ago
(removed by author or community request)
soshimo (author)  jtlol1 year ago
Okay, what kind of servos are you using? Do you know the make/model? Also, did you see anything in the terminal window? You said you were using the Uno, was it Rev 3? I have an Uno Rev 3 that I can test with - something might have changed there. Finally, what version of the Arduino software are you using?
jtlol1 year ago
Hi Soshimo-san,
I have followed your instructions and can get power to the servos. Unfortunately, when I launch the sketch on my Arduino Uno, the servos move for a split second, then just hum with no movement. Can you suggest something that I can check or test?
soshimo (author)  jtlol1 year ago
Can you reset the terminal? Go to Terminal -> Reset menu.
Also, check the terminal window. Do you see any errors there? Is there any output in the terminal window?
What is the connection status (in lower right corner of window)?
megaduty3 years ago
Thanks Soshimo! This could help me with my 4 servo and 6 servo biped project.
Picture 5.pngPicture 6.png
soshimo (author)  megaduty3 years ago
Glad to help. Sweet looking 3d printed parts there. Maybe you can do an instructable when it's done. There is a new contest coming up that this would be a perfect fit for - grand prize is a $50k 3D printer. Feel free to use whatever you need from my instructable and happy hacking!
cupolo3 years ago
is what I was looking for a long time thanks so much ....... very nice ;)
bqbowden3 years ago
I have a prject for an ardiuno to control groups of selenoids on a schedule. Can you suggest a resurce where I can build this kind of circuit?
soshimo (author)  bqbowden3 years ago
I would start with the Arduino Playground []. There are plenty of examples of using an Arduino to control a solenoid. Just extend one of those examples into a scheduler which shouldn't be too hard to do - plenty of examples of writing a generic scheduler on the web.
njkl443 years ago
take a look at my project:
i control 5 servos just by power from arduino and no resistors or anything. I am currently powering 7 right now but i have a lipo im using
soshimo (author)  njkl443 years ago
I had brownout problems early on with a PTZ camera I was using to control from the Arduino so I've always been wary of using the power from the board. If you are powering from USB the maximum current you can source is 500-900ma. If from a walwart usually around 750-1000ma. I guess you can power your arduino from a lipo as well, but coming from the RC world (fixed and rotor wing craft) it's always a good idea to separate your command/logic supply from your servo/motor supply. As the motor battery drains, which they all do quickly during flight, you may lose control to your craft and suffer a catastrophic crash.
alexw21503 years ago
soshimo (author)  alexw21503 years ago
Thank you sir! It was my first instructable so I was a little nervous about it. I almost had as much fun documenting it as I had creating it, plus it forced me to fix a lot of little nagging things.