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:

Step 1: Parts List

The following is a list of material and items I used for this instructable:

1x Arduino Board (Any variant that has a 328p processor)
1x BreadBoard
1x Battery 6.0-8.0Vdc (I used an 800maH LiPoly battery)
1x 1N4004 Diode
2x 220uF 35V Electrolytic Capacitors
4x 3 Pin Headers  (Use as many as you have servos for, I used 4 for this example but the firmware supports up to 12, just repeat)
4x 100 ohm resistors (1 for each servo.  These are used for current limiting.  At 3.3v the resistor limits the amount of current through the microprocessor at 3.3ma if a low impedance load is seen)
1x Small LED
1x 470 ohm resistor
1xSwitch (I used a DIP switch for simplicity)
 4xHobby Servos
Various Jumper Wires
Cool project.<br> 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.
Thanks for the feedback!<br><br>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.<br> But I was considering making pan/tilt mounts with servos for a couple of small security cameras.
<p>Is it possible to do this with Arduino101 board? I need at most 2 servos, so I'd like to make sure.</p>
<p>What is an Arduino101 board? If it has at least a 328 chip, or equivalent, and you have the supporting libraries it should work on any board really. The pin outs will most likely be different so you will have to make the translation yourself, but it should work on any Arduino compatible board really.</p>
<p>This is so great. Thanks</p><p>I know you don't want to support changes, but can you add the ability to stream moments from a file to a channel. Like maybe, 6:28 would move channel 6 to a position of 28. 3:90, 4:30 would move channels 3 and 4.</p><p>Let me know what you think and Great Job.</p><p>Bill</p>
<p>Hi Bill, sorry for the late reply. I've been busy at work and all that. Anyway, if you have some changes feel free to raise a pull request on the repo and I'll take a look. If I like them I'll either merge into main branch or create a new branch and credit you with the changes. Feel free to fire away man - those changes sound awesome.</p>
<p>Thanks to this project I learned a lot. But I just want to ask something.. If I'm to use 10 servos, in which pin am I supposed to attached it? I'm using Arduino Uno. Thank you in advance.</p>
<p>Great Project,</p><p>How can i adapt your project to control the servos using just the arduino without the servo controller software(sorry for the bad english,i am brazillian.</p>
<p>senior project works well </p>
<p>hello sir,</p><p>I made it.But i have a doubt about the software(Serial Servo Controller 0.2.0).How to record the positions of my Servo and how to play it.This is my question.Please give me an answer.</p>
In the power supply schematic you have shown two servopwr. I am new to this. Can you explain which one to use?
<p>I think that part of the schematic is wrong, the resistor should be put in between the servopwr line and the LED1 (you can deduct that from the breadboard layout).</p>
<p>i have a project to make an arm robot using three servos </p><p>i try to connect them with a dc output supply but it work with a large vibration </p><p>what do you think i might do ??</p>
<p>How many amps can this supply?</p>
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.
Hello again, <br>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.
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.
It starts to twitch by the way I don`t have an eeprom :(
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?<br><br>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.
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?
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?
Hi Soshimo-san, <br>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?
Can you reset the terminal? Go to Terminal -&gt; Reset menu.<br>Also, check the terminal window. Do you see any errors there? Is there any output in the terminal window?<br>What is the connection status (in lower right corner of window)?<br>
Thanks Soshimo! This could help me with my 4 servo and 6 servo biped project.
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!
is what I was looking for a long time thanks so much ....... very nice ;)
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?
I would start with the Arduino Playground [http://arduino.cc/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.
take a look at my project:<br>https://www.instructables.com/id/Arduino-Wireless-Animatronic-Hand/<br>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
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.
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.

About This Instructable




More by soshimo:Online Temperature Monitor w/Raspberry Pi Serial Servo Controller w/Arduino - Control Up To 12 Servos At Once Using the Arduino and a USB Connection 
Add instructable to: