Using Servos: Food Living Outside Play Technology Workshop
Using Servos: Food Living Outside Play Technology Workshop
Living
Outside
Play
Technology
Workshop
Using Servos
by Higgs Boson on December 21, 2011
Table of Contents
Using Servos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
http://www.instructables.com/id/Using-Servos/
http://www.instructables.com/id/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.
Image Notes
1. white wire from the servo goes to pin 9.
2. connect black to ground and red to 5v
http://www.instructables.com/id/Using-Servos/
Image Notes
1. wiper pin
2. top pin goes to 3.3v
3. bottom pin goes to ground
http://www.instructables.com/id/Using-Servos/
Image Notes
1. follow this schematic. other setups will not work with the arduino.
Image Notes
1. qrd1114
2. 10k
3. 68ohm
http://www.instructables.com/id/Using-Servos/
Image Notes
1. connect the sensor as in the schematic.
Image Notes
1. the qrd1114
Image Notes
1. connect pin three to the white wire from the servo.
http://www.instructables.com/id/Using-Servos/
Image Notes
1. the original circuit was meant for tone generation. here's the schematic.
Image Notes
1. wires to the servo
Image Notes
1. connect 4 to 8, and 2 to 6. connect 8 to 6v and 1 to ground.
Image Notes
1. place this .1 uf cap from 2 to ground.
2. 1k resistor from 8 to 7.
3. 100 ohm from 3 to white servo wires.
Image Notes
1. connect one outside pin on the pot to pin 2
2. connect the other outside pin to pin 7
3. connect wiper pin to pin 6.
http://www.instructables.com/id/Using-Servos/
Image Notes
1. this should be 100 ohm. it works better than 22k.
Image Notes
1. build the previous circuit up to the point where you add the pot.
Image Notes
1. connect the buttons like this.
2. undefined
3. connect the 33k to one button and the 100 ohm to the other.
http://www.instructables.com/id/Using-Servos/
Image Notes
1. connect the resistors to pin 7 and the other terminal of the button to pin 6.
Related Instructables
Arduino+Servo+Potentiometer
Robotic Spider
by biomech75
V8 by
FoamboardRC
Arduino
thumbstick
controller by
biomech75
Controlling
Servos Using
the SSC-32
Servo Controller
and Arduino
Uno by yhtomitsy
Arduino + 2
Servos +
Thumbstick
(joystick) by
biomech75
Arduino Robotic
Arm by
biomech75
Advertisements
Comments
44 comments Add Comment
kdlaster says:
I have to ask. What kind of awesomeness is that breadboard? It looks like built in features to make life much easier!
It came as a Radio Shack starter electronics kit I got years ago. It certainly has been very handy for prototyping.
Mawtees says:
You don't. you can just insert jumper wires directly into it, but if you really don't want it you can cut it off and strip the wires.
Mawtees says:
http://www.instructables.com/id/Using-Servos/
rokas.lepsys says:
peng.s.lim says:
Hi, may i know for step 6, where do i put in the potentialmeter? Please advise me on it. Thanks!
one more thing Can you help me how to control a one servo using a JOYSTICK [OR] KEYPAD
man you are so great THANK YOU i searched about this a lot :)
mushfiq1996 says:
Help ASAP. Emergency Please. How i can rotate my servo to a specific angle for reading from amoisture sensor?
Paulg42 says:
Liammc-c says:
ataylor999 says:
infanati says:
http://www.instructables.com/id/Using-Servos/
infanati says:
this is the code that im using for my servos, and I have also added a pic of my connections to the arduino.
#include // Include servo library
Servo servoLeft; // Declare left and right servos
Servo servoRight;
void setup() // Built-in initialization block
{
pinMode(10, INPUT); pinMode(9, OUTPUT); // Left IR LED & Receiver
pinMode(3, INPUT); pinMode(2, OUTPUT); // Right IR LED & Receiver
tone(4, 3000, 1000); // Play tone for 1 second
delay(1000); // Delay to finish tone
servoLeft.attach(13); // Attach left signal to pin 13
servoRight.attach(12); // Attach right signal to pin 12
}
void loop() // Main loop auto-repeats
{
int irLeft = irDetect(9, 10, 38000); // Check for object on left
int irRight = irDetect(2, 3, 38000); // Check for object on right
if((irLeft == 0) && (irRight == 0)) // If both sides detect
{
maneuver(-200, -200, 20); // Backward 20 milliseconds
}
else if(irLeft == 0) // If only left side detects
{
maneuver(200, -200, 20); // Right for 20 ms
}
else if(irRight == 0) // If only right side detects
{
maneuver(-200, 200, 20); // Left for 20 ms
}
else // Otherwise, no IR detects
{
maneuver(200, 200, 20); // Forward 20 ms
}
}
int irDetect(int irLedPin, int irReceiverPin, long frequency)
{
tone(irLedPin, frequency, 8); // IRLED 38 kHz for at least 1 ms
delay(1); // Wait 1 ms
int ir = digitalRead(irReceiverPin); // IR receiver -> ir variable
delay(1); // Down time before recheck
return ir; // Return 1 no detect, 0 detect
}
void maneuver(int speedLeft, int speedRight, int msTime)
{
// speedLeft, speedRight ranges: Backward Linear Stop Linear Forward
// -200 -100......0......100 200
servoLeft.writeMicroseconds(1500 + speedLeft); // Set left servo speed
servoRight.writeMicroseconds(1500 - speedRight); // Set right servo speed
if(msTime==-1) // if msTime = -1
{
servoLeft.detach(); // Stop servo signals
servoRight.detach();
}
delay(msTime); // Delay for msTime
}
http://www.instructables.com/id/Using-Servos/
infanati says:
infanati says:
silentskorn says:
r_ray says:
http://www.instructables.com/id/Using-Servos/
ratankumarsaha says:
which electrical thing contain this servo motor..how can find it??????????
RATAN BANGLADESH.....
Tariq802 says:
try a local hobby store if not radio shack. any place that specializes in rc stuff...
smitlrx says:
nilved 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
A.C.E. says:
Tariq802 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
}
http://www.instructables.com/id/Using-Servos/
etc.
Tariq802 says:
Yes you can. I'll try and post the code in a few days.
Sorry. This may take longer because I need to get more servos (all of mine are being used in projects right now).
bertus52x11 says:
nima_juniper says:
thank you that was very useful for me
http://www.instructables.com/id/Using-Servos/