cancel
Showing results for 
Search instead for 
Did you mean: 

B-G431B-ESC1 not able to move the motor

Akshat_codes_
Associate II

Hi, 

I am trying to use the disco-B-G431B-ESC1 board to move my gimbal motor. I am using the simpleFOC library example. The problem I am facing is that the motor is not moving. The motor is vibrating at a pole. If I move the motor by force then it vibrates at the next pole but does not start to rotate. I have checked with different motors but the issue persists. I have tried this same code with other gimbal controllers and it works fine. The motors are not faulty as I have tested them. Could anyone please advise me what to do?

Below is the code I am using to run the motor at constant velocity in open loop mode - 

// Open loop motor control example
#include <SimpleFOC.h>


// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(7);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(PA8, PA9, PA10);

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


//target variable
float target_velocity = 10;

void setup() {

  // use monitoring with serial 
  Serial.begin(115200);

  // 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;
  if(!driver.init()){
    Serial.println("Driver init failed!");
    return;
  }
  // 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
  // current = voltage / resistance, so try to be well under 1Amp
  motor.voltage_limit = 3;   // [V]
 
  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;

  // init motor hardware
  if(!motor.init()){
    Serial.println("Motor init failed!");
    return;
  }

  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
  // to turn the motor "backwards", just set a negative target_velocity
  motor.move(target_velocity);
  motor.loopFOC();
}

 

Below is the platform.ini file for my project -

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:disco_b_g431b_esc1]
platform = ststm32
board = disco_b_g431b_esc1
framework = arduino
monitor_speed = 115200
monitor_port = /dev/ttyACM0

build_flags = 
    -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
    -D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
    -D PIO_FRAMEWORK_ARDUINO_USB_HIGHSPEED_FULLMOODE

lib_deps =
    https://github.com/simplefoc/Arduino-FOC.git
1 REPLY 1
GMA
ST Employee

Hello @Akshat_codes_,

It is more relevant to ask your question on the simpleFOC Community platform.
You can also use the Motor Control Software Development Kit Tool available here.
This tool already supports the Gimbal GBM2804H-100T motor, and a motor profiler option allows you to add non-referenced motors.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA