Author Topic: mosfet and PWM  (Read 5377 times)

0 Members and 2 Guests are viewing this topic.

Offline Oy1rTopic starter

  • Contributor
  • Posts: 18
  • Country: fo
mosfet and PWM
« on: July 19, 2021, 09:14:03 am »
I heard somewhere that driving logic level mosfets with PWM can become problematic because of frequency, why would this be and what is the max freq ?

Thanks
OY1R
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8110
  • Country: fi
Re: mosfet and PWM
« Reply #1 on: July 19, 2021, 02:16:52 pm »
Google MOSFET gate capacitance.

It's just that driving a large MOSFET directly from the microcontroller pin is slow, so the MOSFET spends some time in the partially conducting state, acting like a resistor, dissipating a lot of heat if there is load current flowing through it.

Why it is slow? Because the microcontroller IO pin is like a 30 ohm (approximately) resistor. Charging the MOSFETs gate capacitance through it takes time.

Gate driver IC can do that faster by having less resistance.

Whether this is a problem or not, depends. Sometimes it's even desirable. Total efficiency depends on how often you switch. For example, if turning MOSFET on or off takes 10 µs and your PWM period is 1 ms, you are spending 2% of the time in that highly wasteful state (work out why by yourself).

In any case, driving any but the smallest MOSFETs, I recommend adding an explicit series resistor like 33 to 47 ohms. It makes it even slower, but protects the IO pin from excessive current.

Smallish power MOSFETs like something rated at 30V 5A are usually fine with no extra considerations.
« Last Edit: July 19, 2021, 02:18:50 pm by Siwastaja »
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1924
  • Country: us
Re: mosfet and PWM
« Reply #2 on: July 19, 2021, 03:54:06 pm »
To provide a bit more info....

When you're driving the gate of a MOSFET, you're driving a capacitor. Literally charging and discharging a capacitor. Like a discrete capacitor, the initial currents can be significant - sometimes amps of current can peak even for "smallish" MOSFET's. Meanwhile, most microcontroller I/O pins are rated for single digit milliamps and even the "strong" ones usually have an absolute max rating of 25-30mA. Repeatedly subjecting those pins to overcurrents of 10-100X their absolute max ratings can blow the driver stage, either instantly or through slow degradation.

That's the reason Siwastaja recommended a resistor in series with the gate: To limit this "inrush" current during capacitive charge and discharge. But the downside of doing that is, as he said, that you slow down the transition of the MOSFET from "full-on" to "full-off" and vice versa. This allows the MOSFET to spend too much time in its "linear" range where it's dissipating too much heat, likely damaging or destroying the MOSFET instead of the I/O pin.

And choosing the value of the gate resistor isn't an easy formula, either. For example, the MOSFET itself has some gate resistance (check the spec sheet) which is typically in the single or double digit ohms. Personally I always use a high end current probe on my breadboards to understand exactly what is happening at the gate, and tune the driver stage and gate resistor using the scope display (with a bit of derating to allow for production variation).

I only directly drive MOSFET gates from I/O pins when I'm dealing with very small devices and currents. Beyond those I generally go to a dedicated gate driver chip; it's basically impossible to reproduce their functionality for anything close to their cost (well under 50 cents/1000's) and then you get near-symmetrical charge and discharge currents of several amps which keeps the MOSFET out of the dangerous linear region. MOSFET switching times of under 50nS are easy to achieve with a cheap gate driver and you'll sleep well at night knowing that you're running neither the I/O pins nor the MOSFET's out of spec.

Hope this helps!
 
The following users thanked this post: tooki

Online MathWizard

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: ca
Re: mosfet and PWM
« Reply #3 on: July 19, 2021, 09:32:37 pm »
Interestingly, many 750W computer PSU's use a resistor divider of 30R and 10k, on the gate's of the mosfets in the PFC section, and the main inductor. They operate around 50-100kHz, from 12V or so tho, from a controller IC.
 
The following users thanked this post: Kerlin

Offline Kerlin

  • Regular Contributor
  • *
  • Posts: 181
  • Country: au
Re: mosfet and PWM
« Reply #4 on: July 19, 2021, 10:11:52 pm »
Yes you are correct the resistor in the gate of FETs in switching supplies is there to speed up the switching time.
I was thinking about making this comment but decided, hey its a forum just leave them with it, they abound with misinformation.
Do you know what the thread is about and are Comprehending what has been said ?
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5835
  • Country: es
Re: mosfet and PWM
« Reply #5 on: July 19, 2021, 11:42:59 pm »
It'snot to driveit faster but to prevent oscillations and resonances (ringing) from driving the gate too hard.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Oy1rTopic starter

  • Contributor
  • Posts: 18
  • Country: fo
Re: mosfet and PWM
« Reply #6 on: July 19, 2021, 11:52:00 pm »
I thought/read that mosfet's are voltage driven!
my plan is to pwm controll mosfet's in parallel to drive my dinghy trolling motor, it's rated at 400w max.



 
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1924
  • Country: us
Re: mosfet and PWM
« Reply #7 on: July 20, 2021, 02:49:53 am »
I thought/read that mosfet's are voltage driven!
Strictly speaking they are, but to get that electric field (to either enhance or deplete the channel) you must charge or discharge the gate capacitance. Changing the charge on something means current flow. Once the charge is there, the current flow drops to zero (theoretically... of course there's always some leakage in real world devices). But to change it, current must flow. And since you generally want to keep MOSFET's out of their linear region, you want to change the electric field (read: change the charge) as fast as possible, which means higher current.
 

Offline Oy1rTopic starter

  • Contributor
  • Posts: 18
  • Country: fo
Re: mosfet and PWM
« Reply #8 on: July 20, 2021, 09:33:14 am »
Alright, i was thinking that too. Current flow while charging the gate. i just thought it was
But it makes sense, faster switching more current flow to charge the gate.
So how should i go about driving 4 or 6 power MOSFET's in parallel from an arduino ?

Reg                                                                                                                                                                                                                                                                                                                                                                                   
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14309
  • Country: fr
Re: mosfet and PWM
« Reply #9 on: July 20, 2021, 04:46:52 pm »
As explained above, it's all about a compromise. Of course the higher the PWM frequency, and the more significant, on average, switching time (due to gate capacitance mainly) will be. For low freq PWM and/or low gate capacitance MOSFETs, you may directly drive them with a GPIO. As explained above, sometimes recommended to use a series resistor to minimize ringing (but it will also increase switching time.)

OTOH, when switching time matters, you'll need a gate driver.

To answer your last question, can you give us the reference of the power MOSFETs you are thinking of using, and the PWM frequency?
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8110
  • Country: fi
Re: mosfet and PWM
« Reply #10 on: July 20, 2021, 05:45:20 pm »
Parallel MOSFETs in switching applications act pretty much like one bigger MOSFET (except that current sharing during transition can be briefly poor, but that's usually a small percentage of total time), but of course if you have 4 to 6 that means they would need to be rather small already so that the IO pin could drive them directly. This means you likely need a gate driver.

Why are you paralleling such number of MOSFETs? What are you actually building?
« Last Edit: July 20, 2021, 05:46:51 pm by Siwastaja »
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8110
  • Country: fi
Re: mosfet and PWM
« Reply #11 on: July 20, 2021, 05:51:07 pm »
OTOH, when switching time matters, you'll need a gate driver.

Not necessarily, though; there are cases where the power MOSFET is like some modern 30V, 10A device and these can have surprisingly low Qg(tot) and already be fully on at Vgs=3.5V. Even with a "proper" gate driver IC, you'd often drive them from a 6V supply and 47ohm explicit series resistor, and the datasheet characterization may be provided with Vgs=4.5 and Rg=47ohms. In such case, a 5V AVR IO pin with 22R explicit Rg provides basically the same switching time so this isn't a compromise. This way you can build quite powerful converters, say a 20V 5A boost, without a gate driver and without compromising efficiency, but any larger than that and gate driver starts becoming mandatory pretty soon.
« Last Edit: July 20, 2021, 05:53:30 pm by Siwastaja »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14309
  • Country: fr
Re: mosfet and PWM
« Reply #12 on: July 20, 2021, 06:12:36 pm »
OTOH, when switching time matters, you'll need a gate driver.

Not necessarily, though; there are cases where the power MOSFET is like some modern 30V, 10A device and these can have surprisingly low Qg(tot) and already be fully on at Vgs=3.5V. Even with a "proper" gate driver IC, you'd often drive them from a 6V supply and 47ohm explicit series resistor, and the datasheet characterization may be provided with Vgs=4.5 and Rg=47ohms. In such case, a 5V AVR IO pin with 22R explicit Rg provides basically the same switching time so this isn't a compromise. This way you can build quite powerful converters, say a 20V 5A boost, without a gate driver and without compromising efficiency, but any larger than that and gate driver starts becoming mandatory pretty soon.

So that's a case for which switching time won't matter. You're saying the same thing as I did.

Switching time itself again "matters" only if it's significant relative to the PWM period. It's only a relative issue.
(To an extent, of course: if switching time is unreasonably long, then the transistor may blow up due to overheating. In any case you'll have to estimate power dissipation while switching, and see how much it affects efficiency, and by how much the die temperature will rise.)
 

Offline Oy1rTopic starter

  • Contributor
  • Posts: 18
  • Country: fo
Re: mosfet and PWM
« Reply #13 on: July 20, 2021, 07:49:05 pm »
I thought i would make my 400w 12v trolling motor PWM controlled. I had one from china died, and i thought i would give it a try witha few n channel mosfets, preferably logic levlel and an arduino.

Reg
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3168
  • Country: au
Re: mosfet and PWM
« Reply #14 on: July 21, 2021, 06:08:52 am »
I drove a similar size 24VDC motor with a mosfet driven from a micro I/O with a 100 ohm in series with the gate. Switching frequency was only ~4kHz so very little demands on fast switching transition speed. 4kHz was plenty fast enough for that motor. Several of them have been in service for almost 10 years so it was reliable too.
 
The following users thanked this post: Oy1r

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5835
  • Country: es
Re: mosfet and PWM
« Reply #15 on: July 21, 2021, 07:26:52 am »
It all depends on the gate capacitance and the driver strength. It's basically a RC filter.
If the driver is powerful, it will be able to supply the high current spikes needed to quickly charge and discharge the gate.
If it's weak and the frequency high enough, the gate can float, which anything but good.

Read:
https://www.eevblog.com/forum/microcontrollers/fan-controller-with-pwm-using-stm32-chip/msg3566902/#msg3566902
« Last Edit: July 21, 2021, 07:30:56 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Oy1rTopic starter

  • Contributor
  • Posts: 18
  • Country: fo
Re: mosfet and PWM
« Reply #16 on: July 21, 2021, 08:02:04 am »
This sounds good. i read that the arduino PWM frequency by default is approx 500hz and 1khz  and can be set as high as 4MHz.
 
Anyone know what frequencies freshwater trout are scared or attracted by ? ;)

Reg
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8110
  • Country: fi
Re: mosfet and PWM
« Reply #17 on: July 21, 2021, 09:28:45 am »
So that's a case for which switching time won't matter. You're saying the same thing as I did.

No, it's a case where it does matter but the IO pin can drive it at the same quick rate as a dedicated driver would, given small enough MOSFET. I'm saying this specifically because sometimes people think as a "rule of thumb" that IO pins are slow and dedicated gate drivers fast, but this only applies to driving large capacitive loads, obviously.
« Last Edit: July 21, 2021, 09:36:32 am by Siwastaja »
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8110
  • Country: fi
Re: mosfet and PWM
« Reply #18 on: July 21, 2021, 09:35:23 am »
Oh, you are building a brushed DC motor controller. It requires these basic parts:
* Two switches, one of which is a MOSFET and another can be a diode in this case,
* DC bus capacitance
* Somewhat well though out layout (i.e., the two previous bullet points forming a minimally small loop)
* Gate driver (possibly optional for small controller)
* Current sense circuit, typically consisting of a low-side shunt resistor and an amplifier IC

400W 12V motor controller is already something you won't do without a gate driver. Roughly, if 400W is nominal motor power at 12V, nominal current then is 33A. If you want any more than nominal torque, i.e., for example for startup, design for, say, 60A. Choose MOSFET based on thermal calculations, but to get you in the ballpark, this is a part nominally rated at some Id=100-150A, so I can already see why you are going to parallel multiple parts, it's a good idea.

If you don't want to blow up this one as well, you need a current sense circuit, and you can't afford losing some 1V (which would be tens of watts!) on low-side sense resistor, so you need a sense amplifier as well, so you are in the territory of adding external parts so why not add a gate driver as well.

For controlling a motor, anything in range of 2kHz - 30kHz is usually a good choice. Some 10kHz is often quite optimal compromise between ripple current amplitude and efficiency, but the audible whine might be an issue.

What I have personally done a few times, is put the sense resistor between the ground and the MOSFET Source. Amplify it with a current shunt amplifier IC, then bring it to the AVR's Analog Comparator pin. This way, you get software interrupt at the very instant the motor current exceeds the comparison level you set, allowing you to terminate the PWM cycle early and wait for the next cycle, giving you a peak current (torque) controller.
« Last Edit: July 21, 2021, 09:43:37 am by Siwastaja »
 
The following users thanked this post: Pineapple Dan

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3168
  • Country: au
Re: mosfet and PWM
« Reply #19 on: July 21, 2021, 12:00:03 pm »
If you don't want to blow up this one as well, you need a current sense circuit, and you can't afford losing some 1V (which would be tens of watts!) on low-side sense resistor,
I once saw a prototype circuit where the designer put a current transformer in the source lead of a mosfet. The inductance of the CT primary caused awful switching problems! I'm always wary of putting extra bits in line with the mosfet source. Keep it short and direct! SMD current sense resistors are your friend here.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8110
  • Country: fi
Re: mosfet and PWM
« Reply #20 on: July 21, 2021, 03:20:09 pm »
If you don't want to blow up this one as well, you need a current sense circuit, and you can't afford losing some 1V (which would be tens of watts!) on low-side sense resistor,
I once saw a prototype circuit where the designer put a current transformer in the source lead of a mosfet. The inductance of the CT primary caused awful switching problems! I'm always wary of putting extra bits in line with the mosfet source. Keep it short and direct! SMD current sense resistors are your friend here.

Yes, a small footprint SMD current sense resistor is best. It can be physically small, because it can be designed with small resistance, small burden voltage, and hence small power dissipation also minimizing the efficiency penalty, because high accuracy measurement is not required.

You easily get say 5-10% accuracy with a tiny 1210 (or not so tiny but still more than acceptable 2512) part with Kelvin sensing layout below it which is more than enough for protective current limiting and torque feedback loop.

But an amplifier IC is needed, just no way around it in a 400W 12V converter. Some higher voltage, lower current converter, say 48V and a few amps, could work with the shunt directly wired to the analog comparator (IC or MCU-integrated).

In any case, the OP should come forward if some of this goes over their head and ask for clarifications. Designing a DC motor controller is not impossible, but not completely trivial either; we are here to help with any specific question.
« Last Edit: July 21, 2021, 03:27:08 pm by Siwastaja »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14309
  • Country: fr
Re: mosfet and PWM
« Reply #21 on: July 21, 2021, 03:35:21 pm »
So that's a case for which switching time won't matter. You're saying the same thing as I did.

No, it's a case where it does matter but the IO pin can drive it at the same quick rate as a dedicated driver would, given small enough MOSFET.

OK, I think you just got hung up on the "doesn't matter" term I used, even though I thought it was pretty clear what I meant all along if you read all I wrote in this thread.

So to be clear, "switching time won't matter" meant that it would be short enough to fit the efficiency and thermal requirements in a given application. It absolutely didn't mean that you should not consider it. Just means that after estimating it, you conclude that it fits your requirements.

A corollary point is that there's no need to look for the shortest switching time possible. Just short enough to fit your requirements (again, essentially efficiency and thermal) in a given application.

I'm saying this specifically because sometimes people think as a "rule of thumb" that IO pins are slow and dedicated gate drivers fast, but this only applies to driving large capacitive loads, obviously.

Which effectively relates to the points I made in this thread. There is no magic voodoo here. You just need to estimate the switching time using the MOSFET characteristics (gate charge, VGS(th)...) and the approximate output impedance of your driving signal. This is just what it's all about. You'll just have to pick whatever solution (including a separate gate driver or not, and which one) gets you there.

People using rules of thumb without understanding what they are doing are obviously very likely to get suboptimal solutions. There are thousands (probably millions) of different MOSFETs out there, and thousands of ICs with very different IO characteristics. And, as I also said, the application! Again, even if you have a largish MOSFET (thus high gate charge), you can sometimes drive it directly from even a modest IO if the switching time you get is no problem in a particular application. If you switch every minute, and you have a pretty long switching time of 100 ms, then who cares. Efficiency wouldn't be harmed significantly, and the MOSFET would have ample time to cool down between each switching event.

It's impossible to devise a general rule of thumb about this all.
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1924
  • Country: us
Re: mosfet and PWM
« Reply #22 on: July 21, 2021, 06:02:45 pm »
It's impossible to devise a general rule of thumb about this all.
I'll venture one: As a general rule you should use T&M equipment on MOSFET gates to confirm what's actually going on, and adjust component choices and values accordingly. {grin}

I thought I understood what was happening on the gates of (at least) small scale MOSFET's until I put an actual current probe on the gate together with a voltage probe and watched its voltage and current on a scope. Theory is nice, but you don't really know the results of the interaction between the total gate charge and the part's internal gate resistance and the driver's output impedance and a bunch of other factors until you actually measure it. For me, it was a "What the... OHHH, now I understand what all those MOSFET appnotes were trying to tell me" moment. Maybe I'm just dumber than most people....
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8110
  • Country: fi
Re: mosfet and PWM
« Reply #23 on: July 21, 2021, 06:52:37 pm »
Yes, I agree that measuring what's actually happening during switching, then fine tuning parts, is effective. Probing for gate current may be interesting but even more acutely, look at gate voltage, switch node voltage and switched current; plot on the same timescale. And indeed, the actual gate charge circuit has three resistors in series; driver output R, your explicit Rg, and the MOSFETs parasitic Rg.

Very simplistic calculations like Q = I*t or tau = RC, or triangle approximation of power loss, get you in the right ballpark easily, say within 30-50% and you can do that in Excel while choosing the components, a huge plus compared to complex modeling. Or, you can spend half of your life trying to model the thing until cows come home, or just measure, compare the measurement results to the simple model, and adjust component values until satisfied.

One important aspects regarding gate charging is the available voltage. If you need, say, 4.5V in order to reliably and fully turn the MOSFET on over the whole temperature range, then driving from 5V gives highly variable results because charging a capacitor is an asymptotic process which takes infinite time to completely finish. The last volt takes a long time, so even minor variations in conditions cause large differences. This is actually often the reason why you need to use a "proper" gate driver IC, even if you ended up using Rg value similar to the logic pin resistance, and even if the part is nominally "logic level".

Transition into more powerful ARM microcontrollers also has the side effect that 5V microcontrollers are becoming rare, further necessitating the use of external gate drivers for anything but smallest 20-30V maybe <5A MOSFETs.
« Last Edit: July 21, 2021, 06:54:34 pm by Siwastaja »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14309
  • Country: fr
Re: mosfet and PWM
« Reply #24 on: July 21, 2021, 07:46:21 pm »
It's impossible to devise a general rule of thumb about this all.
I'll venture one: As a general rule you should use T&M equipment on MOSFET gates to confirm what's actually going on, and adjust component choices and values accordingly. {grin}

I thought I understood what was happening on the gates of (at least) small scale MOSFET's until I put an actual current probe on the gate together with a voltage probe and watched its voltage and current on a scope. Theory is nice, but you don't really know the results of the interaction between the total gate charge and the part's internal gate resistance and the driver's output impedance and a bunch of other factors until you actually measure it. For me, it was a "What the... OHHH, now I understand what all those MOSFET appnotes were trying to tell me" moment. Maybe I'm just dumber than most people....

Ah, you're right. This is also why I carefully used the term "estimate". First step when designing is to estimate your switching time from parts datasheets and expected conditions, but it doesn't replace proper measurements after that.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf