Motor stuttering at low and high speed with openloop

Hello all,
I already this topic Open loop velocity control not working at low velocity but I couldn’t link my case with this one.
Here is the setup.
Motors : 2x2206 100T and 1x2804 100Kv (Moteur de cardan sans balais pour appareil photo numérique CNC, support FPV, 2208 80T, 2204 260KV, 2804 100KV, 2805 agglomKV, 2206 100T - AliExpress 26)
Driver : Mimi L298N (Same as L298B but smaller and limited to 10V !!!, Max 1.5A)
Boards: BlackPills (stm32f411)

I gathered some info about motors (2206, 260Kv, 12 poles Res=80mOhm) (2804, 100Kv, 14 Poles, 100mOhm)
I Tried different Voltage 3.7, 5V, 7.2V and this has no change.

Motors stuttere at low speed and jeks at high speed

Here the code

#include <SimpleFOC.h>

// target variable
float target_velocity=1;
float prev_target_velocity=0;

BLDCMotor motor = BLDCMotor(4, NOT_SET, 260, NOT_SET);
BLDCDriver3PWM driver = BLDCDriver3PWM(PA_2, PA_1, PA_0);

float voltage_limit = 3.7;

// commander interface
Commander command = Commander(Serial, '\r', true);
void onTarget(char* cmd){ command.scalar(&target_velocity, cmd); }
void onTarget2(char* cmd){ command.scalar(&voltage_limit, cmd); }

void setup() {
  Serial.begin(115200);

  SimpleFOCDebug::enable(&Serial);

  _delay(1000);

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 5;
  driver.voltage_limit = voltage_limit;   // Volts
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);

  // choose FOC modulation (optional) - SinePWM or SpaceVectorPWM
  motor.foc_modulation = FOCModulationType::SpaceVectorPWM;

  // limiting voltage
  motor.voltage_limit = voltage_limit;   // Volts

  // or current  - if phase resistance provided
  motor.current_limit = 1; // Amps

  motor.controller = MotionControlType::velocity_openloop;

  // initialize motor
  motor.init();

  // align encoder and start FOC
  motor.initFOC();

  Serial.println("Motor ready");
  _delay(1000);

  // add target command T
  command.add('T', onTarget, "target velocity");
  command.add('V', onTarget2, "Voltage limit");

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

void loop() {
  motor.loopFOC();
  motor.move(target_velocity);

  motor.voltage_limit = voltage_limit;   // Volts
  driver.voltage_limit = voltage_limit;   // Volts

  if (prev_target_velocity != target_velocity) {
    Serial.print("Velocity= "); Serial.print(target_velocity);
    prev_target_velocity = target_velocity;
  }
  // iterative function setting the velocity target
  command.run();
}

I know there is something wrong … but what ?

Hey @MORDRET_Pierre-Yves,

Welcome to SimpleFOC!

A few points I note:

  1. The motors you link, in my experience, have around 5-10ohm phase resistance. Not 100mOhm like you write. Did you measure them?
    But in your sample code you’re not using the resistance value, so it should not matter.

  2. You’re using the same voltage limit on motor and driver, which will lead to a lot of overmodulation. Please try with motor.voltage_limit = driver.voltage_limit/2.0f;

  3. Please remove the KV value from the motor constructor for initial testing. You can always add it back later.

  4. The L298N is a very old transistor based h-bridge. It’s hard to get good performance out of it. In particular, I think running it at 5V is a bit low, you might have better results with the motor supply voltage at 10V, well above the logic switching voltage (3.3V for the black pill MCUs).

Hi Runger,
Thanks for you answer but I figured what happen. This is bad Motor driver. Switching on DRV8313 (SimpleFOC Board) and things goes smoothly. I tried with 7,4V and 11,8V. Rotation is good
As for 1. : how to measure ? between 2 random phases ?
As for 2. : What is overmodulation ?
Thanks

Yes, use a quality multi meter to measure the resistance between any two of the three phase wires.
If it’s a low resistance motor the multimeter may not be able to measure it well, but if the resistance is above 1ohm then it should be measurable.

It’s when the voltage you want to set to the motor is higher than the driver voltage limit, or less than 0. Then the voltage gets “clipped” to the driver limit.

The motor voltage limit acts on the D-Q axis voltage in the FOC coordinate system, which can be positive or negative. So in effect when you set the motor.voltage_limit to 3.7V the voltage can go from -3.7 to +3.7V, a range of 7.4V. But the driver voltage limit is only from 0 to 3.7V, a range of 3.7V…. So to prevent clipping (overmodulation) you need to set the motor limit to 1/2 the driver limit.
Please see: