Вы находитесь на странице: 1из 7

Using Servos You Inbox (0) Shortcuts Logout

Forums

Contests

Q&A
Go

Arduino

Remote Control

Robots

Software

Apple

3D Printing

CNC

Electronics

Lasers

See More

Using Servos

Print PDF

Favorite

Email

Flag

12
Followers
Follow

Author:

Higgs Boson

Info

Stats 5,827
views

11 i

I love physics and playing cello, and have been interested in electronics, but have just recently gotten into doing projects.

12
Followers
Follow

Author:

Higgs Boson

Published: Dec 26, 2011 License:

Related: servo, arduino

Related
control servo using arduino and rock band guitar
by everywhere

Conducting foam controlled servo's


by Renaissance-man

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.

Remote Controlled Arduino Robot using Wixel Transceivers


by techbitar

Step 1 What 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

Homemade stretchsensors for robotic apps, made from conducting foam.


by renaissanceman

Serial Servo Controller w/Arduino - Control Up To 12 Servos At Once Using the Arduino a
by soshimo

Sugru + Servos = Robot


by marc.cryan

Step 2 Testing the servo


Arduino XMAS hitcounter
i by alex_weber

Drive by wire go kart


by 765mj

Arduino assisted RC Truck/Car


by Chowmix12

http://www.instructables.com/id/Using-Servos/?ALLSTEPS[1/29/2012 8:22:07 PM]

Using Servos

Arduino based serial servo controller


by mattie95

More Related

Guides
the first thing that you should do is make sure your servo motor is working. because the servos wires end in a female header, you cannot plug it into the arduino (unless you have a shield. insert solid core wires into the headers, so you can attach it to the pins of the arduino (or anything else). When you downloaded your programming environment for arduino, it should have two examples for the servo. The one we are going to use first is called sweep. Go to the "open" icon next to save near the top of the window on the environment. click on it, and a list of files should come up. go down to the one that says servo, and put your mouse over it. two files should come out of it. one called "sweep" and one called "knob". click on the one called sweep, compile the code and upload it to your board. if everything is connected correctly, the servo should begin to go back and forth from 0 to 180 degrees. If you cannot find the code, copy this: // Sweep // by BARRAGAN <http://barraganstudio.com> // This example code is in the public domain.

EASY DIY ANIMATRONICS

#include <Servo.h> Servo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created int pos = 0; // variable to store the servo position

void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object }

AMAZING ROBOTS

void loop() { for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees { // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees { myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } }

ARDUINO CONTEST WINNERS

http://www.instructables.com/id/Using-Servos/?ALLSTEPS[1/29/2012 8:22:07 PM]

Using Servos

be sure to plug in the white wire to digital pin 9, the black wire to one of the ground pins on arduino, and the red wire to the 5v pin on the arduino board.

ARDUINO PROJECTS
Step 3 New code
i

More Guides

Now that you know your servo works, you can begin to incorporate sensors into the mix. the first thing you should do is use a potentiometer. Use anything between 10 and 100k. keep the servo attached as it was using the sweep example. attach the top pin on the pot to 3.3v on the arduino. Connect the bottom pin to ground on the board. Connect the center of wiper pin of the pot to A0 (the first analog pin) on arduino. go to "open" on the IDE again. Go to servo and open "Knob". compile the code and upload it to your board. When the program is running you will be able to control the position of the servo with a potentiometer. If you cannot find the code, copy this: // Controlling a servo position using a potentiometer (variable resistor) // by Michal Rinott <http://people.interaction-ivrea.it/m.rinott> #include <Servo.h> Servo myservo; // create servo object to control a servo int potpin = 0; // analog pin used to connect the potentiometer int val; // variable to read the value from the analog pin void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) myservo.write(val); // sets the servo position according to the scaled value delay(15); // waits for the servo to get there

http://www.instructables.com/id/Using-Servos/?ALLSTEPS[1/29/2012 8:22:07 PM]

Using Servos

Step 4 Prepare the sensor


i

The sensor that I used that would probably work very well was the QRD1114 reflective sensor which has a discrete infrared LED, and phototransistor. to get the sensor to work, you must connect it in a very specific way. you could use other reflective sensor, but this one just seemed convenient, and I am using it in another project so they are readily available for me. to setup this sensor you will need: one QRD-1114 one 10k resistor one 68 or 100ohm resistor wire

Step 5 Using the sensor with the servo


i

http://www.instructables.com/id/Using-Servos/?ALLSTEPS[1/29/2012 8:22:07 PM]

Using Servos

Now that you have your sensor setup so that it will work for with arduino, you can replace the pot with it to make a servo that moves when something is in front of it and moves back when nothing is in front of it. use the same code that you did for the potentiometer. but this time instead of using the pot, connect pin one on the qrd to A0 on the arduino board. connect the two resistors to 3.3v, and connect pin 4 and 2 on the qrd to the ground on the board. run the program and when there is something about 1 cm from the sensor the motor will turn one way, and when the object moves away from the sensor the servo will move back. try adding a photo cell to make a light sensitive servo. using sensors with the servo, you can make robots, animatronics, and more. Have fun!

Step 6 Using a 555 and a potentiometer


i

this is a simple circuit using a 555 to control the servo with a potentiometer. The circuit was originally meant as a tone generator, but with some simple modifications it became a servo tester. follow the schematic and it should work, but if you have any questions or problems, leave a comment and I will try to help you.' to make this circuit you are going to need: -one 555 timer -one .1 f ceramic disk capacitor -one 1k resistor -one 100 ohm resistor -one 100k potentiometer - a lot of jumper wires

Step 7 Using a 555 and push buttons


i

http://www.instructables.com/id/Using-Servos/?ALLSTEPS[1/29/2012 8:22:07 PM]

Using Servos

I like this 555 circuit more than the one that uses the pot. the servo acts less spastic, and is easier to control. When you hit one button the servo will go clock wise and when you hit the other button it will go counter clock wise. for this circuit you are going to need: -one 555 timer -one .1 f capacitor -one 1k resistor -two 100 ohm resistor -one 33k resistor -two push buttons build the circuit from the previous step accept do not add the pot, add the push buttons and resistors in place of it.

7 comments Add Comment

nilved

says:

Jan 28, 2012. 12:45 AM

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
flag Reply

Higgs Boson (author) says:


Yes you can. I'll try and post the code in a few days.
11

Jan 28, 2012. 2:46 PM

flag

Reply

bertus52x11 says:
Did you find the little particles yet...?
31

Jan 3, 2012. 6:38 AM

flag

Reply

ratankumarsaha

says:

Dec 31, 2011. 1:16 AM

which electrical thing contain this servo motor..how can find it??????????

RATAN BANGLADESH.....
flag Reply

smitlrx

says:

Dec 31, 2011. 4:47 AM

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.

http://www.instructables.com/id/Using-Servos/?ALLSTEPS[1/29/2012 8:22:07 PM]

Using Servos flag Reply

Higgs Boson (author) says:


11

Dec 31, 2011. 2:50 PM

I was able to find mine at radio shack, so they are pretty common. you don't need to take anything apart to find them. if they are not at your local store, try amazon or ebay.
flag Reply

nima_juniper

says:

Dec 27, 2011. 3:27 AM

thank you that was very useful for me


flag Reply

Add Comment

Explore Channels in Technology


3D Printing Apple Arduino Art Assistive Tech Audio Cell Phones Clocks CNC Computers El Wire Electronics Gadgets Laptops Lasers LEDs Linux Microcontrollers Microsoft Photography Remote Control Reuse Robots Science Sensors Soft Circuits Software Soldering Speakers Steampunk Tools USB Websites Wireless

Join Our Newsletter


Join over 800,000 Instructable fans who receive our DIY newsletter.

About Us
About Advertise Press Contact Jobs Legal Help Privacy Policy

enter email

2011 Instructables

http://www.instructables.com/id/Using-Servos/?ALLSTEPS[1/29/2012 8:22:07 PM]

Вам также может понравиться