3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Using Servos

Using Servos
In this instructable, I am going to show you what a servo motor is, how to use it, and ideas for starting projects using it. I used arduino to control my servo, I added how to use a 555 in some of the later steps.
 
Remove these adsRemove these ads by Signing Up
 

Step 1What is a Servo motor

If you are like me, then you knew very little about servo motors, and how to use them, so we should start from the beginning. A Servo motor uses pulse width modulation (pwm) from a microcontroller or a 555 timing IC (or something different I haven't heard about) to know what position to move its horn to. They can move both clockwise or counterclockwise thanks to an H bridge which is hardwired into them. Most Servos, unlike conventional electric motors do not move in continuous rotations. the standard servo moves anywhere between 0 and 180 degrees, which make them useful for animatronics and robotics. The servo has three wires coming out of it which usually ends in a female jack. the wire colors are black, which gets connected to ground, red which gets connected to the positive power supply, and white or yellow which gets connected to the output of the microcontroller or 555 IC, and receives the pwm. Okay now that you know the basics, lets get started
« Previous StepDownload PDFView All StepsNext Step »
12 comments
Dec 31, 2011. 1:16 AMratankumarsaha says:
which electrical thing contain this servo motor..how can find it??????????


RATAN BANGLADESH.....
Mar 19, 2012. 9:23 AMTariq802 says:
try a local hobby store if not radio shack. any place that specializes in rc stuff...
Dec 31, 2011. 4:47 AMsmitlrx says:
Unfortunately servo's are not used often in standard equipment. The are however used in remote controlled airplanes, helicopters, cars and boats to facilitate the operation of the vehicle, like steering and acceleration. One can buy the remotes and normally you get the receiver and a couple of servo's with. You can also buy all these units separately.
Jan 28, 2012. 12:45 AMnilved says:
could you hook up the arduino with multiple servos and pots to control them and if so can you post a comment with the code
Feb 28, 2012. 12:51 PMA.C.E. says:
While Higgs is getting more servos, Ill try to help you understand a bit. When you create the servo object (Servo myservo;) this is creating one servo object with the name of "myservo". If you wanted 3 servos, you would need three of those lines, but with different names, such as:

Servo myservo1;
Servo myservo2;
Servo myservo3;

you would also need more potentiometers, so youd need to add more potpins, and have the potentiometers hooked up to their respective pins, I think that would look like this:

int potpin1 = 0;
int potpin2 = 1;
int potpin3 = 2;

where potpin1 is what we are calling analog pin 0, but will control myservo1. You also need more variables to store the data from the potpins, so make those too.

int val1;
int val2;
int val3;

the numbers will correspond with the servos of the same number.

now you just need to add the commands for checking all 3 servos into the loop, which would look like this:

void loop()
{
val1 = analogRead(potpin1); // reads the value of potentiometer 1
val1 = map(val1, 0, 1023, 0, 179); // scale it
myservo1.write(val1); // sets servo 1's position according to the scaled value
val2 = analogRead(potpin2); // reads the value of potentiometer 2
val2 = map(val2, 0, 1023, 0, 179); // scale it
myservo2.write(val2); // sets servo 2's position according to the scaled value
val3 = analogRead(potpin3); // reads the value of potentiometer 3
val3 = map(val3, 0, 1023, 0, 179); // scale it
myservo3.write(val3); // sets servo 3's position according to the scaled value
delay(15); // delays for 15ms to let the servos catch up
}

I think this would work, but someone check over my work because I'm a complete noob at arduino coding. Someone with an arduino and 3 servos should write this and see if it works :p
Mar 19, 2012. 9:15 AMTariq802 says:
before you can start reading and writing you also need to attach the servo objects to their pins ie:

void setup() {
myservo1.attach(9); //attach servo 1 to pin 9
myservo2.attach(10); //attach servo 2 to pin 10
myservo3.attach(11); //attach servo 3 to pin 11
}

etc.
Mar 19, 2012. 9:21 AMTariq802 says:
you're also going to want to use a power supply separate from the arduino board if you're using a lot of servos, otherwise you might break something. it could probably handle 3 servos but i definately wouldn't go with more than that without isolating the power supply
Jan 3, 2012. 6:38 AMbertus52x11 says:
Did you find the little particles yet...?
Dec 27, 2011. 3:27 AMnima_juniper says:
thank you that was very useful for me

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
44
Followers
16
Author:Higgs Boson
I love physics and playing cello, and have been interested in electronics, but have just recently gotten into doing projects.