Arduino-FOC
Arduino-FOC copied to clipboard
Stepper voltage bemf with negative velocity
I am using a stepper motor in open loop mode with a KV value. When the shaft velocity is negative, the voltage.q is dropping with velocity while is should be rising which cause the torque to be limited.
I think the problem is here
// calculate the back-emf voltage if KV_rating available U_bemf = vel*(1/KV)
if (_isset(KV_rating)) voltage_bemf = shaft_velocity/KV_rating/_RPM_TO_RADS;
It should be
// calculate the back-emf voltage if KV_rating available U_bemf = vel*(1/KV)
if (_isset(KV_rating)) voltage_bemf = abs(shaft_velocity)/KV_rating/_RPM_TO_RADS;