Jerky motion at low RPM: B_G431B_ESC1 + Hoverboard Motor

First of all, sorry for another questions about B_G431B_ESC1, I’ve look at many discussions in the forum and couldn’t find a solution for my problem.

I’m getting started with SimpleFOC and just trying to do open loop velocity control. Running in PlatformIO (also tried Arduino IDE but have the same problem). I am using a hoverboard motor.

Issue: Jerky motion of motor at low rpm (target velocity between 1-3). When target velocity is around 6, it runs much better.

The power supply is set at 12V, and current drawn is under 0.8 Amps at low RPM, it decreases as I increase the speed.

Things to note:

  • If I set the motor voltage limit to 3V in the code, the current drawn caps out at 1A and voltage drops to ~7V
  • Motion is not consistent. I will let the motor run for a while and there will be moments where jerkiness will get worse, when this happens, current drawn decreases.
  • I tried a second hoverboard motor and see the same problem.
[env:disco_b_g431b_esc1]
platform = ststm32
board = disco_b_g431b_esc1
framework = arduino
board_build.mcu = stm32g431cbu6
board_build.f_cpu = 170000000L
upload_protocol = stlink

monitor_speed = 115200

build_flags = 
	-D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
	-D HALL_OPAMP_MODULE_ENABLED
	-D SERIAL_UART_INSTANCE=2
	
lib_deps = 
	askuric/Simple FOC @ ^2.2.3

lib_archive = false

Below is my code:

#include <Arduino.h>
#include <SimpleFOC.h>

float target = 1.0;

BLDCMotor motor = BLDCMotor(15);
BLDCDriver6PWM driver = BLDCDriver6PWM(A_PHASE_UH, A_PHASE_UL, A_PHASE_VH, A_PHASE_VL, A_PHASE_WH, A_PHASE_WL);

void serialLoop(){
  static String received_chars;

  while (Serial2.available()) {
    char inChar = (char) Serial2.read();
    received_chars += inChar;
    if (inChar == '\n') {
      target = received_chars.toFloat();
      Serial2.print("Target = "); Serial2.println(target);
      received_chars = "";
    }
  }
}

void setup() {
  Serial2.begin(115200);
  delay(3000);
  Serial2.println("setup");
  
  // driver config
  driver.voltage_power_supply = 12;
  driver.voltage_limit = 10;
  driver.init();

  // link the motor and the driver
  motor.linkDriver(&driver);

  // limiting motor movements
  motor.voltage_limit = 2;   // [V]
  //motor.velocity_limit = 20;

  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;

  // init motor hardware
  motor.init();
  //motor.initFOC();

  //motor.useMonitoring(Serial2);
  // downsampling
  //motor.monitor_downsample = 5000; // default 10
}

void loop() {
  //Serial2.println("running");
  serialLoop();
  //motor.loopFOC();
  motor.move(target);
  //motor.monitor();
}

Additional question, not sure if important: Sometimes the red LED in the board will be green instead of red, what is the meaning of this?

Thanks in advance!!

Even in open loop, there are some default PID values working in the background. They are optimized for small gimbal motor and don’t match well for hoverboard motors.
I don’t remember which variablenames they have, but when you check the threads tagged hoverboard you will gather them eventually.

No no there shouldn’t be any PID running in Open loop.

Are we talking about this kind of jerkiness at slow speed ?

From my point of view this means the voltage limit is set too high. If the power supply voltage drops it means you’re pulling too much current.

What kind of PSU are you using?

Similar, mine is a bit worse. What would be the solution for something like this? Would this get better in closed loop?

I am using this one:
https://www.amazon.com/gp/product/B08HYK2ZW3/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&th=1

Reducing driver.dead_zone can help but you need to be careful not to reduce it too much.
And then deadtime compensation would help but it’s not implemented in SimpleFOC yet.

But follow Richard’s advices first.

Yes, that’s a good power supply for testing, because it will limit the current. We can assume you have the current limit on the power supply set to 1A?

You could try increasing the current limit on the PSU a little bit to 2 or 3A, the B-G431-ESC1 should be able to handle that.

Or you can decrease the voltage limit on the motor to 1V or so - but maybe it will be too low for the motor.

Basically you have a problem if the PSU voltage drops to 7V it’s too low for the ESC1. And if the voltage limit is set too low it might not be enough to move the motor.

So you have to find a good combination of current limit (on PSU) and voltage limit (in software) to ensure:

  • motor moves
  • power supply voltage doesn’t drop (too much)
  • current stays low enough so B-G431-ESC1 does not burn up

Thanks for the help. I increased the current limit in the PSU to 4A, and it runs much better.

Another thing I noticed is that I can’t increase the motor.voltage_limit too much. If I set it to 7V, the PSU reaches the new limit of 4A. Motor vibrates a lot. I’m guessing I need to increase the current limit even more? Is this expected?

I’d like to eventually drive this system with a 24V battery, wondering if that would be possible

I only used openloop-velocity to test the motor connection is right. When the motor vibrates it’s more a sign of too much voltage/current. IMHO it overshoots.
Go further and test the hall sensors. If that works, switch over to closed loop.

thanks, I will study this

At the moment you’re in open loop mode, and current consumption is much higher for the same situation than if you can run in closed loop mode with field oriented control…

However, you have to consider the whole system and the “extreme” conditions it might encounter. You’ll want to use a voltage which gives you the speed and torque you need in your application, and tune things so the motor runs smoothly. Using closed loop control the currents will stay lower in “normal” or lightly loaded situations.

But when you have sudden changes in load or direction of motion, or if the motor becomes stalled, then currents can rise very high as the motor is driven to high torque to deal with the situation. So driver and software also have to be sized and configured to deal with these situations to prevent things burning.

Its also worth mentioning that the B-G431-ESC1 is very small and quite sensitive - you will have to add some cooling to get to higher current levels, and may find that voltage spikes encountered when running at higher voltages give it trouble…

After more reading, I realize the cooling issues with B-G431-ESC1. I would like to get the most torque I can out of the hoverboard motor (speed is not the main factor), so maybe this is not the right board for my application as I don’t want to have to come up with a complicated cooling solution.

Can you recommend a different board that might be a better fit (but still on the affordable side)? Maybe the DRV8302?

Thank you.

Yes, a board based on DRV8302 could certainly work. There are some available on AliExpress, which should be able to handle a decent amount of current and may be enough for your needs…