**Servo motors are capable of creating torque in a linearly expected fashion, which makes them suitable for use in closed loop systems. While servo motors are known to have excellent performance capability, their end performance is largely controlled by tuning the servo loop.**

Despite the fact there is abundant material available regarding closed loop control and closed loop systems, tuning a PID servo loop is not a trivial task. This article presents some useful guidelines on how servo loop tuning can be made into a conscious engineering exercise.

## The PID Controller

In any closed loop system, the PID controller is one of the most extensively used control algorithms for motion and or temperature control, process control, etc. The term PID controller is derived from the three components containing this algorithm (Figure 1):

- Integral term (I) - This term results in an output signal which is the integral (or sum over time) of the process error.
- Proportional term (P) - This term results in an output signal which is proportional to the process error (variation between the actual and setpoint, the preferred parameter value)
- Derivative term (D) - This term results in an output signal which is the derivative of the process error.

**Figure 1. **PID controller

As a rule, the above terms operate separately from one another, and their outputs are condensed together to create a PID output signal. It is also possible to obtain other configurations.

For instance, derivative term may operate only on the output or feedback signal, and not on the error signal, with the proportional term parallel with the integral term. As illustrated above, motion control application process error is the variation between actual and preferred motor positions (position error).

## Effect of the PID Terms

This article examines a viable tuning exercise, taking a closer look at the real effect of the numerous gains. Here, in order to describe the real effects of the numerous gains and also to give some realistic guidelines, digital servo drive and motor integrated with encoder feedback was employed. Looking at the step response of a system is one of the best methods to assess PID tuning.

Minute signal excitation and its response will be employed to ensure that the system does not saturate and also to prevent any strong nonlinearities.

Torque will also be evaluated in addition to examining the position response. This is done as a measure of “how hard we are driving”.

Figure 2 displays the response with only a small relative gain value, setting the derivative and integral gains to zero.

**Figure 2. **Response with a small proportional gain value

The yellow line represents the position feedback; the red curve indicates the step reference; the green and blue curves are actual and reference currents, respectively, which are relative to torque. As shown above, extremely sluggish response is observed. The following result can be obtained after raising the proportional gain several times:

**Figure 3. **The system has almost no friction and exhibits large overshoot, even with small gains.

Almost no friction is seen in this system, which displays a massive overshoot even in the case of small gains (Figure 3). While damping properties will improve if friction is added to the system, larger gains will still be needed.

A small steady state error will occur when friction is added, preventing the system from reaching the end target position.

During servo loop tuning, this should always form the first step. Users should begin with only proportional gain and then observe the response. If the system is likely to overshoot rapidly, even in the case of small gain, it probably means there is a low friction.

If more gain is needed to obtain the response, and the response is also slow, it means the system has substantial friction. This factor establishes the subsequent step.

## Low Friction System – Effect of Derivative Term

The response could become unstable rapidly in a low fiction system, even with low gains. One way to resolve this instability is to employ a derivative action.

As the D term distinguishes the position error that quickly alters during instability, it produces an opposing torque to control the large changes.

In the above system, the following response is acquired with the same proportional gain and with some derivative gain (Figure 4).

**Figure 4. **Large overshoot is removed, but the overall response is also slower (meaning the time required to reach the target).

## Frictional System – Effect of Integral Term

As described above, a steady response can be acquired by simply using a proportional term, but the final target is still not reached. With additional integral term, the error will exist longer if the integral becomes larger, leading to a correction torque.

In the above system, with the same proportional gain and with additional integral gain, steady state error or position error is brought down to zero, even when friction was present.

It is better to use the integral limit (or anti-windup) with an integral term so that the integral term is prevented from becoming very large and from taking too long a time to converge down.

## PID Combined

The steady state error is nonzero in the case of the D and P terms in a low friction system. Some overshoot is also introduced in case of the I and P terms in a frictional system.

In these cases, derivative and integral terms can be respectively added. For example, when some derivative gain is added to the frictional system, the following response can be obtained (Figure 5):

**Figure 5. **Response is obtained after adding some derivative gain to the frictional system.

## Tuning Tradeoffs

To date, the effect of each term on the response curve has been looked to demonstrate the way they contribute. Based on the response curves, it can be seen clearly that apart from the response shape, the response time is considerably affected. Several attributes in the response curves help measure the response:

- Step response time: after how much time is 67% of the final target reached
- Overshoot: by how much is the position of the target surpassed
- Settling time: after how much time is the position established within some % of the target

Some more effects may occur since all the gains are slowly increased to acquire the preferred response:

- Resonance: As and when the system is excited at higher power and frequencies, system resonance can impact the response of the system in random ways.
- Saturation: One can run into torque, current, or voltage restriction, which produces a powerful nonlinearity leading to overshoot and the resultant instability
- Jitter: Higher gains will lead to minute changes in the feedback to promote large jumps in currents; this causes jitter (small oscillations at standstill)

For instance, the following is the system response as the gains are increased to acquire more rapid response (Figure 6):

**Figure 6. **The system’s response as gains are increased continuously to obtain a faster response.

At 4A, the present current limit n the system is reached. When this limit is reached, it leads to saturation and a resulting oscillation that dies out after emerging from saturation.

This means it would not do well to base the motor and drive sizing only on the speed and torque requirements, but it should also be based on the preferred system response.

In order to prevent system resonance, mechanical transmission parts should be chosen carefully. Finally, the feedback resolution should not be only based on positioning resolution needs, but should also be based on the preferred system response.

## Conclusion

Servo loop tuning is an important task and thus requires a certain amount of finesse. Practical experience is useful, and the information given above will enable users to acquire the preferred response. While the PID algorithm behavior has been interpreted well, there are various system parameters and implementation details that affect the response.

Steady behavior can be more rapidly achieved by gradually increasing the proper gains while tracking the response. Further, torque and current should be observed to establish the amount of power to be applied or to prevent saturation. Performance expectations may need to be altered in case the system is marginally sized.

This information has been sourced, reviewed and adapted from materials provided by IntelLiDrives.

For more information on this source, please visit IntelLiDrives.