Bldc motor stops within a few turns

Hi, I recently bought a GBM5208 bldc motor from aliexpress: https://a.aliexpress.com/_okbyWe3

I used an arduino and a simplefoc shield V2.0.4 to control this motor.

While I was doing a closed loop velocity control, I encountered a problem.
It just turns within a few seconds and stalls by itself.
This happens also when I control the motor with the odrive, but not so often.

I’ll attach a link for a demo video about the problem.
I’d be happy to hear your advice.

Hi @SamLee0510,

Which sensor are you using?
It sounds like a sensor issue. Either the encoder which is loosing steps or the magnetic sensor that’s getting missaligned.

This does not happen in the open-loop right?

Additional Information:

power supply voltage: 12V
encoder: AMT102-V

code: (SimpleFOC Library example > motion_control > velocity_motion_control > encoder

#include <SimpleFOC.h>
#include <PciManager.h>
#include <PciListenerImp.h>

BLDCMotor motor = BLDCMotor(11);
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);
Encoder encoder = Encoder(2, 3, 2048);

void doA(){encoder.handleA();}
void doB(){encoder.handleB();}
void doIndex(){encoder.handleIndex();}
PciListenerImp listenerIndex(encoder.index_pin, doIndex);

float target_velocity = 10;
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }


void setup() {
  encoder.init();
  encoder.enableInterrupts(doA, doB);
  // software interrupts
  PciManager.registerListener(&listenerIndex);
  motor.linkSensor(&encoder);

  driver.voltage_power_supply = 12;
  driver.init();
  motor.linkDriver(&driver);

  motor.voltage_sensor_align = 3;
  motor.velocity_index_search = 3;

  motor.controller = MotionControlType::velocity;

  motor.PID_velocity.P = 0.2f;
  motor.PID_velocity.I = 20;
  motor.PID_velocity.D = 0;
  motor.voltage_limit = 6;
  motor.PID_velocity.output_ramp = 1000;

  motor.LPF_velocity.Tf = 0.01f;

  Serial.begin(115200);
  motor.useMonitoring(Serial);

  motor.init();
  motor.initFOC();

  command.add('T', doTarget, "target velocity");

  Serial.println(F("Motor ready."));
  Serial.println(F("Set the target velocity using serial terminal:"));
  _delay(1000);
}


void loop() {
  motor.loopFOC();

  motor.move(target_velocity);

  command.run();
}

The code is almost the same as the original example except I changed the initial velocity to 10.

Hi @Antun_Skuric!
I’m using AMT102-V from CUI, the incremental encoder.
There was no shaft to my motor so I made a mount on the motor and drilled a long screw to use it as a shaft.

I think a slip might occur while spinning.
Maybe I’ll try with a magnetic encoder!

Yes you’re right!

It might be the shaft slip or even just the cables that are not very well connected. I’d suggest you to try a bit better cables than these jumpers :smiley:
The encoder signals are very sensitive.

You can test this easily. Run the example code for only the encoder (you can find it in the library examples) and see if when you move the jumpers a bit the angle changes. If it fluctuates (or changes) a bit this has a huge impact on the FOC and these cables will not be good enough. :smiley: