General Information


This step usually requires some trial and error before achieving a satisfactory result. A good tuning of the PID in general, has the following characteristics :

  • Responsiveness : Reacting to changes on the command fast
  • Minimal overshoot : The overshoot usually happens when the PI gains are too high, so the variable surpasses the desired setpoint. It is acceptable to have overshoot, as long as it is insignificant and cannot cause damage to the system.
  • Stability: The system should not oscillate uncontrollably.
  • Small Steady-State Error : When the speed command has been stable for some time, the measured speed should be very close to the desired one. The integral (Ki) gain is generally responsible for correcting steady state errors.

We don't generally use differential (D) gain unless we expect strong disturbances on the system. 


Knowing these, we start the PI tuning with a small P gain only, and we increase it up to the point where the responsiveness is high and there is a slight overshoot. In some systems, prioritizing the Integral (I) gain might prove a more efficient tuning way, as it does not amplify noise and may smoothen" out the response.

Remember to save the changed configurations to the controller. For this example we have chosen a P=0.01. This can vary depending on the motor.



PID Tuning process



Prepare the run tab chart :  We are interested in the following variables, logged every 1 ms in the chart : 



Run the motor :  There are two ways to quickly check our PID tuning :


1. We can use the slide bar as before, which now that we use Closed Loop Speed, will be translated to a speed command.

Example : We slide the bar to +500 , and we have set Max Speed = 3000 RPM.  This command we gave, will be translated as speed command of 1500 RPM (50%)


2. We can send speed command explicitly using the console tabs below the run chart. The syntax is :  "!S [channel] [speed]"

Important : Remember the following things before sending commands explicitly via console : 

 -Mute slider command

 -Disable serial command watchdog : 




Example : !S 1 1500 -> Motor 1 goes to speed 1500

!S 1 0 -> Motor 1 stops



3. Get the resulting response from the chart :

 

We notice 2 things here : 

-There is a slight bump at the low speed command. This is attributed to the hall sensors' low resolution which results in bad driving at low speeds. This is expected.

-There is a steady state error between the desired RPM and the actual RPM. 


Let's see if increasing the P gain only, can give a faster response : 


With P = 0.02 the response was indeed faster and the steady state error smaller, but the results on low speeds are a bit undesirable :




Decrease P gain a bit, and add an integral gain. We shall use P = 0.01 and I= 0.01 : 



This time we got both a fast response and a correction of the steady state error. This is a good initial result. 

Keep in mind that this tuning was performed on the bench, where the motor had no load. Under real circumstances, the behavior might differ and different gains might be required for optimal performance.