Maker Pro
Maker Pro

MOSFETs that make you scratch your head..

The Hammer

Sep 17, 2013
164
Joined
Sep 17, 2013
Messages
164
I'm building an LED strip PWM dimming setup for a new bed frame I've created. Problem is... After all the painstaking work I've put into it the MOSFETs I've used on the low side seem to be going BONKERS!


I've hooked the Gate directly to the ATTINY861-PU running off a hacked USB wall charger (750mA) I'm using which I've read is perfectly fine, hooked the "-" side of the MOSFET to Drain, and hooked up the Source to the power supply (stable 12.16V as read by my garbage multimeter), and "+"straight through. I can confirm that everything has continuity, and is operating fine EXCEPT the power MOSFET..

I'm using IRLB8721PBF that I ordered off Digi-Key. The LED flickering (when Drain and Source are shorted, no flickering, so it's not the 12V supply), and do not respond to voltage change 0V-5V on the Gate. When I touch the Gate with my finger the LEDs glow solid! They also act all sorts of odd with different types of flickering depending on how I remove my finger from the Gate..

WHAT IS GOING ON?!? o_O
 

The Hammer

Sep 17, 2013
164
Joined
Sep 17, 2013
Messages
164
Best I could manage on my phone right now. :) I'll rotate these later on.

bed2.jpg


bed1.jpg
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
How is your ATtiny powered? The 0V rail of the ATtiny circuit needs to be connected to the MOSFET's source.
 

The Hammer

Sep 17, 2013
164
Joined
Sep 17, 2013
Messages
164
The bare circuit board in the second photo is a hacked Micro-USB wall-wart phone charger. The MOSFET is separately connected on it's Drain and Source pins to the 12 Volt power supply next to it. Would there be any issue joining the 0 Volt "Ground" lines? There's no legitimate connection to ground on either power supply, FYI.
 

The Hammer

Sep 17, 2013
164
Joined
Sep 17, 2013
Messages
164
Connecting these lines works as far as more noticeable control over the "on"/"off", but it now does not shut off completely. :eek:
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
You may have damaged the MOSFET when you had an unknown voltage difference between the two 0V rails. MOSFETs have a very high input resistance and the gate insulation can be damaged by voltages as low as 15V; even lower on some with very small feature sizes.

Fit a new MOSFET and add a 12V, 0.5W zener diode (1N5242B) directly across the MOSFET with its cathode to the gate and its anode to the source. That will protect the MOSFET's gate from damage. (Keep the gate and source shorted until the diode is fully connected.)
 

Laplace

Apr 4, 2010
1,252
Joined
Apr 4, 2010
Messages
1,252
While it is possible to have damaged the MOSFET gate during assembly of that rat's nest of wiring, what happens if you connect the gate and source together directly? If that causes a complete shutoff then the MOSFET is probably OK. In that case use a voltmeter to measure the signal voltage between the gate and source to insure that the gate voltage is being driven to zero. If not, then you have other problems.
 
Last edited:

The Hammer

Sep 17, 2013
164
Joined
Sep 17, 2013
Messages
164
Thank you for the suggestion. I will try this after work tomorrow. Thank you all so much for your help. You people have always been absolutely brilliant with your help. I can't wait to start returning the favor one day.
 

The Hammer

Sep 17, 2013
164
Joined
Sep 17, 2013
Messages
164
The only other thing I can think it may be is that the ATTINY861 can't keep up with charging/discharging or something?? What's the next step if it's not reaching 0?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
The only other thing I can think it may be is that the ATTINY861 can't keep up with charging/discharging or something??

When we talk about mosfets being slow to turn on, we are normally talking about times in microseconds, or in the worst case milliseconds. Even when operating slowly the transition is far too fast for the human eye and so flashing would appear like flashing. If you're doing PWM then slow switching is generally seen in the heating of the mosfet, the load often seems t be performing acceptably.

If you don't have the grounds connected then the link between the microcontroller and the mosfet is basically a radio link. the ground rail (that isn't connected) is like a very small value capacitor (say a few pF) and only the highest frequency portions of your waveform will be seen at the mosfet gate. What happens with this is pretty random, although it may start to respond (slowly) to changes in the electric field if the gate potential nears the turn on threshold. What this translates to is pretty random behaviour, although frequently with some apparent connection to what is going on in the circuit somewhere.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
It will be able to drive the MOSFET fully to both supply rails, but it won't switch the MOSFET very fast, because the MOSFET has a high gate-to-source capacitance. Every time the MOSFET switches, it will dissipate a bit of energy while it passes through its linear region, as it transitions from fully OFF (no current flowing through it, therefore no power dissipated) to fully ON (negligible voltage across it, therefore negligible power dissipated).

Whether that's a problem or not depends on how often you're switching it, and how much voltage and current it's switching. At 12V with an LED load there probably won't be a problem, but if you tell us the LED current, we can check.

It won't have a problem reaching 0V. If it does, either the MOSFET or the ATtiny is damaged.

The other issue with driving a MOSFET gate directly from a microcontroller is the ON voltage, which may not be enough to turn the MOSFET fully ON. The device you mentioned, IRLB8721PBF, has its ON-resistance specified at gate-to-source voltages of 10V and 4.5V. At 4.5V, its ON-resistance is about twice as high as its ON-resistance with 10V gate-to-source voltage, so it will drop about twice as much voltage (still not very much voltage though), and will dissipate about twice as much power, as it would if its gate voltage was taken up to 10V.

Both of those issues can be resolved by using a MOSFET driver IC. In this case you need a single "low-side MOSFET driver". This connects across the +12V power supply for the load, and drives the MOSFET's gate. It is controlled by an input that can be driven easily by the ATtiny. Any of the ICs listed in this Digi-Key filter should be suitable: http://www.digikey.com/product-search/en?FV=fff40027,fff8020b,401993,1140050,15c0002,15c0003,33c0031,3c00007,3c00009,3c0000a,3c0000b,3c0000c,3c00010,3c00048,3c00051,3c0006f,3c00072,3c000aa,450000f,4500031,4500074,450009e,45000de,45000f1,45001e3,4500208,450023d,450024d,450024f,450026c,45002ed,45003ae,4500410,4500411,45006e0,4500aff,4500d70,7680023,7680024,7680096&ColumnSort=1000011&stock=1&quantity=1&pageSize=250

If you want a specific recommendation, this one looks good and is very cheap: http://www.digikey.com/product-detail/en/MCP1407-E/P/MCP1407-E/P-ND/1228640

Download the data sheet and take note of the requirement for a decoupling capacitor. I recommend connecting the driver IC directly to the MOSFET. I would add a small piece of stripboard to your MOSFET, and mount the driver IC and decoupling capacitor on that; bring the 12V power supply in to that board then bring two wires out to the LED, and another two wires out to the ATtiny board - one for the 0V rail and one for the control signal.
 

The Hammer

Sep 17, 2013
164
Joined
Sep 17, 2013
Messages
164
When we talk about mosfets being slow to turn on, we are normally talking about times in microseconds, or in the worst case milliseconds. Even when operating slowly the transition is far too fast for the human eye and so flashing would appear like flashing. If you're doing PWM then slow switching is generally seen in the heating of the mosfet, the load often seems t be performing acceptably.

If you don't have the grounds connected then the link between the microcontroller and the mosfet is basically a radio link. the ground rail (that isn't connected) is like a very small value capacitor (say a few pF) and only the highest frequency portions of your waveform will be seen at the mosfet gate. What happens with this is pretty random, although it may start to respond (slowly) to changes in the electric field if the gate potential nears the turn on threshold. What this translates to is pretty random behaviour, although frequently with some apparent connection to what is going on in the circuit somewhere.
This is what I've been lead to believe as far as MOSFET on/off times. lol

Right now I've got a .5 Hz period with a 50% duty cycle just so I can see what's going on, though I will be increasing the period to roughly 240Hz eventually (couldn't get EXACT 240.. oh, well..).

When measured it appears to be going straight down to 0V on the Gate regardless of if the 0V rail lines were connected or not, but the results don't lie. After connecting the 0V rails the LEDs went from full on to a dimmed state in a very direct and controlled manner instead of odd flickering like some sort of florescent light trying desperately to ballast properly. The odd thing is that even though I programmed the MCU to On/Off every 1Hz, it was not consistently at 1Hz when the rails were connected.. When not connected to the MOSFET it was correctly pulling the pin up and down at the correct frequency, but when connected it was varying noticeably. That may have something to do with the fact that the MOSFET is possibly damaged. o_O


It will be able to drive the MOSFET fully to both supply rails, but it won't switch the MOSFET very fast, because the MOSFET has a high gate-to-source capacitance. Every time the MOSFET switches, it will dissipate a bit of energy while it passes through its linear region, as it transitions from fully OFF (no current flowing through it, therefore no power dissipated) to fully ON (negligible voltage across it, therefore negligible power dissipated).

Whether that's a problem or not depends on how often you're switching it, and how much voltage and current it's switching. At 12V with an LED load there probably won't be a problem, but if you tell us the LED current, we can check.

It won't have a problem reaching 0V. If it does, either the MOSFET or the ATtiny is damaged.

The other issue with driving a MOSFET gate directly from a microcontroller is the ON voltage, which may not be enough to turn the MOSFET fully ON. The device you mentioned, IRLB8721PBF, has its ON-resistance specified at gate-to-source voltages of 10V and 4.5V. At 4.5V, its ON-resistance is about twice as high as its ON-resistance with 10V gate-to-source voltage, so it will drop about twice as much voltage (still not very much voltage though), and will dissipate about twice as much power, as it would if its gate voltage was taken up to 10V.

Both of those issues can be resolved by using a MOSFET driver IC. In this case you need a single "low-side MOSFET driver". This connects across the +12V power supply for the load, and drives the MOSFET's gate. It is controlled by an input that can be driven easily by the ATtiny. Any of the ICs listed in this Digi-Key filter should be suitable: http://www.digikey.com/product-search/en?FV=fff40027,fff8020b,401993,1140050,15c0002,15c0003,33c0031,3c00007,3c00009,3c0000a,3c0000b,3c0000c,3c00010,3c00048,3c00051,3c0006f,3c00072,3c000aa,450000f,4500031,4500074,450009e,45000de,45000f1,45001e3,4500208,450023d,450024d,450024f,450026c,45002ed,45003ae,4500410,4500411,45006e0,4500aff,4500d70,7680023,7680024,7680096&ColumnSort=1000011&stock=1&quantity=1&pageSize=250

If you want a specific recommendation, this one looks good and is very cheap: http://www.digikey.com/product-detail/en/MCP1407-E/P/MCP1407-E/P-ND/1228640

Download the data sheet and take note of the requirement for a decoupling capacitor. I recommend connecting the driver IC directly to the MOSFET. I would add a small piece of stripboard to your MOSFET, and mount the driver IC and decoupling capacitor on that; bring the 12V power supply in to that board then bring two wires out to the LED, and another two wires out to the ATtiny board - one for the 0V rail and one for the control signal.
Eventually I will be upping the load to 3.63 Amps at the 12.16 Volts (I'm sure that voltage will dip when load is on it) on that MOSFET, but all the LED strips haven't come in, yet. :)

I'd like to use a low-side MOSFET driver chip, more MOSFETs, and use a stripboard in the future on a project I'm planning. Until that shipment comes in I won't have one available. I'm about to be moving, so there's less funding and time available to be re-visiting this project for now. I'm going to have to re-visit this page when I get to that point. Very good suggestions, though for the moment I think I can "get away" without it right now. :p At least I'm hoping that moving down to 240Hz shouldn't pose too big a problem and my MCU should be able to handle it.

Can't wait to get home to try this stuff out!
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
(Edited because I forgot to square the current!)

Remember that the solution to your problem is simply to ensure that the signal delivered to the gate of the mosfet is referenced against something else in that circuit. This requires (generally speaking) a common power rail. Often this is the ground rail, and typically this is done (when you have simple single-ended power supplies) by connecting the negative rails together.

Once you have that solved you need to consider the losses during switching. These are proportional to frequency, and even at 240 Hz, the frequency is so low that your switching times would have to be *very* low to cause problems.

Since we know more about the load now, and the device driving the gate, we can do calculations.

Let's assume:

Vds = 12.5V
Id = 4A
f = 250Hz
Ig = 15mA (reasonable current available from the ATTiny)
Qg = 15nC (max value from the datasheet)
Rds = 0.025Ω (read from the graphs for Vgs = 5V)

So the switching time is about t = Qg/Ig = 1μs (that's slow, but it's only 1 millionth of a second!) Consider that we could switch this device in 25ns (that's 40 times faster) with a better driver.

The energy loss on each transition is about Vds * Id * t / 2 = 12.5 * 4 * 0.000001 / 2 = 25μJ

Now, there's 2 of these transitions for each cycle, and f of them each second. so the power loss is the energy lost per second and that is 25μJ * 2 * 250 = 12.5mW

12.5mW isn't anything worth worrying about,

The resistive losses will be (at a maximum) Id * Id * Rds = 4 * 4 * 0.025 = 400mW

The sum of these losses are 412.5mW, or under 1/2W

Even without a gate driver, the mosfet shouldn't need a heatsink.

Let's decide you want to use a higher frequency. At what frequency will the losses reach 1W (the point where you should consider a heatsink for a TO-220 device).

Assuming that the resistive losses are 0.4W, the switching losses will hit 0.6W when:

0.6 = Vds * Id * t * f

thus when f = 0.6 / (Vds * Id * t) = 0.9 / (12.5 * 4 * 0.000001) = 12kHz

So essentially, as long as you keep the frequency below 12kHz you should be fine. At 250Hz, you have about 4700% margin of safety on the operating frequency! :D

At the moment you're not using a resistor between the output of the ATTiny and the mosfet. I've made an assumption that the ATTiny can deliver 15mA and I think that's conservative. I'm also assuming that the load is resistive, but since it's LEDs then the V vs. I characteristics are non-linear. This actually works in your favour because while switching, the voltage across the mosfet does not initially rise as rapidly as the current falls, thus the switching power losses will be less. Also, I've tended to take the worst case values from the datasheet, so you may expect better performance on average.
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Thanks for doing the calcs Steve :)

With a drain current of 4A the ON-resistance at VGS = 5V won't be a problem either.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Did you spot my error? P = I^2 R
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
No... I presume you to be infallible! How much does it affect the outcome?

In that case we have some *real* problems... :D

I've fixed the post.

The I^2R losses are 400mW max instead of 100mW, and the limiting frequency for an approximate 1W dissipation falls to 12kHz instead of 18kHz.

If we were looking at 100kHz and a 10A current with a 50% duty cycle, then we'd be in the region where we would need to think carefully. Right now, the mosfet is probably going to stare back at us and say "Is that all you want?"

(in my sample case above the I^2R losses would be 1.25W, but the switching losses would be 12W, so we would need to do heatsink calculations, especially if the device was in an enclosure,)
 

The Hammer

Sep 17, 2013
164
Joined
Sep 17, 2013
Messages
164
Thank you guys for your help, even if some of it is still a bit above my head.. lol

I had to change out the MOSFET, and it worked perfectly. Shorting Gate to Source merely dimmed the LEDs. The MCU I have for this project is acting up... I'm going to start a different thread about that on AVR Freaks... if they fail me (like they usually do) I'll be back here with a new thread! :)
 
Top