Servo is a very common actuator in robotic systems. We can see servos in multi-legged robots, humanoid robots, camera platforms and low-cost manipulators. The essence of servo is a small closed-loop servo system, which receives the target signal, drives the internal DC motor, and passes through the reduction gear set to adjust the angle of the output shaft. The output angle is sampled by the potentiometer, and then the output angle is adjusted by the feedback control system to match the target value. The whole process constitutes a typical closed-loop feedback control system.
The advantages of servo are compact structure, easy to use, and low price, but the position accuracy, load capacity and ability to maintain the position are limited. It is suitable for occasions where the control performance is not high and the volume is small. It is not suitable for high-precision, high-torque, and high-speed occasions (except for a few high-end products), and can be replaced by AC and DC brush/brushless motors + rotary encoders.
1. Servo classification and selection
1.1 Servo classification Servo is divided into internal control methods:
Analog servo: internally uses analog circuit (comparator + amplifier circuit) for closed-loop control; digital servo: internally uses digital circuit (usually a single-chip microcomputer) for closed-loop control.
Regardless of analog or digital servo, it is the PWM signal that is accepted; and under the digital motor, there is a type of "bus servo" --- that is, on the basis of digital servo, it supports the issuing of commands through the bus (TXD/RXD). Bus-type servo can reduce the load of the hardware platform, and has a "maintenance" function without continuous output signals. The bus-type servo control method is more flexible, and generally can support multiple modes such as speed closed loop and position closed loop. Some digital servos also support multi-stage series connection, which can reduce the number of I/O ports occupied. The disadvantage is that the general price is very high, up to several hundred dollars. For example, TurtleBot 3 uses the DYNAMIXEL XL430-W250 bus servo, and the price is about RMB 500.
To sum up, the servo can be divided into command input methods:
PWM Servo: Receive PWM signal as reference input; continuous input signal is required;
Bus servo: Receive reference input through the bus; it has a hold function.
According to size and dynamic characteristics, servos can also be classified in the following ways:
Small model airplane servos are generally small in size and use plastic gear sets, such as SG90, FS90. Generally used for camera pan/tilt;
Medium-sized servos generally use metal gears, such as MG995/MG996/FS90MG. Can be used for direction control of four-wheeled vehicles;
High-torque servo, also using metal gears, with a torque greater than 25kg/cm, used for the main force-bearing joints of the robotic arm;
High-performance servos generally use Hall-type or incremental encoders for position feedback, and use high-precision gears to improve steering stability.
1.2 Selection of Servo When we select the steering gear for the robot, the main factors and indicators considered are:
Maximum rotation angle: the angle difference of the motor from the extreme position of one end to the extreme position of the other end; the common ones are 90°, 180° and 270°. A small number of servos support 360°. This kind of servo generally cannot control a specific angle, but can only control the speed of rotation. The nature is a speed closed loop (rather than a general position closed loop), and is often used for learning cart platforms.
Response speed: The response speed indicates the time required to reach position B from position A, generally expressed in units of s/60°. High response speed is good, but sometimes fast response easily produces larger control jitter.
Maximum torque: Affect the maximum load that the servo can accept. In order to increase the maximum torque, in addition to using the high-torque servo of metal gears, a dual-servo parallel method is generally used (the bottom of some desktop-level 6-DoF manipulators and the waist position of humanoid robots will be used). However, in actual use, this method is extremely easy to cause one of the servos to burn out due to the difference of the servo parameters.
Power supply voltage: The typical voltage is generally from 4.8v, and the maximum is 12v. Generally speaking, the greater the voltage, the greater the maximum power that can be provided (provided that the current is sufficient). Price: Price is also an important consideration, but when the price is low, the performance of the servo will decrease accordingly. If there is a requirement for cost, bus servo should be avoided.
2. Servo control and use
2.1 The control of the PWM servo When the steering gear is in use, a PWM square wave with a period of 20ms is expected. Among them, the duration of the high level determines the angle of the output shaft, and the relationship is linear. Generally, the middle position is 1.5ms, and the range is [1ms, 2ms], that is, 1ms is the leftmost and 2ms is the rightmost. There are three ways to use PWM to control the steering gear:
1. Simulate PWM timing through software I/O
2. Output PWM signal through hardware PCA (Programmable Counter Array) module
3. Through a dedicated PWM signal generation chip, such as PCA9685
The Servo library of Arduino uses both methods (1) and (2). Hardware PWM (Pin 2, 3, 5, 6, 7, 8, 44, 45 and 46) is implemented on the pins with PCA output. Use software PWM on other pins.
2.2 The control of the bus servo The control of the bus servo is relatively simple. After connecting the TXD/RXD, you only need to issue the corresponding instructions in the communication protocol in the installation manual.
3. General discussion of servo problems
3.1. Servo accuracy has many elements that affect the accuracy of the steering gear: For the PWM input steering gear, because the internal voltage comparison circuit uses an analog signal, the accuracy will be affected by the input signal. The accuracy of the PWM signal will be more critical, and the duty cycle of the servo is too small, which is very unfriendly. Generally, 8-bit PWM cannot achieve good positioning results, and 12-bit PWM is more ideal; whether it is analog or digital servo, because the internal potentiometer is also used for position feedback, the accuracy of the potentiometer is very critical. Choosing a better linear potentiometer will greatly increase the cost and volume, and will only be used in high-end servos.
Another very important point is the quality of the gear set, which determines the backlash error and angle accuracy. At this point, metal gears are much better than plastic gears.
3.2. The power supply servo will generate instantaneous large current when it is working. Generally, the peak current is several to tens of times the sustaining current, so it is necessary to ensure that the power supply is sufficient. Otherwise, the overall voltage will be pulled down and the control part will crash or reset. Another point to note is that if you encounter a locked rotor or exceed the rated load for a long time, it will not only increase the power supply pressure, but also cause the motor to burn out and the transmission parts to damage, so you must avoid it.