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.

Encoder not showing correct RPM



Hi,

I am trying a sensored FOC project. I am using a 500 lines encoder to measure the RPM and electrical angle. The motor is working fine, but the problem is that encoder is not showing the exact rotor RPM. If the encoder is showing 3000 rpm, the rotor rpm would be running at 3008rpm. This offset is not linear. At 900rpm the reading will be correct. At 300rpm the rotor will be rotating at 292rpm. I verified that the encoder is showing the wrong rpm by observing the A and B pulses from the encoder with an oscilloscope.

 Following is the code 

:

:

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

:

:

_iq Tmp_fr;

#define SPEED_FR_MACRO(v) \
/* Differentiator*/ \
/* Synchronous speed computation */ \
if ((v.ElecTheta < _IQ(0.9))&(v.ElecTheta > _IQ(0.1))) \
/* Q21 = Q21*(GLOBAL_Q-GLOBAL_Q)*/ \
Tmp_fr = _IQmpy(v.K1,(v.ElecTheta - v.OldElecTheta)); \
else Tmp_fr = _IQtoIQ21(v.Speed); \
/* Low-pass filter*/ \
/* Q21 = GLOBAL_Q*Q21 + GLOBAL_Q*Q21*/ \
Tmp_fr = _IQmpy(v.K2,_IQtoIQ21(v.Speed))+_IQmpy(v.K3,Tmp_fr); \
/* Saturate the output */ \
Tmp_fr=_IQsat(Tmp_fr,_IQ21(1),_IQ21(-1)); \
v.Speed = _IQ21toIQ(Tmp_fr); \
/* Update the electrical angle */ \
v.OldElecTheta = v.ElecTheta; \
/* Change motor speed from pu value to rpm value (GLOBAL_Q -> Q0)*/ \
/* Q0 = Q0*GLOBAL_Q => _IQXmpy(), X = GLOBAL_Q*/ \
v.SpeedRpm = _IQmpy(v.BaseRpm,v.Speed);

#endif // __SPEED_FR_H__

How can I correct this? Please help.

Thanks.