Home > Industry Insights >Servo
TECHNICAL SUPPORT

Product Support

Steering gear control PID algorithm principle: the functions of proportion, integral, and differential and parameter adjustment methods

Published 2026-05-01

01Principle of PID algorithm for steering gear control: from principle to practical operation

The key to controlling the servo is to make the output shaft accurately follow the target angle. The PID algorithm, also known as Proportional-Integral-Derivative, is a professional standard way to achieve this goal. This article directly analyzes the role of each PID parameter in the servo position loop, as well as parameter adjustment methods for common problems, and provides operation steps that can be started immediately.

1. The essential role of PID algorithm in steering gear control

There is a closed-loop control system inside the steering gear, in which the microcontroller is responsible for measuring the current angle, and then comparing it with the target angle to obtain the deviation value, and then the PID controller calculates the correction amount based on the deviation.. This drives the motor to rotate.PID has a core mission, which is to bring the deviation close to zero and ensure that the entire process is fast and stable without oscillation.

The functions of the three parameters are as follows (based on standard position loop control):

parameter Chinese name Effect on steering gear Typical problems caused by oversize
Kp proportional coefficient Respond directly to the current deviation and generate a basic correction amount The servo vibrates violently and oscillates back and forth at the target position.
To Integration coefficient Eliminate static errors (small deviations accumulated over time) so that final angles are accurately aligned Slow response, slow callback after "overshooting"
Kd Differential coefficient Predict deviation trends and suppress overshoot and oscillation Sensitive to noise, the servo will vibrate at high frequencies

Writing tip: When you first start adjusting parameters, proceed in the order of "first adjust Kp, then adjust Kd, and finally it is Ki's turn."

2. Common situation cases: PID parameter adjustment process of two typical problems

Case 1: The servo swings back and forth near the target position (high-frequency oscillation)

The fault situation is that the given displacement is 90°, but the actual angle is shaking continuously and rapidly between 88° and 92°, and at the same time, the motor generates heat.

Cause analysis: Kp is too large and the proportional response is too strong.

This is a process of adjusting and optimizing the parameters of a system to eliminate oscillation and shorten the stabilization time. The specific operation is to reduce Kp by 30% to 50%, and at the same time slightly increase Kd. The increment is about one-tenth of the original Kp. For example, Kp is originally equal to 2.0 and needs to be changed to 1.2, while Kd increases from 0.05 to 0.08. Finally, the oscillation is eliminated and the stabilization time is shortened.

舵机控制pid算法原理_控制舵机的程序_舵机pid公式

Case 2: The servo drifts slowly, always with a difference of 2° and cannot reach the position (static difference)

The fault shows this phenomenon: the target is at 180 degrees, but the actual temperature is stable at 178 degrees. When an external force is used to push it, it will rebound to 178 degrees.

Cause analysis: Pure proportional control cannot eliminate static differences and lacks integral function.

Here is a step-by-step solution: start with Ki equal to 0.01, then increment by 0.005 each time, and continue this until the deviation is less than 0.5°. It should be noted that if Ki is too large, it will cause overshoot, so Kd must be fine-tuned simultaneously to suppress overshoot.

Regarding the novice parameter adjustment scenario, these two cases cover more than 80%.Remember, after adjusting any parameter, you must observe at least 5 complete action cycles to prevent a single accidental data from misleading the correct judgment.

3. Step-by-step PID parameter adjustment operation process

The following process is applicable to the position closed-loop control of all digital servos. It does not require a specific brand of hardware. It only needs to be able to read the current angle and write the PWM duty cycle.

The first step is to lock the servo mechanically at any position and only output a fixed PWM in open loop to verify whether the angle feedback is linear. If the feedback jump exceeds ±0.5°, first check the connection of the potentiometer or magnetic encoder.

Step 2: Set Ki=0, Kd=0, and only adjust Kp.

Start with a minimum value, like 0.1, double the operation each time, and continue doing this until the servo oscillates slightly for the first time.. Record that critical value Kp_max. The final Kp is selected as 0.6 times Kp_max, which is a value obtained based on engineering experience.

Step 3: Add Kd to suppress overshoot.

Set Kd to 0.1 of Kp as a starting point. Then gradually increase Kd, and then observe whether the "peak" at the startup moment will decrease. When Kd exceeds 0.3 times Kp, if there is still no improvement, stop increasing.

Step 4: Add Ki to eliminate the static difference.

舵机控制pid算法原理_控制舵机的程序_舵机pid公式

Start by setting Ki equal to Kp times 0.02. If the static difference still exists, then it will increase by 0.005 each round. After the static difference disappears, add 20% Ki as a safety margin.

Writing tips: Error drive is the core logic of closed-loop control, not like open-loop instructions. Be sure to ensure that the main loop period of your program is fixed (2-5ms is recommended here), otherwise the PID calculation will be invalid.

4. Repeat core ideas and action suggestions

The core point is reiterated:

1. PID is not magic. It is a mathematical tool that uses proportion to "pull", integral to "grind", and differential to "block" to eliminate angle deviations.

2. The first suspect for servo vibration is always excessive Kp, not hardware damage.

3. If there is no static error, the integral term (Ki) must be relied on. There will always be a slight deviation based on the proportion alone.

Action suggestions for you (implement immediately):

From the robotic arm joints, gimbal, etc., select a servo position control scenario that will cause you the most headaches, record the current PID parameters, and then record the corresponding phenomena. After recording them all, record them all again.

Follow the four-step process in Part 3 to re-adjust the parameters and compare the before and after effects.

Record each set of parameters and data in the parameter adjustment process to form your own personal parameter adjustment table.

5. Frequently Asked Questions Q/A

Q1: What is the reason why the servo suddenly turns sharply in the opposite direction when it is started?

If Kd in A is too large and causes the differential term to over-response to the initial error jump, the first step is to set Kd to zero for testing. If this over-response disappears, reduce Kd to 30% of the original value.

Q2: My servo response is too slow, which parameter should be increased?

First, increase Kp by 20% each time, continue this operation until a slight oscillation occurs, and then perform a callback operation with a callback amplitude of 10%. However, Ki and Kd are always maintained at their minimum values.

Q3: What should I do if the angle feedback is very noisy and the PID cannot be stable at all?

First of all, the problem to be solved by the hardware layer is the increase of the power supply filter capacitor associated with the angle sensor. The specific value of this capacitor is 100μF. Then there is the operation of the software layer. It is necessary to implement first-order low-pass filtering for the feedback value. The coefficient used for filtering is 0.2.

Q4: After the points item is added, the target position always overshoots and comes back. What should I do?

Reduce Ki and check whether the program includes the negative deviation in the overshoot stage when performing integral calculations. The integral separation method is used, that is, the integration is started only when the deviation is less than 5°.

Q5: The same parameters perform inconsistently at different angles. How to optimize them?

A: Explain the non-linear situation presented by friction or load. Use the segmented PID method, that is, divide 0° to 180° into 3 areas with different conditions, and perform a separate set of parameter calibration activities for each area. During operation, do you rely on the verification table and then switch operations?

Writing tip: There are no foolproof parameters for adjusting parameters, and differences will occur every time the machine is assembled. Your task is to find the best solution under the current mechanical situation through the process of this article, rather than to find the absolutely correct answer. Taking a hands-on test will yield more benefits than reading ten articles.

The final conclusion is that the key point of steering gear PID control is to understand the responsibilities of Kp, Ki, and Kd, and to deduce parameter issues in the opposite direction based on the order of "first proportion, then differential, then integral" and based on the actual phenomenon. Immediately pick up the servo you have on hand and verify it according to the process described in this article. You will fully grasp the principles and applications of PID in servo control.

Update Time:2026-05-01

Powering The Future

Contact Kpower's product specialist to recommend suitable motor or gearbox for your product.

Mail to Kpower
Submit Inquiry
+86 0769 8399 3238
 
kpowerMap