Here we will dive into the Servo Driving and Servo Motor World from the basics like: what is a servo motor, servo definition and how does a servo motor work to Servo vs Stepper comparison. We will also look at the types of server motors and feedback types.
We will finish with a dive in the Arduino Servo World where we see Hobby Servo, How to Control Servo with Arduino and Arduino Servo Library.
Maybe four or five decades ago we didn’t expect electric motors to work that precisely and our focus was just only on having more powerful motors which were able to do heavy duties that humans couldn’t do. But today because of the huge progression in technologies like power electronics and control, and on the other hand the growing need for precise and yet repeatable tasks, the need for motors that can be controlled precisely has significantly increased. So in order to respond to the demand of precise motion the servo motor came to market and changed the game. So nowadays having a position control system with 2*10^(-5) degrees is something common in the industry. Can you imagine so many delicate tasks like surgeries can be done using servos?
Servo Motor Applications
Nowadays servo motors are used in many applications like antenna positioning, line manufacturing, robotics, CNC, and metal cutting and forming machinery. They are even used in your smartphones to change the focus of its camera. As you can see, they are used in a wide range of sizes and powers.
Imagine a robotic arm that is used to do precise tasks like welding or a metal forming machine.
So to name a few servo applications:
– Robotic arms: These equipment are fairly used in industrial manufacturing and servos are the very basic part of them.
– Camera: Servos are used to do the autofocusing and also to position a camera.
– Metal machinery: CNC and cutting machines are one of the main uses of servos. These machines are used to cut and form metal sheets.
– Line manufacturing: Servos in collaboration with other components are used in production lines to do tasks like moving materials and components, sorting the and automating operations where need to be done precisely.
– Electric mobility: Electric mobility, electric vehicles particularly, are a big era of using servos. This field is getting more popular so fast and is becoming one of the biggest markets of servos.
In addition to what is listed here, there are many other applications that serve as a key component in them. For example, remote surgeries which are getting more common.
What is a Servo Motor
Servo motor is part of a motion control system that produces motion in response to a command. To do the job, there should be a closed loop control system. This simple closed loop control system consists of an actuator which here is an electric motor, a sensor to measure controlling parameters, and a controller to generate suitable commands to achieve the desired output. So in order to understand servos better, let’s take a look at a simple diagram of a closed loop control system.
Servo Mechanism Chart
Now that we have a better understanding of closed loop control systems, we can take a deeper look at the servo motor mechanisms world. Servo motor mechanism is also a closed loop control system and is established based on negative feedback. You can see what’s going on in a servo system more clearly in the picture below.
Noice: Some manufacturers combine the controller and driver into one module. It doesn’t change the procedure. But of course, it makes the system more compact and most of the time yields to more simplicity.
Some of the servo motors available in the market are mostly self-contained which has an integrated circuitry to receive commands and also an integrated feedback system that is used to determine the angular position of its shaft. For example, SG90 is a micro servo that contains a driver motor and encoder. e two main types of servo motors which are AC servo motor and DC servo motor.
Types of Servo Motors
Servo Motor or Servo are not a specific class of motor, this term is often used to refer to a motor suitable for use in a closed-loop control system. Here is a list of the most used motors.
DC Servo Motor
Brushed DC Motors
The other main part is the rotor. Rotor has a bunch of windings that are wired through multiple slots all around the core. The rotor is mechanically coupled to the shaft of the motor. The power implied to the motor is fed to its rotor and magnetizes it. The interaction between stator and rotor creates a torque that rotates the shaft.
Powering rotor is made through commutators and brushes. This is where the name “brushed dc motor” comes from. Commutators are copper plates that are around the shaft and are electrically connected to rotor windings. Brushes one the other hand, are two junctions that are made of natural graphite and finely divided metals. Brushes slip on the commutators and conduct the input current through them to the rotor windings while the shaft is rotating. Since The brushes are not permanently connected to the rotor and slip on it, they need to be changed frequently which not only increases maintenance cost, but also decreases reliability. These parts also add some extra resistance which reduces the overall efficiency of the motor. In the following picture, you can see an image of parts of a brushed dc motor.
Though brushed dc motors are cheap and easy to use, they need more maintenance than other motor types because of their brushes. So they are not a good choice to be used where a high degree of reliability is desired or maintenance might be costly.
Brushless DC Motors
The stator is made of the permanent magnet material. The rotor magnetic field is made by powering the stator coils through the driver. These two magnetic fields create the torque needed to rotate the rotor.
Brushless dc motors (BLDCs) are more expensive, but more reliable and less noisy compared to brushed dc motors and are preferred where more reliability and less maintenance is desired.
AC Servo Motor
Asynchronous AC Motor
Synchronous AC Motor
The synchronous type is relatively more expensive compared to the induction type due to the use of a permanent magnet or an extra power supply and winding for the rotor. But its control is simpler compared to an induction motor, because it is not that highly related to the amount of loading while it’s within the nominal power range of the motor.
Different Types of Control in Servo Motors
Based on the application there are two procedures for positioning in the position control system, which are relative positioning (distance) and absolute positioning (position). In distance positioning, the amount of movement of the actuator is important but not where it is. For example, a machine’s task is to drill a metal surface every 10 centimeters. In this case, it moves the object or its arm by 10 centimeters each time. On the other hand, in the same example, if the exact position of the holes is important, the arm should know where to start the process and where to go when it drills every time. For using position control a technique called homing is used. Homing is the process of determining the origin of an actuator’s position in which its position must be controlled. Every position control system needs to have a procedure that could be used to determine its zero or home point. All the measurements are done based on that position.
Potentiometers are mostly used when the accuracy and constancy of measurement is not that crucial. In order to get good results, you should use a high quality potentiometer whose resistance varies without jumping and glitching while rotating. This type of sensor can’t be used well for speed measurement. Therefore it can be used only in less sophisticated servomechanisms that are not that precise.
Optical Incremental Encoder
The precision of the encoder is determined by the number of these holes. For example, if an encoder has 1000 holes on it, it can measure the displacement of 360/1000 = 0.36 degrees. One important thing to consider when choosing an encoder is its precision. More holes lead to higher precision, but on the other hand, you need a faster digital pulse reader (High Speed Counter) in order to monitor the burst of pulses. This gets more challenging at higher speeds since the number of pulses per second is the number of the holes multiplied by the speed:
Pulse Frequency = Number of Holes * RPM /60
So, for an encoder that has 2000 holes, at a speed of 3000 rpm, the frequency is 100 kHz.
As you can see this type of encoder can’t determine the exact position, but the displacement. There are absolute encoders, but they are more expensive and less convenient compared to the incremental type.
Encoders are used in industrial applications which are more precise, reliable, and more noise prone. They have digital outputs which can be an advantage compared to encoders.
Servo vs Stepper
Stepper Motors Control Mechanism
Since steppers don’t have a feedback sensor, they might have errors in their shaft position which can’t be detected. This error mostly occurs due to missing steps. If the load is not suitable for the stepper or the moving mechanical parts haven’t been well designed or suitably coupled together, misstepping steps may occur. So It means that position control systems that use steppers, need to have a home or zero position point, to use as a reference in order to calibrate the position.
Torque vs Speed Performance
The other important point to consider using a steppe,r is their unsatisfying performance at high speeds. The torque of the stepper’s shaft decreases significantly as the speed increases. This increases the number of missed steps and also might cause the stepper to halt under low loads. On the other hand, servos stabilize their shaft torque by absorbing higher currents at higher speeds. So they are more sophisticated to operate at higher speeds. In a nutshell, if you have a constant load whose speed doesn’t vary in a wide range, a stepper can do the job, but otherwise, you should stick to a servo! For example, if you’re into creating a 3D printer or a laser cutter, a stepper is a good choice, because the load is so light and constant. In addition, every time you are printing a new object or cutting a new sheet, positioning resets which compensates for previous errors. On the other hand in a CNC milling machine where the load is heavy and variable, you can’t use a stepper at all.
Steppers are less expensive compared to servos as they require less components because they don’t use an Encoder for the Feedback. In addition, they usually need a simpler controller and simpler program to perform the position control task. These all diminish the overall cost of the position control mechanism. On the other hand, servos are more expensive, harder to implement, and thus more time consuming.
As we see, though steppers are easy to use and less expensive compared to servos, servos have crucial advantages over servos, which are the precision of the movement, and the ability to know the exact angle of the shaft. Therefore steppers are mostly used in applications where their load torque is not much and a little error in placement is acceptable. And servos are used in projects with a higher level of reliability and precision.
Industrial Servo Drives
Image references here.
First let’s take a look at different components which are used in industry to perform motion planning tasks.
Servo Motor Control
If you are interested in experiencing the joy of doing position control projects and don’t have access to industrial servomechanisms, or you want to prototype a motion control project- a simple robot for example- hobby servos are a perfect option for you. Hobby servos are very tiny motors that can run with currents to the small extent of a few milliamperes provided by a 5 volt voltage source. They are not longer than 3 or 4 centimeters in every direction and have all the necessary components a whole servo system must have.
If you want to do a position project you need a standard servo. The amount of rotation in each direction is limited in this type of motor. Otherwise, if you want to do a speed control project, you can use continuous or open-loop hobby servo. This type can rotate freely at your desired speed.
Hobby servos consist of three main parts which are:
– A dc motor.
– A potentiometer to measure position.
– An electronic circuit to control position.
Everything is enclosed in a single box.
These motors are driven with only three wires:
– Positive input voltage.
– Input command.
– The ground.
Here is an example where is possible to see the components and cables of a hobby servo:
Hobby Servo Sizes
Most servos found in the market are in sizes which are micro, standard, and giant. The power and therefore the torque amount gets more by choosing the bigger size. You can see an example of these three sizes (in mm) in the picture below.
In this part, we are going to introduce to you a micro servo which is totally a good choice for beginners and also for small projects and a good Arduino servo to start with. SG90 is of the position control hobby servo type and has the capability of controlling it’s position in approximately 180 degrees. It’s a self contained package, including motor, feedback sensor, and driver and You need just 3 wires to control the position. These three wires are +5V, GND and Pulse. The pulse output actually is a PWM signal with a 20 ms period. The high value of the signal is between 1ms and 2ms and determines the amount of angular position change. So 1ms means -90 degree change in the position and 2ms means +90 degree in position. Obviously, a 1.5 ms duration pulse makes no movement in the motor. In the picture below you can see how the PWM signal command works clearly.
Now, we will show how to control a servo with Arduino, more precisely a hobby servo, and thanks to Arduino guys, who created the Arduino servo library you don’t even need to create a PWM signal and it’s duty cycle using timer registers. There is a simple Arduino servo library called “Servo.h” integrated into the Arduino IDE that can be used to drive SG90 or any other servo with the same type of command and power.
In higher Powers, where the motor is bigger, or it uses a more advanced feedback signal, a specific component called a “motor controller” is needed. The “motor controller” will handle the motor complexity and also will simplify the work of the Arduino side. Same as this motor controller which is made with very specific functionality and shape, there are also Arduino servo shields that are able to stack on top of an Arduino and simplify the connection phase.
In order to create a simple robot using a hobby servo like SG90, we need some components listed below:
– An Arduino (UNO or only other model you are used to)
– A SG90 hobby servo
– A 5V power supply
– A bunch of wires
Here we will explain how to connect a servo to Arduino, as we are using a hobby servo, the connection is easy and as you can see in the schematic:
Code wise, in order to control servo like SG90 or SG9 using the library “Servo.h”, in your code you need to create a servo and yous it’s methods. Here you can see a list of all the methods of the servo class. We are going to explain this in detail and show you some code examples.
This method is used to assign a digital pin to servo command. So you can send the pulse (PWM) to the servo and set its position.
This method is used to set the angle of the servo. Angle could be a number between 0 and 180. If you want to set the position of the servo to, for example, +90 degree, you need to use, “write(180)” command.
Notice: On continuous servos, this method is used to specify the speed. For example, write(0) means negative full speed and write(180) means positive full speed.
It’s another method to control the shaft angle. As it’s mentioned earlier in the article, SG90 accepts a Pulse with a duty cycle between 1000 and 2000 us. So if you send a writeMicroseconds(1000) or writeMicroseconds(1000) , it means that the servo should rotate to -90 or +90 degrees respectively.
This method is used to read the current position of the servo
This method has a parameter which is the pin you want to check if a stepper is attached to. It returns true if the pin is attached to a servo and false if not.
If you don’t want to use a pin as a servo variable or are worried about the unwanted movement of the servo attached to a pin, you can detach the servo variable from the pin by this method.
You can see down below a simple code to drive a SG90: