STM32F103RCT6 BLDC motor controller burning IR2101 chip

Hi,

I am a little new to BLDC motors and I was experimenting using it in a project. I took the BLDC motor, from an old hoverboard (I am 100% sure the motor works). I had a friend help me design a controller PCB (schematic attached below) and I plug a 42V battery and the board steps it down to 15V for the motor. I run the open loop velocity control example;

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


// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(15);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver6PWM driver = BLDCDriver6PWM( PB6,PB7, PB0, PB1, PB8, PB9);

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


//target variable
float target_velocity = 5;

// 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() {

  // use monitoring with serial 
  Serial.begin(115200);
  // enable more verbose output for debugging
  // comment out if not needed
  SimpleFOCDebug::enable(&Serial);

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 15;
  // 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 = 15;
  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 = 12;   // [V]
 
  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;

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

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

  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);

  // user communication
  command.run();
}

The IR2101 chip started buzzing and the motor made periodic small clicks before the one of the IR2101 chips burnt. Is there a hardware issue or am I running the wrong code here?

If you’re using a 42V battery, driver.voltage_power_supply should be 42.

Usually hoverboard motors are around 0.3 ohms, so start with lower motor.voltage_limit until you get it running well. Even 12v/0.3 ohms=40 amps is quite a bit. And with the voltage_power_supply set wrong, you’re actually running 112 amps.

Your hardware design is messed up. I reviewed the schematics. I’m really busy and cannot help but please get professional help before you hurt yourself or others. If I get time I can give some pointers later. Do not use your PCB, you will get hurt. Fire your hardware designer.

Cheers,
Valentine

PS And yeah, reviewing your code, please follow @dekutree64 pointers too. It will also help if you post the PCB hi-rez pictures, PCB layout and motor. Also hi-rez of the schematics (PDF preferred).

Hi @Jane , welcome to SimpleFOC!

On the software side, what Deku has suggested is very important! Set the voltages correctly, and start with a low voltage limit, perhaps 1V, and raise it in small steps until you get some movement.

In open loop mode, also start with a slow target speed like 0.5 rad/s - the motor may not start up if you command a high speed directly.

On the hardware side, first test things out with the motor and the 42V disconnected. Get serial output working and please share the debug output from the SimpleFOC initialization. Before trying to run a motor you should make sure everything is initializing well.

Your gate resistances seem a little high - did you calculate them or determine the values empirically? If the gates switch too slowly this can be an issue and cause shoot through if the dead-time isn’t set high enough.