# Using Integral gain for motor positioning

I'm struggling to see how Integral gain is used for motor positioning.

Suppose we have an AC motor (with a 2048PPR encoder on the shaft) connected to a winch which drives an object forwards and backwards. At 0 speed and 0 torque, there is no movement.

Now, using Proportional gain, we can drive the motor to a position and as it approaches the setpoint, the output to the motor decreases. The motor hopefully lands close to the setpoint.

If we use Integral gain, where the error accumulates, when we reach the setpoint the value of I is still high and the motor overshoots (even with very little ki). This wouldn't be a problem if the motor required a non-zero voltage to maintain its position (e.g. using the motor as a hoist).

The Integral may get very small, causing the motor to stop, but wouldn't it then rise up again after some time (depending on Ki), overshoot, and just oscillate around the setpoint infinitely?

A basic solution I've come up with is to use Integral gain to "push" the motor to its setpoint (effectively correcting the steady-state error), and when the motor is "close enough" to the setpoint, set the output to 0.

Is this a commonly used method? Are there any other approaches?

• See if my answer to electronics.stackexchange.com/a/346759/73158 helps. Apr 8, 2020 at 23:01
• @Transistor, A very good description of PID. However, the answer assumes that an output is necessary to maintain the setpoint (such as would be the case with speed control). In my case, as we reach target position, there is accumulated Integral which causes the motor to overshoot, and then presumably oscillate back and forth, never settling at its target position. Apr 8, 2020 at 23:15
• I want to use Integral gain to "push" the motor that extra bit to its setpoint, but can't see how it wouldn't overshoot Apr 8, 2020 at 23:16
• Read through Eurotherm's PID control made easy twice and then try using their technique to set yours up. They're discussing temperature control but you should be able to adapt the technique. Apr 8, 2020 at 23:25
• @Transistor, which of the several methods would you suggest? Considering I've chosen not to implement Derivative gain, can my PI controller still be tuned such that the motor will settle at its target position (even with I gain), and the Integral reaches 0, or close to it? Apr 8, 2020 at 23:34