May 2014 17
; Change the int ledPin = 9; to int ledPin = 11;.
; Upload the code and observe the LED pulsing.
; Change the delay from 30 ms to 10 ms in both the fade
in and fade out sections, and observe the faster pulse.
When we learn about the Arduino as a controller, we
learn that it controls things by looking at the environment
with sensors; using what it senses, it can make things
move in the environment with actuators. An example of
an actuator is a servomotor. These are used in many
applications in machine automation, robotics, and RC
(Radio Control) models.
The word servo is a shortened version of
servomechanism: a device that has built-in sensing to help
control some aspect of the mechanism’s function. A
servomotor senses the motor actuator arm position, for
example, and can vary that position over approximately
half of a full turn — from 0° to 180° (angle degrees). Note
that since the servo has internal sensing, the Arduino
doesn’t need to sense the angle position of the servo, but
needs only to send it the correct PWM value to set an
angle. Our servomotor does this internal angle sensing
with a built-in variable resistor known as a potentiometer
(we will learn lots more about these things next time).
The potentiometer produces a variable voltage that
depends on the angle of the servomotor’s rotor position.
A dedicated controller in the servomotor uses that voltage
to set and hold the required angular position of the
actuator arm. We discussed the Arduino PWM and saw
that library sends out pulses at a frequency of 490 Hz,
which is about 2 ms per pulse. Servomotors, however, use
a 10 ms to 20 ms period; within that pulse, they require
an on time between 1 ms and 2 ms to control the angular
position as shown in Figure 17. Fortunately, the Arduino
; FIGURE 16: Selectthe Arduino
; FIGURE 18: Servo horns and screws.
; FIGURE 19: Servo side top and bottom.
; FIGURE 17: Servo pulse and angle.