Servos With Arduino PSU 2012
Servos With Arduino PSU 2012
Learning Objectives
• Be able to identify characteristics that distinguish
a servo and a DC motor
• Be able to describe the difference a conventional
servo and a continuous rotation servo
• Be able to use the Arduino Servo library to
control servo position
Living with the Lab
References
Information on Arduino Servo library:
http://www.arduino.cc/en/Reference/Servo
http://www.arduino.cc/playground/Learning/SingleServoExample
What is a servo?
A servo-motor is an actuator with a built-in
feedback mechanism that responds to a control
signal by moving to and holding a position, or by
moving at a continuous speed.
Living with the Lab
DC Motor Servo
• Motion is continuous • Capable of holding a
• Speed controlled by position
applied voltage • Speed controlled by delay
between position updates
• Hybrid of motor, gears
and controller.
Living with the Lab
Servo components
1. Small DC motor
2. Gearbox with small plastic gears to reduce the RPM and increase output torque
3. Special electronics to interpret a pulse signal and deliver power to the motor
Living with the Lab
http://www.arduino.cc/en/Reference/Servo
Living with the Lab
void setup()
{
myservo.attach(servo_pin); // attaches the servo pin to myservo object
}
void loop()
{
int pos = 0; // variable to store the servo position
int dtwait=15; // duration of wait at the end of each step
Experiment
• What happens when you adjust dtwait?
• Can adjust the sweep angle?
– Make new variable to define end angle of the loop
• Open the Knob demo from the Arduino IDE
– Connect a potentiometer to an analog input
– Use the potentiometer to control the servo position