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?

4 Answers

4

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.

Issues I found: wrong gate resistance, wrong boost diodes, and wrong driver/mosfet combo. May be more but I don't have time now. @runger, if you are willing to help, you may check those. And without real schematics and layout can't tell what else gone wrong.

Is a boost diode different from a bootstrap diode? I don't see any bootstrap diodes at all. The driver datasheet does show that it needs them, but doesn't say exactly what kind to use. Regarding the gate resistance, I would guess that it's calculated. The driver's high side current limit is 130mA min, 210mA typical, so 15v/100 ohms=150mA seems reasonable. But yes, I think it will need at least 3% dead time at 25KHz.

The schematics is poorly organized. Bootstraps are apparently upper right under the bulk caps, connected directly to the motor phases (???). You got 15V injected directly into the phases [;0] .Also this driver is really small for the large mosfet gate charge, hence the high gate resistors and the slow charge/discharge then mosfets probably shorting over the dead time cross-over. Then who knows how the layout is done. And there is no BOM, hard to tell, so if they picked wrong capacitors they probably shorted everything. I doubt they used 100V ceramic bootstrap caps, they are a little expensive.

This is a open source BLDC motor driver project that works well. It can be adjusted for STM32 pretty easily if needed. You can redesign it based on there