Problems in tuning PI for hub motor hall effect


I’m having some problems in tuning a hub motor with cpr=90 and circunference=81.6816. Therefore, resolution: 0.907 inches/tick. The KP is equal to 1 and the KI is equal to 0.5. Every time I set the set_point to something below to 70, there is a lot of vibration when reaching the reference signal but greater than that works just fine. That happens if I set the PK to a high value but if I set it too low the response time is slow. And even with a slow value, if I disturb the system, it will also vibrate. What could it be? Low resolution from the encoders (I’m using hall effect signals)? Here is a plot:

Yes exactly. Hall sensors do not provide sufficient feedback for position control. They are designed for velocity control.

Actually, I’m using them for velocity control…

Nevertheless, velocity control at very low speeds (especially at zero speed) is essentially the same as position control. Basically, if you can’t rely on the inertia of the system to smooth out the cogging of the motor, then you need a high resolution encoder.

In your graph, the vibration is only seen at zero speed setpoint. This is normal for hall sensors, because they aren’t designed for holding position at zero speed.
As you can see, the control is fine when it is moving.
If you don’t need to hold position, then you should set AXIS_STATE_IDLE when you want the motor to be stopped.
If that’s not good enough, then you need an encoder.

What about changing the tuning parameters when at zero speed? You should be able to find some “soft” tuning that can hold position without vibration/cogging. Has anyone tried this?