Step 4: Upload Firmware

The first step before we can upload upload the firmware is to install the Arduino environment.  If you haven't already installed the Arduino environment or you have an older version than v1.0 you will need to download and install the latest version.  The Arduino software can be found here [http://arduino.cc/en/Main/Software].

Before you can compile the firmware, it's necessary to install the i2cEEPROM library.  This library gives us access to the 24lc256 family of serial EEPROM chips.  The chip is used if you want to support data storage.

Data storage is used to hold saved positions for playback, initial positions, and user custom data.  I'll show a custom step at the end of this instructable that illustrates how to easily add this feature.

Note: It's not necessary to have the serial eeprom connected to your Arduino for this application to work, but it is necessary to install the library in order for you to properly upload the firmware.  The firmware supports the features if the hardware is present.

Download the library as a zip here:

The source can be found here:

Open an explorer window and open the folder at <Documents>\Ardunio.

Create a directory called libraries (if there isn't one already).

Unzip the contents into the libraries directory that you just created.  (Note this library only works for Arduino v1.0 and later versions).

Your directory structure should look like this:

Close all Arduino windows and restart the Arduino software.  

Check that the library was loaded correctly.  
Navigate to the library import menu: Sketch -> Import Library.  

On the list of available libraries to import you should see i2cEEPROM.  If you don't see it, make sure you have the path correct as above and shut down all instances of Arduino before restarting.

Finally download the SerialServoControl sketch:

The easiest way to get the sketch into your Arduino environment is to create a new sketch called SerialServoControl.  Open the .ino file  downloaded above in notepad (or your editor of choice).  Copy the entire file's contents and paste into the window of the new sketch you created.  

Save the sketch.

Upload the sketch to your Arduino.

Next we will hook up the Arduino to the servo controller board we built in the last two steps.

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: