Custom BLDC ESC running into unfixable heating problems causing Death of MOSFETS. please help

Thread Starter

HarryCL

Joined Oct 12, 2021
10
Hey everyone this is my first time reaching out to the community for help, and I am really stuck. Basically I am trying to make my own ESC for a BLDC before anyone says the commercial solution is cheaper and easier, I'm doing it to try learn more and make a customisable version that's all my own work so lets get into the issue.

The problem is although I'm using a 20khz Pwm signal at a variable duty on the high side input generated by direct timer control on the nano, to try "chop"/control the current and keeping the lowside fully grounded, the MOSFETs I'm using (N-channel irf1405s that are 55V and 160A rated) are getting really really hot and so is the motor like over 150 degrees Celsius hot even after only running for 30 seconds. The actually motor spins just fine however I can even change the speed using a timed step change (although I do have the hardware and did have the software for BEMF step changing too I disabled it to try simplify things since the heating issue is my main priority).

I've attached my code and schematic as well as a picture of my circuit if anyone can see something on this that I can't it would be much appreciated because I'm at my wits end here ive tried adding lots of different changes to the hard and software with no luck as at the end of it all I still can't seem to stop the MOSFETs and motor from getting really hot because of what I assume is excessive current draw (possibly building up in the coils and trying to ground through the FETS body diode? maybe?) , if I increase the duty to 70%+ the MOSFETs also just straight up explode even with dead time coded in using delay functions.

I'm using a 12V 6.5Ah lead acid battery for testing as its close to the power supply I would use the ESC with normally.

if anyone with experience in power electronics or any ideas on how to fix my heating issue is reading this please help. Thank you, Harry.

my schematic:
Schematic_BLDCESCBETA_2021-10-12.png

my Code done it Arduino IDE:

int StepCounter = 1; //step counter
int RawDutyCycle = 0; //raw pot input storage variable
int Duty = 0; //duty cycle

//setup lowside pins for standalone direct port manipulation
int LowSideA = PD2; //pin D2
int LowSideB = PD5; //pin D5
int LowSideC = PD7; //pin D7

//setup highside pins to be PWM outputs at port level
int HighSideA = PD3; //OC2B D3
int HighSideB = PB1; //OC1A D9
int HighSideC = PB2; //OC1B D10

//defins all the PWM pin States neatly
#define HighSideASetON (1<<COM2A0) + (1<<COM2B1) + (1<<WGM20)
#define HighSideASetOFF (0<<COM2A0) + (0<<COM2B1) + (1<<WGM20)

#define HighSideBSetON (1<<COM1A1) + (0<<COM1B1)
#define HighSideCSetON (0<<COM1A1) + (1<<COM1B1)
#define HighSideBandCSetOFF (0<<COM1A1) + (0<<COM1B1)

void setup() {

//Sets data direction of all pins
DDRD = (1<<LowSideA) | (1<<LowSideB) | (1<<LowSideC) | (1<<HighSideA);
DDRB = (1<<HighSideB) | (1<<HighSideC);
pinMode(A0, INPUT);

//timer1 PWM pins D9 and D10 setup
TCCR1A = 0;
TCCR1B = 0;
TCCR1A = (1<<COM1A1) + (1<<COM1B1) + (1<<WGM11); //phase correct pwm
TCCR1B = (1<<WGM13) + (1<<CS11);
ICR1 = 100; //set kHz
OCR1A = 10; //set duty
OCR1B = 10; //set duty

//timer2 PWM pin D3 setup
TCCR2A = 0;
TCCR2B = 0;
TCCR2A = (1<<COM2A0) + (1<<COM2B1) + (1<<WGM20); //phase correct pwm
TCCR2B = (1<<CS21) + (1<<WGM22);
OCR2A = 100; //set kHz
OCR2B = 10; //set duty

//Sets all 3 H-bridges to float
TCCR1A = (0<<COM1A1) + (0<<COM1B1);
TCCR2A = (0<<COM2A1) + (0<<COM2B1);
PORTD = (1<<LowSideA) + (1<<LowSideB) + (1<<LowSideC);

}

void loop() {

RawDutyCycle = analogRead(A0); //read the pot
int WaitTime = map(RawDutyCycle, 0, 1023, 10000, 500);
Duty = 50;
OCR1A = Duty; //set duty
OCR1B = Duty;
OCR2B = Duty;

delayMicroseconds(WaitTime);

switch(StepCounter){

case 1: //step1
TCCR1A = HighSideBandCSetOFF;
PORTD = (1<<LowSideA) + (0<<LowSideB) + (1<<LowSideC);
TCCR2A = HighSideASetON;
StepCounter = 2;
break;

case 2: //step2
TCCR1A = HighSideBandCSetOFF;
PORTD = (1<<LowSideA) + (1<<LowSideB) + (0<<LowSideC);
TCCR2A = HighSideASetON;
StepCounter = 3;
break;

case 3: //step3
TCCR2A = HighSideASetOFF;
PORTD = (1<<LowSideA) + (1<<LowSideB) + (0<<LowSideC);
TCCR1A = HighSideBSetON;
StepCounter = 4;
break;

case 4: //step4
TCCR1A = HighSideBandCSetOFF;
PORTD = (0<<LowSideA) + (1<<LowSideB) + (1<<LowSideC);
TCCR1A = HighSideBSetON;
StepCounter = 5;
break;

case 5: //step5
TCCR1A = HighSideBandCSetOFF;
PORTD = (0<<LowSideA) + (1<<LowSideB) + (1<<LowSideC);
TCCR1A = HighSideCSetON;
StepCounter = 6;
break;

case 6: //step6
TCCR1A = HighSideBandCSetOFF;
PORTD = (1<<LowSideA) + (0<<LowSideB) + (1<<LowSideC);
TCCR1A = HighSideCSetON;
StepCounter = 1;
break;
}
}
 

Papabravo

Joined Feb 24, 2006
17,245
In this arrangement, the temperature rise in the MOSFETS has at least two probable causes:
  1. The switching signals are too slow, allowing the MOSFETS to spend a significant amount of time in the linear region. If you observe the waveforms on the gate, you should see nice sharp edges lasting less than 1% of the PWM period.
  2. The control signals to the IR2101 overlap allowing both devices to be on simultaneously, which will short the supply to ground through the MOSFET devices.
There may be other potential faults, but those are two of the big ones.
 
Last edited:

shortbus

Joined Sep 30, 2009
8,955
Where are the gate to ground resistors on the individual mosfets? Non of them are shown, without them the gates "could" be left floating. I've seen lately where some people say that the gate resistors aren't needed, but that goes against what is in the app notes and data sheet for those drivers.

Tahmid's blog is thought of as a good tutorial on how the drivers should be configured. http://tahmidmc.blogspot.com/2013/01/using-high-low-side-driver-ir2110-with.html
 

Papabravo

Joined Feb 24, 2006
17,245
Why do you say that?
...
If the driving signal source has slow edges, for whatever reason, that can be a problem. I think the processor outputs are likely to be OK as long as they are not heavily loaded. Since each output is driving a single load, they are probably OK. I'm not sure if there is anything obvious that would lead to slow switching, but a quick look would confirm or deny this possibility.
 

Thread Starter

HarryCL

Joined Oct 12, 2021
10
If the driving signal source has slow edges, for whatever reason, that can be a problem. I think the processor outputs are likely to be OK as long as they are not heavily loaded. Since each output is driving a single load, they are probably OK. I'm not sure if there is anything obvious that would lead to slow switching, but a quick look would confirm or deny this possibility.
Ok thank you il scope the arduino output pins then the gates as well as the phases and post the photos too see if your suspicions are to be confirmed my scope isnt the best but hopefully it will work well enough
 

Thread Starter

HarryCL

Joined Oct 12, 2021
10
I
Where are the gate to ground resistors on the individual mosfets? Non of them are shown, without them the gates "could" be left floating. I've seen lately where some people say that the gate resistors aren't needed, but that goes against what is in the app notes and data sheet for those drivers.

Tahmid's blog is thought of as a good tutorial on how the drivers should be configured. http://tahmidmc.blogspot.com/2013/01/using-high-low-side-driver-ir2110-with.html
tried using pull down resistance but it changed nothing:/
 

shortbus

Joined Sep 30, 2009
8,955
I

tried using pull down resistance but it changed nothing:/
You said you have a scope in post #6. use it on your mosfet gates. Another thing I noticed but didn't say is you have a diode going back to the gates to the drivers, but no resistor in that area. The resistor you have going toward the gate 10Ohm, should be the value between the diode and driver. And the feed to the gate should be higher ~50 Ohm. This is what is shown in most every gate drive/mosfet application note. Without a resistor between the diode and driver there can be ringing when the mosfet turns off, the ringing may be enough to keep that mosfet on long enough for a shoot through situation.

Another thing I just thought of, you aren't doing this on a bread board right now are you? Are you following the rules that the driver makers put out, in regard to distances between drivers and mosfets?

Before looking at the micro and code there are basic layout rules for the switching part of the circuit that need to be in place.
 

Thread Starter

HarryCL

Joined Oct 12, 2021
10
You said you have a scope in post #6. use it on your mosfet gates. Another thing I noticed but didn't say is you have a diode going back to the gates to the drivers, but no resistor in that area. The resistor you have going toward the gate 10Ohm, should be the value between the diode and driver. And the feed to the gate should be higher ~50 Ohm. This is what is shown in most every gate drive/mosfet application note. Without a resistor between the diode and driver there can be ringing when the mosfet turns off, the ringing may be enough to keep that mosfet on long enough for a shoot through situation.

Another thing I just thought of, you aren't doing this on a bread board right now are you? Are you following the rules that the driver makers put out, in regard to distances between drivers and mosfets?

Before looking at the micro and code there are basic layout rules for the switching part of the circuit that need to be in place.
Ok thanks I am doing it on a hand soldered perfboard with the drivers and FETS as close as possible too. So the circuit should look something more like this to reduce ringing because that's why I put the diode there to start with. Or would I be better just removing D10 and R3 from the following pic all together?

Screen Shot 2021-10-14 at 11.32.50 am.png
 

shortbus

Joined Sep 30, 2009
8,955
The diodes are sometimes used WITH a resistor to give a lower resistance when the driver is turning off. That was something from when the drivers were first being made, but is no longer a needed thing. Even though many online example circuits still use them. The newer versions of gate drivers now have eliminated the need for the reduced resistance, they now have a higher turn off amperage than turn on amperage rating.

So I would try losing D10 and upping R3 to something between 30 and 50 Ohms. R3 is what will stop the ringing, that plus using a resistor of ~1K Ohms from the gate to ground/common. That is to keep the gate, which is basically a capacitor from being in a "floating" state and allowing it to partially turn on causing a shoot through.
 

Thread Starter

HarryCL

Joined Oct 12, 2021
10
The diodes are sometimes used WITH a resistor to give a lower resistance when the driver is turning off. That was something from when the drivers were first being made, but is no longer a needed thing. Even though many online example circuits still use them. The newer versions of gate drivers now have eliminated the need for the reduced resistance, they now have a higher turn off amperage than turn on amperage rating.

So I would try losing D10 and upping R3 to something between 30 and 50 Ohms. R3 is what will stop the ringing, that plus using a resistor of ~1K Ohms from the gate to ground/common. That is to keep the gate, which is basically a capacitor from being in a "floating" state and allowing it to partially turn on causing a shoot through.
Alright thanks il ditch the doide and 10 ohm resistor and maybe go with a 70ish ohm one, how high is too high with this? And il also put some 2k resistance on the gate as pull downs too
 

Irving

Joined Jan 30, 2016
2,308
Your schematic is hard to follow.... You have 2 names for the same net/signal, eg HighSideOut1 on the Nano D3 but I'm guessing that goes to HighIn1 on pin 2 of IC1 - just call it HighSideA because that's what it is in the code. Also as far as possible inputs should be on the left, outputs on the right, so re-arrange your Nano and use the right 'flag'; the output flag points away from the device, the input flag into the device. Better still, don't use flags except to show off-board connections- its not necessary, the net name is all...

1634237705352.png

I tried to follow your code - I think you have a fundamental flaw in your thinking...

So I loaded it into a Nano and put a scope on D2 - LowSideA (Yellow trace) & D3 - HighSideA. (Purple trace)...

spot the deliberate mistake....

SDS00001.png

If you're PWM'ing the A phase its PWM on HighSideA, LowSideB and/or LowSideC ON. Some prefer to PWM the LowSideB/LowSideC and turn HighSideA ON. In either case LowSideA must be OFF.
 

Irving

Joined Jan 30, 2016
2,308
Amzing that simple probing by the OP would have solved this - but he/she apparently never did this ?
Or a walk-through the code drawing the state/timing diagram, which is what I started to do. But it was quicker to ferret out an old Nano from my junked parts bin and try it...

At least I'll give the OP credit for posting everything up-front rather than we spend several 100 posts going round in circles looking for a MOSFET issue.. though there are issues there too, but nothing so critical!
 

Thread Starter

HarryCL

Joined Oct 12, 2021
10
Your schematic is hard to follow.... You have 2 names for the same net/signal, eg HighSideOut1 on the Nano D3 but I'm guessing that goes to HighIn1 on pin 2 of IC1 - just call it HighSideA because that's what it is in the code. Also as far as possible inputs should be on the left, outputs on the right, so re-arrange your Nano and use the right 'flag'; the output flag points away from the device, the input flag into the device. Better still, don't use flags except to show off-board connections- its not necessary, the net name is all...

View attachment 250244

I tried to follow your code - I think you have a fundamental flaw in your thinking...

So I loaded it into a Nano and put a scope on D2 - LowSideA (Yellow trace) & D3 - HighSideA. (Purple trace)...

spot the deliberate mistake....

View attachment 250243

If you're PWM'ing the A phase its PWM on HighSideA, LowSideB and/or LowSideC ON. Some prefer to PWM the LowSideB/LowSideC and turn HighSideA ON. In either case LowSideA must be OFF.
Yeah thank you for the scope image i only have on of those red 20$ pcb scopes and im assuming yellow is the low side and purple is high. If thats the case the fact the ir2101 ics I’m using have an inverted LIN which I confirmed by testing should mean that the code is working okay. And yeah ive noticed my schematic mistake thanks.
 

Irving

Joined Jan 30, 2016
2,308
Yeah thank you for the scope image i only have on of those red 20$ pcb scopes and im assuming yellow is the low side and purple is high. If thats the case the fact the ir2101 ics I’m using have an inverted LIN which I confirmed by testing should mean that the code is working okay. And yeah ive noticed my schematic mistake thanks.
There are four devices in the IR210x family:
IR2101 has both HIN and LIN +ve logic i.e. 1 in = 1 out on both channels​
IR2102 has both /HIN and /LIN -ve logic i.e. 1 in = 0 out on both channels​
IR2103 has HIN and /LIN inputs​
IR2104 has IN and /SD inputs​

If you're saying your device has HIN and /LIN inputs, then its not an IR2101 but an IR2103. In which case, on the face of it that should work, assuming all devices are 2103 and assuming all other outputs are OK. Please fix the schematic.

I've scoped all the other outputs and they seem OK... ALow (Y), BLow (P), CLow (B), Then AHigh, BHigh, CHigh (each G). I'm not quite convinced the timing is quite right, but at least there should be no shoot throughs...
1634305936788.png1634305892620.png1634305843458.png
 
Top