Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MOSFET guide #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions MOSFETs/Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Often, the datasheet will specify a "maximum continuous drain current". When thi
However, many datasheets (particularly for larger MOSFETs, with a thermal pad for heatsinking) will instead spec the maximum continuous drain current at "Tc=25C". Invariably, these numbers make the product look REALLY good, and hence this is almost universally the "headline" specification for MOSFETs. *It is also almsot entirely useless* for sizing: T<sub>c</sub> is "case temperature", that is, those values apply to the situation where the "case temperature" (that is, the temperature of the outside of the package) is held constant at the temperature specified *regardless of how much heat it is generating*. (an unphysical assumption - you would need magic heatsinks that can dissipate infinite heat with no increase in temperature). At that current, the internal thermal conductivity is no longer able to keep up with the heat generated by the overloaded die and the part will burn out. Put another way, it is the theoretical upper bound on current which is never seen in practice except for during the moments up to a catastrophic failure. But it generates a nice big number for the manufacturer that marketing can put front and center. While it is not a realistic representation of maximum current capacity, its ubiquity makes it useful as a starting point for comparing the *relative* current handling of several prospective MOSFETs. Just don't expect to get that kind of current to go through it and have a working FET afterwards.

## PWM
*In the following discussion, it will be assumed that we are working with an N-channel MOSFET, as that is a far more common use case, but the same principles apply to P-channel FETs as well, as discussed elsewhere in this document and across the internet, they are the exact opposuite of an N-channel FET, but this usually makes them more awkward to use - and the underlying physics is less favorable, so they are also either more expensive or have poorer specs than N-channel ones. So you should of course try to stick to N-channel FETs when possible, but when impossible, remember that everything here applies to P-channel ones as well*
*In the following discussion, it will be assumed that we are working with an N-channel MOSFET, as that is a far more common use case, but the same principles apply to P-channel FETs as well, as discussed elsewhere in this document and across the internet, they are the exact opposite of an N-channel FET, but this usually makes them more awkward to use - and the underlying physics is less favorable, so they are also either more expensive or have poorer specs than N-channel ones. So you should of course try to stick to N-channel FETs when possible, but when impossible, remember that everything here applies to P-channel ones as well*

One great thing about MOSFETs is that, unlike relays or manual switches, they can use PWM to vary the brightness of a light, or the speed of a motor, or the output voltage of a DC-DC converter - because they switch fast, with essentially no limit to the number of times the fet can switch. However, if PWM is being used, particularly as the frequency is raised, MOSFET sizing becomes more complicated, because you can no longer limit your analysis to the steady state of the FET being either ON or OFF. You need to account for the time it spends *between those states*.

Expand All @@ -97,7 +97,7 @@ How do you figure out whether the PWM frequency that you want is "too high"?
### TLDR
If you're using Arduino analogWrite or similar, which gives you 500 Hz (8 MHz system clock) to 1.2 kHz (20 MHz system clock), you generally don't have to worry about this, whether by design or coincidence. Pretty much anything above that (certainly if you hope to run at 20 kHz to eliminate audible buzzing when controlling motors - or even a few kHz), you will need to use MOSFET drivers to get faster PWM from "power MOSFETs", those capable of handling current of amps to tens of amps. That includes all of our 4-channel boards except those based on the smaller AOD476; those boards can be used up to around 8 kHz, though they are also capable of handling far less current (we may add additional MOSFET options for this purpose in the future).

The lower the current they can carry, the smaller the gate capacitance - so for small, lower current MOSFETs (like some of the SOT-23 MOSFETs we sell on convenient breakout boards), high frequency PWM is possible without a gate driver... but just because a MOSFET is in a SOT-23 package doesn't necessarily mean that it has a super low gate capacitance - some of those SOT23 FETs have specs are rated for >6-9A I<sub>d @ Ta=25c<\sub> with a small number of milliohms of resistance in the on state. Many (but not all) of these also have a surprisingly high gate capacitance
The lower the current they can carry, the smaller the gate capacitance - so for small, lower current MOSFETs (like some of the SOT-23 MOSFETs we sell on convenient breakout boards), high frequency PWM is possible without a gate driver... but just because a MOSFET is in a SOT-23 package doesn't necessarily mean that it has a super low gate capacitance. Some of those SOT-23 FETs are rated for >6-9A I<sub>d</sub> @ T<sub>a</sub>=25c with a small number of milliohms of resistance in the on state: many (but not all) of these also have a surprisingly high gate capacitance.

### Wiring
Starting from the above basic wiring diagram, if we instead used one of the Azduino 4-channel boards with drivers, it would look nearly the same, except that a 5-20V supply (5-10 recommended, must not be higher than MOSFET's V<sub>gs(max)</sub>). In real designs, it is likely that at least one of the power sources would be derived from another; below, for example, we might use the 12v from the load power supply to power the gate driver, provided we were using FETs that were rated for >12 Vgs.
Expand All @@ -110,9 +110,9 @@ Every MOSFET datasheet has a graph like this:

![Gate Charge](GateCharge.png)

**In Words** As charge flows into the gate (through the impedance of whatever is driving it and any series resistors - R<sub>g</sub> is often used for this), the gate voltage initially rises like the voltage on a capacitor - this is the gate-to-source charge Q<sub>gs</sub> (sometimes conveniently given as capacitance, C<sub>gs</sub>). at the threshold V<sub>gs(th)</sub>, current begins to flow from drain to source. This causes the drain voltage to begin falling towards the source voltage. As this is happening, charge continues flowing into the gate - but the gate *voltage stops increasing* - this is is due to gate-to-drain ("Miller") charge, ie, parasitic capacitance between the gate and the draqin - as V<sub>ds</sub> drops, the incoming charge must overcome the capacitance between the gate and the (rapidly falling) drain voltage. Once the drain voltage is close to the source voltage and has no further to fall, V<sub>gs</sub> once more rises linearly with the charge on the gate. . Note that while the graphs like this found in datasheets are a simplification (the transitions are not instantaneous in reality), that basic shape can be seen on an oscilloscope. These three phases are also amenable to (relatively) straightforward modeling: the first and third regimes can be approximated as an RC-circuit, while within the second one, the "Miller plateau", the current in is approximately constant and can be calculated from Ohm's law and Q<sub>gd</sub>, and from that, you calculate the critical parameter of how long the MOSFET will stay on the Miller plateau.
**In Words** As charge flows into the gate (through the impedance of whatever is driving it and any series resistors - R<sub>g</sub> is often used for this), the gate voltage initially rises like the voltage on a capacitor - this is the gate-to-source charge Q<sub>gs</sub> (sometimes conveniently given as capacitance, C<sub>gs</sub>). at the threshold V<sub>gs(th)</sub>, current begins to flow from drain to source. This causes the drain voltage to begin falling towards the source voltage. As this is happening, charge continues flowing into the gate - but the gate *voltage stops increasing* - this is is due to gate-to-drain ("Miller") charge, ie, parasitic capacitance between the gate and the drain - as V<sub>ds</sub> drops, the incoming charge must overcome the capacitance between the gate and the (rapidly falling) drain voltage. Once the drain voltage is close to the source voltage and has no further to fall, V<sub>gs</sub> once more rises linearly with the charge on the gate. . Note that while the graphs like this found in datasheets are a simplification (the transitions are not instantaneous in reality), that basic shape can be seen on an oscilloscope. These three phases are also amenable to (relatively) straightforward modeling: the first and third regimes can be approximated as an RC-circuit, while within the second one, the "Miller plateau", the current in is approximately constant and can be calculated from Ohm's law and Q<sub>gd</sub>, and from that, you calculate the critical parameter of how long the MOSFET will stay on the Miller plateau.

This is important because it is that second regime that is that is most important when considering switching losses; this is when V<sub>ds</sub> falls from the full off-state voltage to just above zero, and Id rises from nearly nothing all the way to almost the full load current. Recall that power dissipation is the product of V<sub>ds</sub> and I<sub>d</sub> (`P = V x I`); before the Miller plateau, I<sub>d</sub> is nearly zero, while after it, V<sub>ds</sub> is nearly zero - but within it, \both are far from zero - so P<sub>d</sub> is at a maximum.
This is important because it is that second regime that is that is most important when considering switching losses; this is when V<sub>ds</sub> falls from the full off-state voltage to just above zero, and Id rises from nearly nothing all the way to almost the full load current. Recall that power dissipation is the product of V<sub>ds</sub> and I<sub>d</sub> (`P = V x I`); before the Miller plateau, I<sub>d</sub> is nearly zero, while after it, V<sub>ds</sub> is nearly zero - but within it, both are far from zero - so P<sub>d</sub> is at a maximum.

The attached spreadsheet provides these calculations for all of the MOSFETs used in our current-production 4-channel MOSFET boards, and can be modified to provide these calculations for other MOSFETs or system conditions: cells highlighted in pink are MOSFET specs, those in yellow specify the system conditions. A very pessimistic assumption is made for the relationship between I<sub>d</sub> and V<sub>ds</sub>, because skimping on the transistor, and then having it burn out is no fun. Better to play it safe on the transistor sizing, right? So we assume that I<sub>d</sub> immediately reaches a maximum when we reach the Miller plateau. On the other hand, there is some amount of additional switching loss due to the time in the third regime (when the full current is flowing, but R<sub>ds</sub> has not reached its final value), and in the first regime, between V<sub>gs(th)</sub>, when current begins to flow, and the start of the plateau. It includes calculations for both the rising and falling edges - because the plateau is not halfway between the controller voltage and ground, the two edges are not symmetric.

Expand All @@ -125,9 +125,9 @@ Regardless of the application, a key takeaway from this is that, if using PWM, y
# MOSFET Gate Drivers
A MOSFET "gate driver" does exactly what it sounds like it does - it is a specialized IC designed specifically for driving the gate of a MOSFET, capable of delivering a very brief pulse of current on the scale of **amps** to the gate of a MOSFET. This turns the MOSFET on or off almost instantly. PWM frequencies in the tens of kHz and beyond are within reach! In addition to that, they act as a "level shifter" - the NCP81071B we use on our [high performance MOSFETs with optional drivers](https://www.tindie.com/products/6503/) can apply up to 20V to the gate of a MOSFET, in a pulse with peak current of 5 amps, in response to a 2.5V logic level signal. With a MOSFET driver in use, you no longer need to worry about switching losses until the switching frequency gets *way* up there - the NCP81071 (there are pin compatible devices with similar specs from other manufacturers. Due to recent supply shortages, we have been forced to use gate drivers from whoever has a pin-compatible gate drive IC available at the time; Currently we have IX4340's, which are pin-compatible with the NCP81081, and in some ways superior) datasheet provides specifications for switching frequencies as high as 2 MHz!

Be careful to get the right kind of gate driver - there are also gate drivers that are drive the gate of an *N-channel* capacitor beingused to switch the high side of the power to something! These use a trick to generate the higher voltage they need for the gate called a bootstrap capactitor. This is a capacitor that uses the dramatic swing in voltage on the line being switched as the switch is turned on and off to keep a capacitor that it uses to store the higher voltage that it uses to drive the mosfet's gate. These find widespread application in DC-DC converter design, but are much less useful for hobby electronics, where it's usually easier and more cost effective to just buy DC-DC converters from aliexpress. Further discussion of them is beyond the scope of this guide; suffice to say that if you determine you need a gate driver for otherwise mundane hobby use-cases, and then accordingly go looking for one, skip any gate driver where you see a "flying capacitor" or "bootstrap" capacitor" mentioned in the datasheet - unless you're building your owwn DC-DC converter from scratch (don't do that, there are nice, cheap ones available) .
Be careful to get the right kind of gate driver - there are also gate drivers that drive the gate of an *N-channel* capacitor being used to switch the high side of the power to something! These use a trick called a bootstrap capacitor to generate the higher voltage they need for the gate. This capacitor uses the dramatic swing in voltage on the line being switched to store the higher voltage that it uses to drive the MOSFET's gate. These find widespread application in DC-DC converter design, but are much less useful for hobby electronics, where it's usually easier and more cost effective to just buy DC-DC converters from aliexpress. Further discussion of them is beyond the scope of this guide; suffice to say that if you determine you need a gate driver for otherwise mundane hobby use-cases, and then accordingly go looking for one, skip any gate driver where you see a "flying capacitor" or "bootstrap" capacitor" mentioned in the datasheet - unless you're building your own DC-DC converter from scratch (don't do that, there are nice, cheap ones available).

A gate driver is only of benefit when you need either faster switching time to support high frequency PWM, or if you have a low voltage microcontroller, yet need to switch a voltage higher than 30V. 30C is not a limit set in stone - particularly at low currents, you can oftenm do better. But power MOSFETs rated for higher V<sub>ds</sub> generally require at least V<sub>gs</sub> of 5V. Gate drivers will detect much lower input voltagesm, and typically need a power supply at +5-+20V - it is this higher voltage that is applied to the gates.
A gate driver is only of benefit when you need either faster switching time to support high frequency PWM, or if you have a low voltage microcontroller, yet need to switch a voltage higher than 30V. 30V is not a limit set in stone - particularly at low currents, you can often do better. But power MOSFETs rated for higher V<sub>ds</sub> generally require at least V<sub>gs</sub> of 5V. Gate drivers will detect much lower input voltages, and typically need a power supply at +5-+20V - it is this higher voltage that is applied to the gates.

# MOSFETs versus BJTs (e.g. TIP-series, Darlington, NPN/PNP, etc.)
MOSFETs are used for many of the same things that BJT's (bipolar junction transistors) were used for in the past; for power switching applications, MOSFET technology left BJTs in the dust decades ago. While there are still appropriate uses for BJTs in these times, load switching is not one of them. The voltage drop across a BJT is given by Vce(sat) - for a Darlington, this could be 2V or more! For a modern MOSFET, however, this is often less than a tenth of a volt. MOSFETs are much better switches - don't use a BJT as a switch in 2020.
Expand Down