The name says it all. Controlling an RC car servo motor with an Arduino and some resistors, jumper wires, and two tactile switches. I made this the second day I got my Arduino, so I'm pretty proud of myself.

Step 1: Parts List

Okay, your going to need the following:

Arduino-$30-35 USD
Find out where to buy those here.

Jumper Wires-$8.50 USD
I got mine from Amazon

Resistors- Pennies a piece
Get em from Radio Shack, Digi-Key, Mouser, Jameco, etc.
Your goin to need two around 100 ohms (brown black brown) and two around 10k ohms(brown black orange). These don't have to be exact.

Servo Motor- $10 USD
Yes, I know this isn't the cheapest one on the internet. Tower Hobbies

Breadboard- $9-$30 USD, Depending on the size.

Tactile Switch- $0.20 USD
Only 6,427 left on Digi-Key I just salvaged mine...

Step 2: The Circuit

The circuit is fairly simple. You should be able to throw it on a breadboard in five minutes like I did. Make sure it makes no sense to your less geeky family, and looks like a wad of something you pulled off a drain snake. Yum.

Step 3: The Program/Sketch

Here's my code that I used. I might explain it later, I'm kind of lazy. Thats what this and this are for.

#include <Servo.h>

Servo myservo;
int button7=0;
int button6=0;
int pos=90;

void setup()
pinMode(7, INPUT);
pinMode(6, INPUT);

void loop()




if(button7==1 && button6==0)

if(button7==0 && button6==1)

Any bugs, glitches? I don't notice any...

Step 4: It Works(or Doesn't)! And, Coming Soon.....

It hopefully works for you, if it doesn't post a comment. We of the instructable community are usualy good at helping people. Hoping to add a video sometime soon. Might just post a video of an Arduino controlling a servo in another project, since I've moved on to bigger and better things. So have fun with this, modify it, heck go out and make money off of it and then tell me! That would just make my day.

<p>Hi can anyone help me use this with a <a href="http://www.ebay.co.uk/itm/221667071147?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT" rel="nofollow">NRF24L01</a>? any help would be greatful</p>
Hello Geeklord - was wondering just off hand if you could possibly help me to utilize 2 joysticks with x, y, and z axis to control 2 servos. Each servo will work off one ps2 style joystick. Servos will be set to pan and tilt. Any thoughts or assistance would be much much appreciated. <br>Tony
how do you keep it going in one direction ?
The Constrain should either be directly before the write, or after the if.
A jumper kit is nice, but you can also salvage them from different kabels.&nbsp;
Looks cool!<br /> <br /> I got an Duemilanove in my XMas stocking with a Servo Shield and have tried my darndest to load a rudimentary&nbsp;motor sketch, to no avail.<br /> <br /> I've gotten error after error with the #include &lt;Servo.h&gt; and am wondering if you could shed some light? <br /> <br /> I have several instances of the arduino folder (thinking that I might have a path issue). One on the root (c:/), one in my documents, and one wherever the unzipper defaults&nbsp;it to. I have tried different paths, and only get different errors, and none of them are very helpful. I see that you just have a plain &quot;#include &lt;Servo.h&gt;&quot;, just like the instructions on the Arduino site&nbsp;said, but that not working for me. Any help would be appreciated.<br /> &nbsp;<br /> I'm going to give myself an epileptic seziure if all I can do on my new toy is&nbsp;change the blink rate on an LED (which is all I've done).&nbsp; : (&nbsp;<br /> <br /> Thanks!
Hang in there... I'm not sure what you mean by Servo shield, do you mean the adafruit motor shield? Anyway, I don't know if you can type in the #include for the servo library, it seems like you should be able to, but what I did is Sketch&gt;Import Library&gt;Servo in the IDE. Also, have you looked the Servo library documentation? It explains a couple of the quirks with Arduino 0017 (but they make it better over all). when I made this I had the servo signal attached to pin 9, but they've changed the library since then, so now you can attach a servo on any pin. Here's the link -&gt; http://arduino.cc/en/Reference/Servo .<br /> <br /> sorry for the late reply...<br />
I actually figured this out a couple of days ago. You are right, I can't just type in the #include. It has to be imported from the sketch library as you mention. Crazy huh? Maybe that can be fixed on the next software upgrade. I think I'll put in a suggestion on their site.<br /> <br /> I program for a living, and this just wasn't intuitive to me. All other programming languages I've used would have picked up on the special characters when doing an include, and would have &quot;included&quot; it on the fly.<br /> <br /> Either way, thanks for your insight and response. It was spot on. <br />
&nbsp;Huh, I never knew you couldn't just type in the #include. Well, problem solved.
Man, i was about to read through this instructable...but allsteps is gone, its too frustrating...<br />
So i suppose you got it to upload the code now ;)<br/>Also, I found the best deal, From the arduino website so it is legit, its 28 Dollars, you save like 3-5 Dollars!<br/><a rel="nofollow" href="http://store.gravitech.us/ardu.html">http://store.gravitech.us/ardu.html</a><br/>That is where i am buying mine, Good i'ble Rated ;)<br/>
i just bought an arduino Duemilanove and two servos, sooo pumped to try this!
Cool, its a lot of fun. You know you only needed one right?
oh i know, i'm working on a project and i needed two
does each servo go the opposite direction as the other one? like when one is goin left the other is goin right?
aahhhh, there is only one servo. The two different pictures on the front are just different angles.
ohhh... then How to i make what i explaned? :P
aahhh, attach another servo motor to + and-, and attach its signal pin to digital 10. add something like Servo myservo2; to the beginning of the code, put myservo2.attach(10); and another variable for its position in the beginning too. Then do myservo2.write(whatever you named the other variable); in the loop. Then in the two if comands put a variablename++ or --; the opposite of whatever is being done to the variable pos. I might write the code and try that out later.
the myservo2.attach(10) goes in void Setup() actually.
and put the constrain in there too for the other variable. I'm gonna have to write the code for you unless you understand all my run on sentances...
wrote one, it's getting closer to what i want<br/><br/>// Sweep<br/>// by BARRAGAN &lt;http://barraganstudio.com&gt; <br/><br/>#include &lt;Servo.h&gt; <br/><br/>Servo myservo; // create servo object to control a servo <br/>Servo myservo2; // a maximum of eight servo objects can be created <br/> <br/>int pos = 0; // variable to store the servo position <br/> <br/>void setup() <br/>{ <br/> myservo.attach(9); // attaches the servo on pin 9 to the servo object <br/> myservo2.attach(10);<br/>} <br/> <br/>void loop() <br/>{ <br/> for(pos = 0; pos &lt; 180; pos += 10) // goes from 0 degrees to 180 degrees <br/> { // in steps of 1 degree <br/> myservo.write(pos); // tell servo to go to position in variable 'pos' <br/> delay(20); // waits 15ms for the servo to reach the position <br/> } <br/> for(pos = 180; pos&gt;=1; pos-=10) // goes from 180 degrees to 0 degrees <br/> { <br/> myservo2.write(pos); // tell servo to go to position in variable 'pos' <br/> delay(20); // waits 15ms for the servo to reach the position <br/> } <br/> for(pos = 180; pos &lt; 0; pos += 10) // goes from 0 degrees to 180 degrees <br/> { // in steps of 1 degree <br/> myservo.write(pos); // tell servo to go to position in variable 'pos' <br/> delay(20); // waits 15ms for the servo to reach the position <br/> } <br/> for(pos = 1; pos&gt;=180; pos-=10) // goes from 180 degrees to 0 degrees <br/> { <br/> myservo2.write(pos); // tell servo to go to position in variable 'pos' <br/> delay(20); // waits 15ms for the servo to reach the position <br/> } <br/>} <br/><br/>Lol try it, and then tell me(i understand your english :P) How to make one start going right while the other one is in neutral... =/<br/><br/>thanks<br/>
Cool, one of these days i will.
lol i'm gonna try to write the code, but it's my second day writing codes... xD so if you dont mind, write the code too plz :)
Awesome! Looking forward to the video. Arduino is definately fun.

About This Instructable




More by geeklord:Controlling an RC Servo motor with an Arduino and two Momentary Switches Simple LED Bike Lights 
Add instructable to: