I am using an AS5147 Rotary Sensor to measure the position of a BLDC Motor. The motor is a 11 pole BLDC/PMSM. I have my own inverter circuit and right now doing a look up table based Space Vector PWM scheme to drive the motor.
For the sake of simplicity, lets assume the encoder gives me degrees (0-360, electrical not mechanical) and based on the measurement, i check my look up table (lets assume it also has 360 values, representing 1 cycle) and depending on the direction i want to drive, i get the duty cycles at the index [EncoderPosition +/- 90 ]. If i want to add a bit of field weakening, i add a few degrees.
This approach gives satisfactory results but what i described above is only valid if what I get from the rotary encoder is actually the rotor flux angle. As far as I've understood the encoder is not synchronized to the rotor flux and just gives me a measurement that has a constant offset to it.
Currently, i am finding this offset by just playing around and trying different values and this 1 SE post suggests that its not that important but for my current implementation that doesn't do current measurement, it really seems to affect the performance.
I tried to automate finding this offset by locking the motor to some position – with an arbitrary index from the look up table, take the measurement from the encoder and get the difference between them and use this as a software parameter. I was a bit lost with this approach since to my understanding, the look up table index represents the stator flux (that i generate) and the encoder measurement should represent (rotor flux + 180), since when the motor is locked, the rotor flux locks itself in the opposite direction of the stator flux. My idea was doing
Offset = (ChosenLookUpTableIndex + 180) – EncoderMeasurement
where (ChosenLookUpTableIndex + 180) is the rotor flux angle when the motor is locked.
I also had other problems such as different motor power cable orderings giving different offsets, some of them not even constant.
I would like to ask if there is a proper way to calculate this offset rather then experimenting with it.
Best Answer
Your initial idea is correct. I will make the assumption that you have a function that runs the Space Vector Machine and that takes 2 input arguments: the stator angle and the magnitude of the stator vector you want to apply. Here is what I suggest to you to solve your problems :
Motor phase sequence not always the same :
Main idea: Feed the SVM with an angle ramp and a positive amplitude to see if rotor turns in the right direction.
Automatically compute the offset (1st method)
Main idea: Feed the SVM with a 0 angle and look at the AS5147 measured angle to find the offset
This method will not be extremely accurate because of friction but it will give you a good estimation of the offset.
Automatically compute the offset (2nd method)
Main idea: Feed the SVM with an angle ramp and look at the AS5147 measured angle to find the offset
Bonus to improve the offset calculation
Here is how you should use the previous offset: