This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to spin 1 rev at very low speeds on power up before force alignment of Encoder in the Rs Recalculation step ?

On startup. I have to do few calibration steps.

In the default code as soon as gMotorVars.Flag_Run_Identify is made 1 , the controller goes through various steps one of them being the Rs Recalculation step where the force alignment of encoder happens and then Encoder ZeroOffset is calculated. 

Since, I am using Index pulse, here is something different that I need to do. I tested it by hand and it works great.

After gMotorVars.Flag_enableSys is made 1, the QEP module is active , so I spun the motor once by hand, this made sure the QEP module found the index pulse and reset the count to zero at index and then after that the encoder count is always an absolute value relative to the stator. 

After that, I set the gMotorVars.Flag_Run_Identify to 1, this runs the Rs Recalculation step where the force alignment of encoder happens and then Encoder ZeroOffset is calculated. 

then I use Lab 13b, which works as usual except that now I can command it to go to positions that are absolute relative to stator and not just relative to a random position where the rotor was on powerup. gMotorVars.PosStepFrac_MRev is being calculated based on desired encoder count and current encoder rather than entering values directly into gMotorVars.PosStepFrac_MRev. It works pretty good because I have aligned the index on the encoder to a certain point on the stator. so, every rotor position corresponds to a distinct encoder count.

My goal is now to automate the process so I don't have to rotate it by hand. 

So, What the best way to make the motor on powerup

1) Rotate at least 1 rev at pretty low speed without using the encoder

2) The motor stops and does a Rs Recalculation step where the force alignment of encoder happens and then Encoder ZeroOffset is calculated. 

thanks

subrat

gMotorVars.PosStepFrac_MRev

  • I've tagged this for Adam
  • subrat nayak said:
    1) Rotate at least 1 rev at pretty low speed without using the encoder

    This will be a challenge.  When doing sensored motor control you expect that the sensor will be available for you.  You could use FAST in order to spin the motor but it isn't guaranteed to spin exactly 1 revolution, and the speed will be dependant on how slow you can accurately detect the BEMF of the motor.  You could write your own open loop routine that manually forces the motor to rotate using a fixed amount of current.  

    subrat nayak said:
    2) The motor stops and does a Rs Recalculation step where the force alignment of encoder happens and then Encoder ZeroOffset is calculated. 

    If you have the encoder aligning off of index you should be able to skip this step and you should be able to get a ZeroOffset that is relative to your index location.

  • HI Adam.

    1) step 1 doesn't have to be exact 1 Rev and the speed doesn't have to be exact, just some thing not too fast just for safety . So, I was thinking of  trying using the sensorless speed mode like in  lab 5b for enough time so it definitely makes 1 rev OR There is also a bit in the qep status that shows 1st index marker hit,  I could spin till that bit is set.

    2) but my problem is I don't know how to cause the force alignment rs recalculate again after the motor is already spinning.  Will re setting run_identify restart the usual  startup sequence?

    I am not sure what you meant by get zero offset relative to index. Because it's hard to align the index to the point  where rotor has same electrical angle when held in plce during rs recalculate right??

  • Hi Adam,

    In lab 13b, original code.

    After gMotorVars.Flag_Run_Identify is made 1 and the rotor just holds position. Sometimes, the motor looses position and just starts spinning like crazy, pulls lot of current and resets the power supply. It happens pretty radomly and I have not been able to recreate it at will. Any suggestions, what might be causing it?

    thanks
    Subrat