I burned six B-G431-ESC

Hi Guys, i am working with 36v 350W hub motor, B-G431-ESC and AB encoder. i connected the encoder with gear ratio of 1:5. i am wanted to use closed loop with Space Vector PWM for better efficiency. Two condition it got while motor initialize if motor cant move then click noise ESC not working anymore and other condition while tuning q_current and p_current parameters some time motor get vibrate while move and sudden jerk and B-G431 not working anymore. so anyone tried Pat92fr FOC2 code. what you guys think about that code. this is the code i am using

#include <SimpleFOC.h>

// Motor instance
BLDCMotor motor = BLDCMotor(15,0.7,40);
BLDCDriver6PWM driver = BLDCDriver6PWM(A_PHASE_UH, A_PHASE_UL, A_PHASE_VH, A_PHASE_VL, A_PHASE_WH, A_PHASE_WL);
LowsideCurrentSense currentSense = LowsideCurrentSense(0.003f, -64.0f/7.0f, A_OP1_OUT, A_OP2_OUT, A_OP3_OUT);

// encoder instance
Encoder encoder = Encoder(A_ENCODER_A, A_ENCODER_B, 3360);

unsigned long previousMillis = 0;  
// Interrupt routine intialisation
// channel A and B callbacks
void doA(){encoder.handleA();}
void doB(){encoder.handleB();}
void doIndex(){encoder.handleIndex();}

// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd)
 { 
    command.motor(&motor, cmd); 
    previousMillis = millis();
 }

      // will store last time LED was updated
// constants won't change:
const long interval = 1000;           // interval at which to blink (milliseconds

void setup() {
  // initialize encoder sensor hardware
  encoder.init();
  encoder.enableInterrupts(doA, doB); 

  // link the motor to the sensor
  motor.linkSensor(&encoder);
  
  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 20;
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);
  // link current sense and the driver
  currentSense.linkDriver(&driver);


  

  // aligning voltage [V]
  motor.voltage_sensor_align = 1;
  // // index search velocity [rad/s]
  motor.velocity_index_search = 1;

  // set motion control loop to be used
  motor.controller = MotionControlType::velocity;

  // motor.torque_controller = TorqueControlType::foc_current; 

  motor.motion_downsample = 0.1;
  
  
  // contoller configuration 
  // default parameters in defaults.h
  
  // velocity PI controller parameters
  motor.PID_velocity.P = 0.6;
  motor.PID_velocity.I = 0.8;
  motor.PID_velocity.D = 0.00;
  
  motor.PID_velocity.limit = 20.0;
  // jerk control using voltage voltage ramp
  // default value is 300 volts per sec  ~ 0.3V per millisecond
  motor.PID_velocity.output_ramp = 300;
 
  // velocity low pass filtering time constant
  motor.LPF_velocity.Tf = 0.01;
  // angle P controller
  // motor.P_angle.P = 0.8;
  //  maximal velocity of the position control
  motor.velocity_limit = 20.0;
  motor.current_limit = 8.0;
  motor.voltage_limit = 20.0;

// Q axis
// PID parameters - default 
motor.PID_current_q.P = 5;                       // 3    - Arduino UNO/MEGA
motor.PID_current_q.I = 0;                    // 300  - Arduino UNO/MEGA
motor.PID_current_q.D = 0;
motor.PID_current_q.limit = motor.voltage_limit; 
motor.PID_current_q.output_ramp = 300;                  // 1000 - Arduino UNO/MEGA
// Low pass filtering - default 
motor.LPF_current_q.Tf= 0.01;                         // 0.01 - Arduino UNO/MEGA

// D axis
// PID parameters - default 
motor.PID_current_d.P = 5;                       // 3    - Arduino UNO/MEGA
motor.PID_current_d.I = 0;                   // 300  - Arduino UNO/MEGA
motor.PID_current_d.D = 0;
motor.PID_current_d.limit = motor.voltage_limit; 
motor.PID_current_d.output_ramp = 300;                  // 1000 - Arduino UNO/MEGA
// Low pass filtering - default 
motor.LPF_current_d.Tf= 0.01;                         // 0.01 - Arduino UNO/MEGA


  motor.foc_modulation = FOCModulationType::SpaceVectorPWM; 
  motor.modulation_centered = 1.0;


    // use monitoring with serial 
  
  Serial.begin(115200);
  //   comment out if not needed
//    motor.useMonitoring(Serial);
  
   // initialize motor
   motor.init();

   currentSense.init();
 // no need for aligning
  currentSense.skip_align = true;
  motor.linkCurrentSense(&currentSense);
//   // align encoder and start FOC
   motor.initFOC();

  command.verbose = VerboseMode::on_request;

//   // add target command T
   command.add('M', doTarget, "target angle");
  _delay(1000);
  previousMillis = millis();
}

void loop() {
  
  // main FOC algorithm function
  // Motion control function
  motor.loopFOC();
  motor.move();
  
  // function intended to be used with serial plotter to monitor motor variables
  // significantly slowing the execution down!!!!
  motor.monitor();
  

  command.run();

  // unsigned long currentMillis = millis();
  // if (currentMillis - previousMillis >= interval) {
  //   // save the last time you blinked the LED
    
  //   //  command.motor(&motor, "0.0");
  //   previousMillis = currentMillis;
    
  // }

}

Any suggestion please.

B-G431B-ESC1 is very sensitive, I think the power level you are trying to work with is too much, you need to use a smaller motor or increase your voltage/current protection for the board.

  1. Please ensure you can run the setup in open loop mode.
  2. You say your motor is 36V but inside your code you set

driver.voltage_power_supply = 20;

What voltage you supply to the ESC?

  1. Running in open-loop, assuming you really use 20V, please start with

motor.voltage_limit = 2.0;

This will ensure you are well protected and have plenty of headroom.

Also, you MUST heavily cool the ESC. This ESC is notorious for extremely poor heat dissipation design and management and requires very good air current flow and a heatsink.

  1. Once you have your open velocity running and are happy with the setup, you can slowly progress to closed loop. Skip current sense and run voltage closed loop with the encoder. Once this is OK, you can evolve to current sensing.

Generally this ESC is not suitable for SimpleFOC unless you are very experienced, take extreme precautions for cooling and take your time and have a lot of patience experimenting.

Cheers,
Valentine

PS Check this thread with my comments below

thanks for reply, i done open loop and closed loop with voltage. but i try closed loop with FOC current with default value it work but it not responsive with command, so start to tune the parameters it fails even just changing parameter a little. Yes i have voltage and current protection and also forced air cooling, it never got hot. But it still failed i think BEMF causing low side mosfet of micro controller pin get destroy, so the low side mosfet not working which causing the driver to failed.

1 Like