Skip to main content

Download White Paper

      The goal of a mechanical system built for motion control is to accurately move or position a load.  In an ideal system, the load is rigidly coupled to, and directly driven by, a linear or rotary motor. There are many systems for which this drive method is not an option and a drivetrain is required to drive the load. Some common drivetrains include:

  1. Ball or lead screws
  2. Belt and pulley
  3. Chain and sprocket
  4. Gear trains or rack & pinion
  5. Hydraulics


      Each of these drivetrains introduce errors in the system that influence positional accuracy and repeatability of the load. These errors can be introduced for a variety of reasons: compliance, drive slip, pitch variance, backlash, friction, misalignment, and wear are among the most common. Most errors are a result of tolerances and compliance, both of which are unavoidable in real world systems. Some position errors can be assumed constant with time, such as constant backlash. Others vary with position, time, or loading such as pitch variance, wear, and compliance. In the case of hydraulics, the position of the load is subject to dynamic factors such as variation in pressure, temperature, deadband or hysteresis, and others. 

      For closed loop systems, the most straightforward configuration for the feedback is measuring the position of the drive motor. Systems built with components that have tight tolerances, are structurally rigid, and comprised of low wear components, can achieve a high degree of accuracy and repeatability with the feedback located on the drive motor. However, the components required have higher cost comparatively, which adds to the overall cost of a system.

      The increased cost for precision components is not always feasable or justifiable and more cost effective components must be chosen for the drivetrain. The trade-off is increased errors introduced by the drivetrain from looser tolerances or the addition of components with compliance. If the errors introduced by the drive mechanics are greater than the system requirements, a different feedback configuration is needed. Without feedback on the load, little can be done to compensate for the position errors introduced because there is no way to measure the load’s actual position.

      An alternative encoder configuration puts a single encoder directly on the load. The resolution of the load’s position is a direct function of the encoder resolution. However, this configuration tends to be unstable because the non-linearities and resonances of the system are now part of the control loop. 

      The solution to maintaining system stability while compensating for errors in a drivetrain is to use a dual feedback configuration or dual loop. This combines the stability that is inherent with feedback directly coupled to the drive motor with the added information from the load encoder. This results in the ability to position a load accurately, despite an imperfect drivetrain.

      There are two basic requirements for a system to use dual loop. The first is a load encoder with resolution at least 2 times the position accuracy required for the system. This is a general rule of thumb when deciding the appropriate encoder for a system. The second requirement is that the resolution of the motor encoder should be at least 2 times the resolution of the load encoder, taking any gear reduction into consideration. This is required because 1 count of motor encoder movement must account for less than 1 count of movement of the load. If this condition is not met, 1 motor count can result in more than 1 count of movement of the load, causing dither about the desired position.

Standard Dual Loop

      The primary components of a dual encoder control loop can be seen in Figure 1 where the PID control filter is broken into two parts. The inner loop is comprised of the derivative gain (D term) that receives velocity feedback from the motor encoder and adds pure viscous damping to the control loop. This term is responsible for adding stability to the system. The velocity feed forward (FV) is utilized here to compensate for the phase lag between the inner and outer loop.

Figure 1: Block diagram of the standard dual loop PID filter.

      The outer loop is comprised of a proportional gain (P term) and integral gain (I term) that closes the position loop on a load encoder. This is also known as a PI filter. The P term is responsible for the responsiveness of the system while the I term is used to compensate for steady state position error of the load. The trade-off for a dual loop control filter is that tuning is more complex than a standard PID filter, and a different tuning methodology must be employed to tune this type of control loop.

Advanced Dual Loop

      A properly tuned standard dual loop is able to compensate for mechanical imperfections and accurately position a load but it is not always able to achieve the dynamic system requirements. For systems that require higher bandwidth a more advanced control loop is required.

      The primary difference in the advanced dual loop is that an additional P term has been added to the inner loop. This has the benefit of adding responsiveness and stiffness to the inner loop. From this modification comes an increase in system response.

Figure 2: Advanced dual loop block diagram of PI outer and PD inner loop filters.

      The trade-off for increased bandwidth is additional control loop complexity. The advanced dual loop can be accurately described as having two distinct control filters, one for each encoder in the system. The difficulty lies in optimizing both filters to work in conjunction to achieve the system performance requirements.

Dual Loop Case Study

      For the purposes of this paper, a system was constructed using a non-ideal drivetrain. It was constructed with a brushless rotary motor coupled through a belt and pulley to a ball screw to achieve linear motion. The carriage slides along two polished rods with linear bearings. The load being positioned was coupled to the carriage through a plastic mount. A schematic of the test apparatus can be seen in Figure 3.

      There are various mechanical imperfections in this drivetrain that contribute to load position errors. The belt is subject to backlash and stretch which can result in resonances. The ball screw will have backlash and pitch variances. Finally, load position error can be introduced by flex in the plastic component that mates the ball screw carriage to the load, or from misalignment of the components that make up the drive assembly.

Three control configurations will be compared:

  1. Encoder on motor only
  2. Standard Dual Loop
  3. Advanced Dual Loop


For each control configuration, the motor will be tuned using a profiled move with the following parameters:

  1. Move: 25.4 mm (1 inch).
  2. Acceleration: 500 mm / s2
  3. Deceleration: 500 mm / s
  4. Speed: 178 mm / s


The tuning will attempt to achieve the following goals:

  1. The amount of error during the move must be within +/- 30 μm.
  2. At the end of the move, settle with an error of less than +/- 15 μm as fast as possible.


