Servos
Servos are one of the most commonly used components in tandem with Arduinos. A servo motor is a self-contained electrical device, that rotates parts of a machine with high efficiency and with great precision. The output shaft of this motor can be moved to a particular angle, position, and velocity that a regular motor does not have. Because of this precision and the general small sizes and power needs of servos, they make for perfect companions for FTC when you need an actuator.
Types of Servos
Positional Rotation
Positional Rotation Servos can only rotate from 0° to 180° or 0° to 270°. These are used when the degree of rotation needs to be very precise.
Continuous Rotation
Continuous Rotation Servos have an infinite degree of rotation. These are used when precision isn't required but rather speed and direction.
Linear
Linear Servos are functionally the same as other servos but the rotational movement of the servo output is converted to linear movement. This can be done with a series of specialized gears.
Inside a Servo
All Servos have a motor, set of gears, casing, and control unit. Depending on the type of servo and precision of its rotation, there are two main methods of tracking the position.
Potentiometer
A potentiometer is a variable resistor. These use a track of carbon with specific resistance to vary resistance as the shaft spins. When the resistance changes, the control unit will read a voltage drop. Depending on the voltage drop, the servo will be able to tell what position is in. This works in the opposite way as well where you can input a voltage for the potentiometer to meet which will correlate to degrees turned. These are usually found in 180° or 270° servos since potentiometers can only spin about the same distance.
Encoder
Encoders work by measuring the distance a disc rotates where each unit will be a degree or less. This disc will sometimes be a fine tooth gear that will count each tooth that passes, or on more precise encoders, a laser that passes through equally spaced slots that is read by a light sensor. The light sensor is attached to a control unit that will output a high pulse square wave each time a light is sensed. This can further be associated and read to be a degree or less at a time.
Controlling a Servo with PWM
A pulse width of 1.5ms will cause the servo shaft to rest in the 90 degree position, the center of its travel.
A pulse width of 1ms will cause the servo shaft to rest at the 0 degree position.
A pulse width of 2ms will cause the servo shaft to rest in the 180 degree position.
Varying the pulse width between 1ms and 2ms will move the servo shaft through the full 180 degrees of its travel. You can bring it to rest at any angle you desire by adjusting the pulse width accordingly
Controlling a Continuous Servo with PWM
A pulse width of 1.5ms will cause the servo shaft stop spinning.
A pulse width of 1ms will cause the servo shaft to spin at full speed counter-clockwise..
A pulse width of 2ms will cause the servo shaft to spin at full speed clockwise.
Varying the pulse width between 1ms and 1.5ms will make the motor spin counterclockwise with the shorter pulse widths causing the motor to spin faster.
Varying the pulse width between 1.5ms and 2ms will cause the motor to rotate clockwise with the longer pulses resulting in a faster speed.
Servo Connections
The three connections to the servo motors are as follows:
Ground – The common ground for both the motor and logic.
These will most often be black but will sometimes be brown. If brown, then the power will definitely be red.
Power – The positive voltage that powers the servo.
These will most often be red but will sometimes be brown. If brown, the negative will be black.
Control – The input for the PWM control signal.
These will vary in color but most often be white, orange, or yellow. It will always be the third wire that is not power or ground.