Hardware Reference
In-Depth Information
The basics of a servo motor
Before you begin, you'll need some background on servo motors. Servo motors are some-
what similar to DC motors; however, there is an important difference. While DC motors are
generally designed to move in a continuous way—rotating 360 degrees at a given
speed—servos are generally designed to move within a limited set of angles. In other
words, in the DC motor world, you generally want your motors to spin with continuous ro-
tation speed that you control. In the servo motor world, you want your motor to move to a
specific position that you control.
Controlling servos is fairly simple. The device has three wires connected to it: one for the
ground connection, one for the drive voltage, and the third is a control signal that expects a
pulse-width modulated ( PWM ) signal. The signal is a square wave that is turned on and
off at a set rate, normally at around 500 Hz. The ratio of the length of the time the signal is
on to the time the signal is off determines the desired angle of the servo.
Arduino can control servos using two different approaches. The first is to connect your ser-
vos directly to Arduino. You'll use this solution in the first example of this chapter. Unfor-
tunately, if you have a lot of servo motors, they can sometimes draw more current than Ar-
duino can provide, which is 40 mA. To solve this problem, you'll need to use a shield that
can connect to an external power source. Then, your Arduino and shield can provide both
voltage and current so that you can control many servos. The second example in this
chapter will use this servo controller shield designed for Arduino to control 12 servos on a
hexapod robot.
Search WWH ::




Custom Search