SimpleFOC control hub motor problem

Dear All,

Firstly, I used open-loop code to control the small BLDC motor. The result was quite well, the movement of the motor was smooth. Secondly, I used the same open-loop code but change the motor to a hub motor (bigger) instance of a small BLDC motor. I try to command the velocities are 1 and 7 rad/s, but the problems have occurred. For the first 10 seconds, the motor worked normally, after that the movement of the motor was jiggled with the current was decreased. Thirdly, I used closed-loop code to control the hub motor (big one). The result did not work, the motor did not completely move. Could you please guide me on how to make the hub motor move smoothly with open-loop or close-loop code?

Sincerely,
Prim.

This is the attached open-loop code;

// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(11);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);

// Stepper motor & driver instance
//StepperMotor motor = StepperMotor(50);
//StepperDriver4PWM driver = StepperDriver4PWM(9, 5, 10, 6,  8);


//target variable
float target_velocity = 1;

// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
void doLimit(char* cmd) { command.scalar(&motor.voltage_limit, cmd); }

void setup() {

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 12;
  // limit the maximal dc voltage the driver can set
  // as a protection measure for the low-resistance motors
  // this value is fixed on startup
  driver.voltage_limit = 6;
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);

  // limiting motor movements
  // limit the voltage to be set to the motor
  // start very low for high resistance motors
  // currnet = resistance*voltage, so try to be well under 1Amp
  motor.voltage_limit = 3;   // [V]
 
  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;

  // init motor hardware
  motor.init();

  // add target command T
  command.add('T', doTarget, "target velocity");
  command.add('L', doLimit, "voltage limit");

  Serial.begin(115200);
  Serial.println("Motor ready!");
  Serial.println("Set target velocity [rad/s]");
  _delay(1000);
}

void loop() {

  // open loop velocity movement
  // using motor.voltage_limit and motor.velocity_limit
  motor.move(target_velocity);

  // user communication
  command.run();
}

@primpunn

Welcome to the forum, hope you find what you are looking for.

Could you please post more details about the hardware, board and motor, as well as preferably pictures/videos to understand the problem you are facing.

It is relatively difficult to provide feedback based on the short description you posted.

Also what sensors you are using for closed loop?

Cheers,
Valentine

Please check this thread it may help.