Introduction To Servo MotorsIn this tutorial, we will provide technical information about servo-motors and how they work. We made it easy to get a robot up and running, however, there is a lot of fun and interesting things to learn about how the robot works. The more you know, the more you can get your robot to do!
Table of Contents
- How To Move Servos
- What is a servo motor?
- Servo vs PWM
- How does a servo motor work?
- Types of servo motors
- Controlling a servo motor
- How Does Continuous Rotation Servo Work?
- How is torque measured?
- PWM (hobby servos) vs Serial (bi-directional) Servos
How To Move Servos
While this particular tutorial is focused on what a servo is, we provided this for those who wish to skip how a servo works and jump directly into how to move a servo. Of course, if you skip this tutorial and jump into moving servos, you will end up back here because someone you will ask a question on the forum and someone will direct you here. So, if you're going to skip this section, click here to learn how to move servos in ARC. This document covers mostly PWM Hobby-style servos, as they require the most care when being used. For a difference between PWM Hobby servos and Bi-directional serial servos, we cover the difference in this document.
click here to learn how to move servos
What is a servo motor?
A Servo motor (or servo) is a rotary actuator that allows for precise control of angular position, velocity, and acceleration. Servos are found in many places: from toys to home electronics to cars and airplanes. If you have a radio-controlled model car, airplane, or helicopter, you are using at least a few servos. Servos also appear behind the scenes in devices we use every day. Electronic devices such as DVD and Blu-ray DiscTM players use servos to extend or retract the disc trays.
Synthiam uses servos that manage the movement of joints, pan & tilt, and continuous rotational movement. For PWM Servos, the EZB sends an electrical signal that tells the servo what position to reach and how quickly to get there. Bi-directional serial servos receive a protocol command by the EZB and the respective robot skill. Servos come in a variety of shapes and sizes for different applications. You may want a large, powerful one for moving the arm of a big robot, or a tiny one to make a robot's eyebrows go up and down. By linking many of these servos together, you can very easily create robots that perform complex real-world operations.
Hobby PWM Servo vs PWM
PWM stands for Pulse Width Modulation. PWM is the process of turning ON and OFF digital voltage quickly to simulate a range of voltage. For example... If the digital output pin of a 5v micro is 2.5v, then the PWM is set for a 50% duty cycle. If the digital output of a 3.3v pin is 1.65v, then the PWM is set for a 50% duty cycle. This is because the microcontroller is turning ON and OFF the digital 3.3v pin real quick, which is producing a simulated lower voltage. You can use PWM to vary the brightness of an LED, for example.
A hobby servo uses PWM as well. The "frame" of a servo PWM signal is 20ms. This means the signal frame repeats every 20ms. The signal itself is only 2ms, where the rest of the frame is empty (low). Many controllers, such as Arduino libraries do not maintain the 20ms specification defined for servos. Because of this, challenges have been introduced to servo manufacturers when decoding incoming PWM signals. This has caused the need for servos to be "Smarter" by adapting to the unusual PWM transmitted by poorly written libraries that do not adhere to the servo PWM Standard. The EZ-B does adhere to servo PWM standards.
How does a servo motor work?
The simplicity of a servo is among the features that make them so reliable. The heart of a servo is a small direct current (DC) motor, similar to what you might find in an inexpensive toy. These motors run on electricity from a battery and spin at high RPM (rotations per minute) but put out very low torque (a twisting force used to do work — you apply torque when you open a jar). An arrangement of gears takes the high speed of the motor and slows it down while at the same time increasing the torque. (Basic law of physics: work = force x distance.) A tiny electric motor does not have much torque, but it can spin really fast (small force, big distance). The gear design inside the servo case converts the output to a much slower rotation speed but with more torque (big force, little distance). The amount of actual work is the same, just more useful. Gears in an inexpensive servo motor are generally made of plastic to keep them lighter and less costly. On a servo designed to provide more torque for heavier work, the gears are made of metal (such as with Synthiam Servos) and are harder to damage.
With a small DC motor, you apply power from a battery, and the motor spins. Unlike a simple DC motor, however, a servo's spinning motor shaft is slowed way down with gears. A positional sensor on the final gear is connected to a small circuit board. The sensor tells this circuit board how far the servo output shaft has rotated. The electronic input signal from the computer or the radio in a remote-controlled vehicle also feeds into that circuit board. The electronics on the circuit board decode the signals to determine how far the user wants the servo to rotate. It then compares the desired position to the actual position and decides which direction to rotate the shaft so it gets to the desired position.
|Figure 5. The circuit board and DC motor in a high-power servo. Did you notice how few parts are on the circuit board? Servos have evolved to a very efficient design over many years.|
Types of servo motors
Servos come in many sizes and in three basic types: positional rotation, continuous rotation, and linear. Regardless of the type of servo between PWM Hobby and Bi-directional serial, the servo formfactor can be in a variety of configurations.
- Positional rotation servo: This is the most common type of servo motor. The output shaft rotates in about half of a circle or 180 degrees. It has physical stops placed in the gear mechanism to prevent turning beyond these limits to protect the rotational sensor. These common servos are found in Synthiam 's arms, legs, limbs, etc. For example, the JD or Six robots use these servos. Some servos, such as winch servos will rotate their output shaft in multiple rotations (i.e. 270 degrees). The same signal (pulse width) is used for any servo regardless of the output shaft rotation. This means a servo of 270 degrees would have less resolution of a servo with 180 degree range/
- Continuous rotation servo: This is quite similar to the common positional rotation servo motor, except it can turn in either direction indefinitely. The control signal, rather than setting the static position of the servo, is interpreted as the direction and speed of rotation. The range of possible commands causes the servo to rotate clockwise or counterclockwise as desired, at varying speeds, depending on the command signal. You might use a servo of this type on a radar dish if you mounted one on a robot. Or you could use one as a drive motor on a mobile robot. The Synthiam AdventureBot uses two continuous rotation servos with wheels. The center (90 degrees) is the center of a continuous rotation's STOP position. The further you move away from 90 degrees in either direction controls the speed of the continuous rotation servo in that direction.
- Linear servo: This is also like the positional rotation servo motor described above, but with additional gears (usually a rack and pinion mechanism) to change the output from circular to back-and-forth. These servos are not easy to find, but you can sometimes find them at hobby stores where they are used as actuators in larger model airplanes.
Controlling a PWM servo motorA standard servo is what you normally find in R/C Hobby Toys. They are high-precision devices that can rotate a shaft up to 180 degrees. With the EZB and a Standard Servo, you can easily configure how many degrees to rotate the output shaft.
ARC takes care of the electrical communication with the servo for you, whether PWM or bi-directional serial. Standard servos can be used for the head or arms of your robot.
However, here is some technical information on how hobby PWM servos work. The servo is controlled using pulse controlling. The control pulse is a positive voltage with a length of 1 to 2 ms which determines the angle of the shaft. The control pulse is repeated every 18-25 ms.
The EZ-B has timing below 1ms and above 2ms to accommodate all servo types. Some servos do not fall within the specifications and require unusual timing. When testing with your servo, make sure you recognize the max and min values and set them in the control. If a servo attempts to move further than its maximum position, it may be damaged. Additionally, if a servo is rotated too far then it will consume a high amount of current and the EZ-B may reset.
Here are the timings for the EZ-B...
Position 1 on v4, Position 1 on v3
Position 90 on v4, Position 50 on v3
Position 180 on v4, Position 100 on v3
For example, the EZ-Robot EZ-B v4 has high accuracy which results in 180 servo positions. The EZ-B v4 can control 24 servos simultaneously while it performs other various user-specified tasks. If your servos draw more current than our specification sheet defines, the EZ-B may run out of power and reboot itself. This is called a Brown-Out. To prevent brown-out with many servos, provide alternate power. Check the manual on how to do that.
ARC handles the technical work for you. Merely specify the servo position and voila!
How Does Continuous Rotation Servo Work?A continuous rotation servo, as mentioned earlier in this lesson, will spin the rotation shaft continuously in either direction. When the servo receives a 90 degree position, which is center on a standard servo, the continuous rotation servo will stop spinning. The center (90 degrees) is the center of a continuous rotation's STOP position. The further you move away from 90 degrees in either direction controls the speed of the continuous rotation servo in that direction. The continuous rotation servo will have a POT (potentiometer) exposed which allows you to fine tune the STOP position with a small screwdriver. Click here to view a tutorial on how to calibrate a continuous rotation servo.
100 < - Turning left faster
91 < - Turning left slower
90 <- Stopped
89 <- Turning right slower
80 < - Turning right faster
How Is Torque Measured?Now that we covered the basics of how-a-servo-works, the next question is torque. Torque is how much power the servo has. Different applications will require higher or lower torque. In most cases, you can get away with using a regular average torque servo. The average torque of a plastic servo is 2-3kg/cm @ 5 volts and the Synthiam Heavy Duty servos are much more (consult the servo product information).
Something that is often overlooked is energy consumption. Consider this: there is no free energy. Torque equals energy and vice-versa. The Synthiam Heavy Duty servos will require more energy to move than cheaper plastic ones. If too many high torque servos are connected to the EZ-B without a sufficient power source, it will "brown-out". Browning-out means the voltage regulator could not keep up with the current draw so the microchip rebooted itself due to low current. Do not worry, the Revolution Robots are powered by a strong LiPo battery and will support up to 24 servos!
So what do the torque numbers mean? Let's speculate the torque value of a servo was 50 Ounces per Inch
Well if you had a servo arm that was one inch long on your servo it would be able to produce 50 ounces of pull or push force at the end of the servo arm before stalling. If you had a 1/2 inch servo arm what do you think the force would be? Yup, 100 ounces of force. How about a 2-inch arm, 25 ounces of force - easy huh?
PWM (hobby servos) vs Serial (bi-directional) Servos
The most common servos in robotics are 3 wire PWM Hobby Style (power, GND, PWM signal). These types of servos have been around for decades and are the most cost-effective solution. The shortcoming of these servo types is they have only one direction of communication from EZB to the servo. This means the servo only knows its position when instructed to move. When these servos are first initialized into a position, the servo will jump from whatever position it is currently in to the specified position. It will not transition slowly on its own during initialization because it does not know the starting position before initialization. When robots use these servos, they will jump and sometimes cause damage preparation is not considered. The solution to avoid jumping is to manually move the robot joints into a position close to the initialization position so the servos don't jump. This is more effort than using bi-direction servos, which will report their position to the software.
Bi-directional serial servos use a communication protocol that allows the servos to transmit position data to the EZB. These bi-directional servos can be queried for the position when initialized and transition to the new position at specified speeds. This prevents jolting/jumping of joints that are experienced with hobby PWM servos.
When a robot is powered on, it is recommended to create an initialization script that is launched from the connection control. The initialization script will accommodate the type of servos being used. If the servos are PWM style, it is recommended to manually move the robot joints prior to executing the initialization script. With a bi-directional serial servo, the position can be queried and therefore ARC will know the position and your script can calmly move the servos into a pre-defined position.
There's a number of bi-directional servos supported by ARC...