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.

Measuring speed from absolute encoder

Other Parts Discussed in Thread: MOTORWARE, CONTROLSUITE

Hi

i am using the speed_fr library with the IDDK code example to construct velocity control loop.

i am setting the k1,k2,k3 coffiecents as follows:

speed1.K1 = _IQ21(1/(BASE_FREQ*T));
speed1.K2 = _IQ(1/(1+T*2*PI*CUT_FREQ)); // CUT_FREQ Low-pass cut-off frequency
speed1.K3 = _IQ(1)-speed1.K2;

for velocity calculation the code example uses the electrical angle. also the electrical and mechanical angles are scaled to 0 -1 values.

the control loop works very good, my problem is that i dont understand how to calculate the real velocity from the scaled value that is out put by the speed_fr .

for example  if i want to know the velocity in deg/sec , from how i understand it : i need to take the scaled velocity divided by the pole pairs number (electrical to mechanical velocity) and then multiply it by 360 (to go from the scaled (0 - 1) values to 0 -360. and then multiply it by the BASE_FREQ.

by this calculation i always get values 2 time lower then the actual motor speed.

be happy for advise,

MARK

  • Dear Motorware team,

    I have the same question as Mark Pesach, I also want to use modules qep.h/qep.c and enc.h/enc.c in library of Motorware in order to build a project of motor control with real speed feedback by absolute encoder. However, I don't find any example in which explains in detail about how to use module QEP and ENC to get the speed information.

    Please guide me how to.

    Thank you in advance.

    Mr. Tran
  • Binh,
    I would suggest looking at the controlSUITE projects which use encoders.
    C:\ti\controlSUITE\development_kits\TMDSIDDK_v2.0\IDDK_PM_Servo_F2837x_v2_00_00_00
    C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1\HVACI_Sensored\~Docs

    in MotorWare the calculations from the encoder data is processed by a SpinTAC component. See proj_lab12.
  • Dear Chris,

    Thank you for your guide. I have one more question about InstaSPIN projects which relate to ENCODER. Namely, I find that the InstaSPIN have two modules for CTRL:

    a) ctrl.h/ctrl.c

    b) ctrlQEP.h/ctrlQEP.c which include "#include "sw/modules/enc/src/32b/enc.h" 

    I want to know how different between these modules is? Because I saw CTRL_runOnline_User() and CTRL_runOnline() functions in both modules is the same.

    Thank you!

  • you can do a diff on the files and see the code is the same, just with the QEP for the CTRL functions you need to pass in the Electrical angle since you are no longer using the EST for electrical angle

    ,uint32_t electricalAngle)

  • Dear Chris,

    I saw.

    Thank you for your reply.