I'm designing a PMSM controller with the motor has an optical encoder, so I can get position information from the motor. But how to measure the velocity of the motor. Now, my design is to calculate the difference, then add a low pass filter to estimate velocity. The approach is not a good way when the motor runs at a low speed. I have read some research to improve velocity estimation, like Luenberger Observer, Extended State Observer, or Kalman filter. But I don't know what should I choose since I have almost no theoretical basis.
2 Answers
You could employ all the techniques you mentioned that are model-based though, meaning you need to provide a good model of your system and then tune the parameters.
Alternatively, there are other methodologies needing less tuning. Among all these, one of the best technique to use in this situation is definitely the Savitzky-Golay filtering, which performs least-squares fitting over a given time window.
In a nutshell, you have to fit in the least-squares sense the position samples contained within a temporal moving window using a line. The coefficient of this line represents the velocity.
Also, to improve robustness, you may want to make the window adaptive, as done for example in this work, one possible code implementation of which is available here.
-
$\begingroup$ I see Savitzky-Golay filter. But the filter requires the information of y(n+1), y(n+2)... These are future information of the system. And the example, 5 points window with 3 order polynomial, get Y3 = (-3 * y1 + 12 * y2 + 17 * y3 + 12 * y4 - 3 * y5). It seems no difference to FIR filter but looks ahead 2 points. $\endgroup$ Dec 14, 2018 at 4:49
-
$\begingroup$ Nope, the filter makes use of past samples: it is a causal filter. Further, it turns to be very different from a FIR since it performs least-squares fitting rather than a linear combination of the past samples. $\endgroup$ Dec 15, 2018 at 18:31
In slow velocity error will be more since you are PWM mode. Try to use one Schmidt trigger circuit followed by a counter t measure speed. No need to use even filter.