Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
49 ratings:
 4.36 out of 5   

A Simple Method for Servo Motor Tuning



Primary Software:
Primary Software Version: 7.6
Primary Software Fixed Version: N/A
Secondary Software: N/A
Hardware: Motion Control>>Controllers>>PCI-7350

Problem:
I can't seem to get my servo motor tuned.  Is there a simple method to find PID gains that will give me something close to my desired response?

Solution:
This document is intended to complement the Understanding Servo Tune Developer Zone document, which more thoroughly explores the concept of servo tuning.  There is no single proper way to do manual servo tuning, but the method outlined below provides a simple method to quickly determine gains that are in a reasonable range to provide a good response from the system. 

Tuning Features of Measurement & Automation Explorer

One way to tune an NI-Motion system is to open up the Step Response and Control Loop tabs as separate windows.  To do this, follow these steps:
  1. In Measurement & Automation Explorer (MAX), go to Calibration»Servo Tune for your motion controller.
  2. Click and hold the Step Response tab
  3. Drag the mouse until the Step Response tab appears as a separate window
  4. Click the push pin icon at the top right of the window to keep the Step Response window open.
  5. Repeat these steps for the Control Loop tab.  Arrange and resize the windows so that you can see them side by side as you tune your motor.  Images of the windows are shown below for your reference.

StepResponse

ControlLoop


The Method of Tuning

Now that you have the windows arranged so that you can easily modify your control loop, and see the changes in the step response, take the following steps to tune your PID control system.
  1. Set all three PID parameters, Kp, Kd, and Ki to 0
  2. Start by tuning Kp.  Set it to a number that is much lower than needed.  If you are unsure, start with 1.
  3. Click the Step Response button to view a step response graph of your system.  Step response plots are described in further detail in the Understanding Servo Tune document mentioned earlier.
  4. If the graph shows the parameter is:
    • Too Low - Double the value of the parameter.
    • Too High - Set the parameter to halfway between the current value and the previous value.
  5. Repeat steps 3 and 4 until you achieve a reasonable value for Kp. For most systems, this will mean that the response will approach the input, and oscillate continually about the input with a small amount of dampening.  If the oscillation does not gradually decrease in amplitude as shown below, then the system is considered unstable.  If this occurs, you may need to add a small amount of Kd while you are repeating steps 3 and 4 to increase Kp.

  6. After you arrive at a reasonable value for Kp, move on to Kd.
  7. Repeat steps 3 and 4 for Kd until you achieve a reasonable value for Kd.  For most systems, this will mean that the response will no longer oscillate continually, but will quickly dampen to a steady state value.  This steady state value may be slightly offset from the input value, and this offset can be corrected with an appropriate Ki value.

  8. After you arrive at a reasonable value for Kd, move on to Ki.
  9. Repeat steps 3 and 4 for Kd until you achieve a reasonable value for Ki.  This parameter works on the integral of the position error therefore taking out offset error.  Please use this parameter conservatively as it can introduce instability into the system.
A Tuning Example

The table below provides an example of using this method to quickly tune a servo motor.  This example took 20 iterations to arrive at a reasonably well tuned system.  The gains used in each iteration are shown as well as the step response graph and characteristics.  The screenshots from this tuning are also shown in the animated image of the Step Response window at the beginning of this document.

Step
Kp
Kd
Ki
Settling Time (ms)
Rise Time (ms)
Peak Time (ms)
Max Overshoot (%)
Step Response
1
1
0
0
315
96
165
40
2
2
0
0
363
57
114
67
3
4
0
0
567
39
81
89
4
8
0
0
594
27
60
91
5
8
1
0
594
27
60
88
6
8
2
0
594
30
63
88
7
8
4
0
594
27
60
88
8
8
8
0
588
30
63
84
9
8
16
0
501
27
60
78
10
8
32
0
366
30
60
68
11
8
64
0
255
30
60
53
12
8
128
0
162
33
60
29
13
8
256
0
105
45
75
3

14
8
192
0
132
39
66
13
15
8
192
1
534
42
66
3
16
8
192
2
582
36
69
28
17
8
192
4
561
36
69
27
18
8
192
8
237
33
66
54
19
8
192
16
462
30
63
75
20
8
192
12
546
30
63
63
 


Related Links:
Product Documentation: Understanding Servo Tune
KnowledgeBase 39DHP4QX: Unable to Tune a Servo Motor
KnowledgeBase 1A1FUIYP. Torque and Velocity Mode Differences and NI-Motion Compatibility
National Instruments Motion Control Support Homepage

Attachments:





Report Date: 06/14/2007
Last Updated: 08/24/2016
Document ID: 4AD9N5P9

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit