Motor. disable()

Hello comrades.
When the engine stops, the rotor does not have a free stroke, since the mosfets of the lower side remain open. I use the eg2134, 6 pvm driver. It does not have an input switch-on contact. The forum suggests using the motor. disable function. But I have not found an example of its use.
Teach a noob to use this function))).
Mit freundlichen Grüßen
Iurii

Hi @nikolaewich1988 ,

I answered also in your other thread, but I will copy my answer here, in case someone comes looking in this thread:

If you want the motor to disable when the set-point is 0, then just add some code in the main loop:

motor.move();
motor.loopFOC();
if (motor.target == 0.0f && motor.enabled==1)
  motor.disable();
if (motor.target != 0.0f && motor.enabled==0)
  motor.enable();

Note that this requires the enable pin of your driver to be connected, and you to pass it in the constructor of the BLDCDriver:

BLDCDriver6PWM driver = BLDCDriver6PWM(INUH_PIN, INUL_PIN, INVH_PIN, INVL_PIN, INWH_PIN, INWL_PIN, ENABLE_PIN);
or
BLDCDriver3PWM driver = BLDCDriver6PWM(INU_PIN, INV_PIN, INW_PIN, ENABLE_PIN);
or
BLDCDriver3PWM driver = BLDCDriver6PWM(INU_PIN, INV_PIN, INW_PIN, ENU_PIN, ENV_PIN, ENW_PIN);
depending on your setup…

1 Like


I tried adding these lines to the code. Now when the rotor rotates, the engine makes a lot of noise