Figure 3: Schematic of test system constructed with a non-ideal drivetrain.

      First, the theoretical resolution of the load needs to be calculated. This is done by taking the motor’s rotary resolution and scaling based on the pulley gear ratio and the pitch of the ball screw. The theoretical linear resolution with a motor encoder having 4,000 counts per revolution is:

Equation 1: Theoretical resolution of load.

      This results in a resolution of 1.25 μm. The system requires that the load is placed to within +/- 15 μm or +/- 12 motor encoder counts. In order to measure this, the minimum resolution for an encoder attached to the load should be 7 μm or 143 counts per mm. For the purposes of this study, an encoder with 250 counts per mm was used for tuning and positioning the load while an encoder with 1,000 count per mm was used for characterizing the system.

      To see if the system requirements are met by the current configuration, the position error will need to be characterized. Backlash was measured by driving the motor back and forth until motion is detected by the linear encoder affixed to the load. This value includes backlash from the belt under low load conditions and in the ball screw. The total distance that the motor must move to take up the backlash is 5 motor encoder counts and is within the system requirements for positional accuracy.

      Pitch variance or misalignment can also affect how accurately the load can be positioned. Load position error is the difference from where the load should be if the drivetrain were perfect and the position read by the load encoder. The position of the load was read using an encoder with 1,000 counts per mm while the motor was indexed by 1 count at a time. Data was gathered by running the full length of the ball screw in both directions and averaged. Sampling was done with no load and at a rate of 125 counts per second to reduce the contribution from compliance.

      The results of this test is shown in Figure 4. It is evident that driving the motor along this ball screw can result in an error that constantly changes. At its maximum, the load position will deviate by 82 μm, which is beyond the requirements set in place for this system. The source of these errors is due to manufacturing defects, resulting in a slight variation in pitch as well as slight deviation in collinearity. This error profile will vary from system to system as it is entirely dependent on the tolerances within each component.

Figure 4: Load position error vs. displacement along lead screw.

      Finally, there are errors introduced by the compliance of the belt. This was measured by clamping the load and driving the motor open loop in the positive and negative direction to measure the amount of stretch from the belt. This was measured to be approximately +/- 550 motor encoder counts or 688 μm. It is clear that the biggest contributor to load error in the drivetrain is the belt and that the current system does not meet the system requirements for positional accuracy. In addition to position error, the belt’s compliance also adds resonance at a frequency of approximately 34 Hz. With the drivetrain characterized, the three encoder configuration options will be explored in order to determine which gives the best performance.

      The first option is to use the motor encoder to position the load. In this configuration, the position of the load will have errors introduced from the drivetrain without a means of correction. After tuning the system, the load was positioned in the middle of travel and the motion profile was plotted (shown in Figure 5). The end of the move is marked with a vertical line at 472 ms for reference.

      The theoretical load position error, given the motor encoder alone is shown in red on the bottom plot and is always within the acceptable error band and converges quickly to zero error when the move is finished. The actual load error measured by the load encoder (shown in green on the bottom plot) has a steady state error of -137 μm at the start of the move. The load oscillates during the move and finally comes to rest with a steady state error of -110 μm, outside the acceptable error band. Based on these results, the motor is stable but the system is unable to position the load to the accuracy that is required. 

Figure 5: Motion profile and error of the system with a single motor encoder.

      Next, standard dual loop was employed in an attempt to increase the accuracy and repeatably of the system. The error during the move does not exceed 55 μm, shown in Figure 6. The dual loop encoder configuration commands motion using the load encoder. Because of this, the motor encoder error is omitted from the plot and analysis is focused on the load position error. The error settles to be within the error band 112 ms after the move ends. Adding a load encoder and using standard dual loop, the system was able to always converge on a steady state error of 0 counts and has a much smaller error band. While this is an improvement over the configuration with only the motor encoder, the error during the move was not within the acceptable +/- 30 μm and further improvement is needed.

Figure 6: Motion profile and error of the system with the standard dual loop.

      Finally the advanced dual loop was employed in order to meet system requirements. After tuning, the characterizing move was performed and the motion was plotted. The advanced dual loop implementation was able to bring the peak error during the move down to, or below, 30 μm, shown in Figure 7. One count error (1.25 μm) was attained 108ms after the move had ended, showing improvement from either of the two previous configurations. The effects of the resonances have also been reduced to an acceptable level.

Figure 7: Results from tuning the system with advanced dual loop.

      The test system was constructed with 6 μm of backlash, a maximum deviation of 82 μm due to pitch variance and misalignment, and 688 μm in compliance. The system required that the end position accuracy be less than 15 μm and that the position error be within +/- 30 μm for the duration of the move. The advanced dual loop was used and able to successfully move the load with less than 30 μm of error for the duration of the move and settle to 1.25 μm of error within 108ms. With this configuration, system requirements for accuracy and repeatability can be met.


      Using a drivetrain can result in position errors of the load and can sometimes add instability or resonances to a system. Systems with a drivetrain that do not currently meet the system requirements for accuracy can benefit from the addition of feedback to the load and closing a position loop using standard dual loop. This is a standard feature on all current generation Galil motion controllers and is available using quadrature, SSI, or BiSS encoder feedback. Systems that require a further increase in bandwidth, above and beyond the standard dual loop, will benefit from the advanced dual loop. The advanced dual loop compensation is a separate firmware that is also available. 

      Contact a Galil Applications Engineer for questions regarding dual loop compensation methods or to discuss how to best address your application requirements.