How to clamp the MOSFET gate during MCU reset?

Thread Starter

cspwcspw

Joined Nov 8, 2016
61
I'm doing a pretty simple DIY constant load sink for testing batteries. I'm controlling the gate of a MOSFET by two-pole filtering a PWM output from an Arduino MCU to produce a voltage. A couple of extra resistors and a biasing Vbias allow me to level-shift my control voltage to better match the MOSFET's requirements. The MOSFET gate threshold is at about 2V and is fully on around 6V. (Its an IRF3205, but the LTSpice simulation is based on another device.)

It worked on the LTSpice simulation, and worked on the bench where I'd powered it from a load-controlled power supply. But then I moved up to a real battery, and it was great. Until the PC reset the microcontroller. On reset, output PWM pins go high-impedance. But I'd only considered the cases of when they were either HIGH or LOW. Then my bias pulled the MOSFET fully on, and there was some early-morning fun and smoke. (Yes, of course foresight trumps hindsight. Perhaps I should have fused the load circuit after all.)

So I'm looking for some simple ideas. First I need to simulate things better. How do I best create a Voltage Source in LTSpice that can supply a PWM square wave for a while, and then go into tristate / high-impedance mode where it refuses to sink or source current? Then at least I can simulate my situation without having to repeatedly cut wires in LTSpice. I did look at the switch component :-(

KeepTheGateLow.png

And then, what is a nice way (in the real circuit) to either ensure that my biasing Vbias doesn't appear until the microprocessor has booted and gives it the all-clear? Or to clamp the gate until everything is ready. I have spare GPIO control lines in the microprocessor.

The gate-control circuit (PWM to voltage) are all very low-current demands (probably less than 1ma), so I'm reluctant to throw a relay in there to turn my Vbias on or off. Maybe I can switch Vbias on or off with a small signal MOSFET (I have some 2N7000), or a small transistor that is ON by default to lock down the Gate until the software "allows the Gate to follow the MCU output".

Any simple or "cookbook" suggestions?

Thanks
Peter
 

MaxHeadRoom

Joined Jul 18, 2013
20,405
I assume a Arduino is similar to a PicMicro on reset, i.e. the GPIO reverts to an input (high impedance)?.
I just connect a 10k from mosfet gate to P.S. common.
This ensures the gate is off at this point.
Also used during a program when PWM off is desired, GPIO set to input..
Max.
 

Alec_t

Joined Sep 17, 2013
11,119
How do I best create a Voltage Source in LTSpice that can supply a PWM square wave for a while, and then go into tristate / high-impedance mode where it refuses to sink or source current?
You could just add a voltage-controlled switch in series with the voltage source.
 

AlbertHall

Joined Jun 4, 2014
9,622
Invert the PWM with a transistor with a pullup on the base. The collector would only go high when the base was being driven low by the GPIO.
 

Thread Starter

cspwcspw

Joined Nov 8, 2016
61
hi csp,
Please post your LTS asc file, also why is the Vbias required.?
E
Looks like I clearly don't understand something because a number of folk are asking "Why do you need Vbias?" I think I need it because the MOSFET needs more than 5V on its gate to deliver, say, 30A at 12V. http://www.irf.com/product-info/datasheets/data/irf3205.pdf So instead of a simple PWM-to-voltage converter that delivers 0 - 5V, I need some voltage shifting to map my available PWM resolution into a higher range, say 2V to 6V. And if I go to a 3.3V MCU, the PWM high of 3.3V also needs level shifting to get the voltages to levels that can control the MOSFET. I wanted to use a resistor network rather than introduce an extra OpAmp or a MOSFET driver for the level-shifting. (But also, if I let the MOSFET overheat, it doesn't need such high controlling voltage on the gate. That sounds like an ugly workaround! :)

I've attached the .asc below.

Thanks for the feedback.
 

Attachments

Beau Schwabe

Joined Nov 7, 2019
48
I see why he has R1 Vbias ... because the micro controller cannot supply 9V to the micro ... it can sink to GND ... So making the micro pin an input (floating) turns the transistor "ON" ... it may work okay in a simulator, but this is not the right way to drive an n-MOS high.

See attached circuit for a better drive method.

Note: D1 is not necessary if supply voltage is 15V or below. Micro can also be 3.3V instead of 5V
 

Attachments

djsfantasi

Joined Apr 11, 2010
6,334
I assume a Arduino is similar to a PicMicro on reset, i.e. the GPIO reverts to an input (high impedance)?.
I just connect a 10k from mosfet gate to P.S. common.
This ensures the gate is off at this point.
Also used during a program when PWM off is desired, GPIO set to input..
Max.
@MaxHeadRoom is correct. Upon boot (reset), all GPIO pins are set as INPUT and their state is high impedance.

BUT!

During the boot sequence, the pins will flash high a couple of times for a couple of seconds. Depending on your external circuit, this could cause a problem.

Setting a pin as an OUTPUT, the default state is LOW. As INPUT, it will be tristate except if it is set as INPUT_PULLUP. Then an internal pullup resistor is activated on the pin and it defaults to HIGH.
 

jpanhalt

Joined Jan 18, 2008
9,043
The IRF 3205 is not logic level. You can substitute a logic level device or use a gate driver. Biasing the gate just below its Vth will not add to the voltage you are using to drive it.
 

Thread Starter

cspwcspw

Joined Nov 8, 2016
61
Invert the PWM with a transistor with a pullup on the base. The collector would only go high when the base was being driven low by the GPIO.
Nice, thanks, I like! It basically solves my "oversight" - I forgot to think about the GPIO being high impedance. This says the output of the transistor will go low when my forgotten case happens! :)
 

MaxHeadRoom

Joined Jul 18, 2013
20,405
@MaxHeadRoom is correct. Upon boot (reset), all GPIO pins are set as INPUT and their state is high impedance.

BUT!

During the boot sequence, the pins will flash high a couple of times for a couple of seconds. Depending on your external circuit, this could cause a problem.

Setting a pin as an OUTPUT, the default state is LOW. As INPUT, it will be tristate except if it is set as INPUT_PULLUP. Then an internal pullup resistor is activated on the pin and it defaults to HIGH.
This is why I use Logic level Mosfets and a gate to pwr common resistor.
Never had an issue yet!?
Max.
 

Thread Starter

cspwcspw

Joined Nov 8, 2016
61
The IRF 3205 is not logic level. You can substitute a logic level device or use a gate driver. Biasing the gate just below its Vth will not add to the voltage you are using to drive it.
Yep, it absolutely is not a logic level device. I initially watched a GreatScott video where he used a 4420 MOSFET gate driver capable of 6 amps. With a big capacitor and a low (10 ohm) resistor. Just the driver and smoothing stage got pretty warm when I built it. And I thought the PWM frequency ripple was quite high. So do I really need a 6A driver to drive a MOSFET gate which requires no more than a few micro amps? So it seems to me that gate drivers are made for high-frequency AC switching of a high-capacitance power stage. They're not really ideal for this kind of DC "dissipate the load in the MOSFET, and slowly adapt the gate voltage" use-case.

If I can bias the gate just below its Vth, it doesn't change the drive voltage, I agree. But then I don't waste some of my PWM resolution mapped into generating voltages from 0V to Vth. I can map all my PWM resolution into gate voltages that matter, I can get finer control.
 

jpanhalt

Joined Jan 18, 2008
9,043
Yep, it absolutely is not a logic level device. I initially watched a GreatScott video where he used a 4420 MOSFET gate driver capable of 6 amps. With a big capacitor and a low (10 ohm) resistor. Just the driver and smoothing stage got pretty warm when I built it. And I thought the PWM frequency ripple was quite high. So do I really need a 6A driver to drive a MOSFET gate which requires no more than a few micro amps? So it seems to me that gate drivers are made for high-frequency AC switching of a high-capacitance power stage. They're not really ideal for this kind of DC "dissipate the load in the MOSFET, and slowly adapt the gate voltage" use-case.

If I can bias the gate just below its Vth, it doesn't change the drive voltage, I agree. But then I don't waste some of my PWM resolution mapped into generating voltages from 0V to Vth. I can map all my PWM resolution into gate voltages that matter, I can get finer control.
Those "6A" figures translate into turn-on time. It's charging a capacitor. And yes, very generally, the higher the Ids current, the faster the turn-on time needs to be to limit I^2R (Ohmic) heating. You have so much resistance in your gate circuit, you might use it to keep time in a cricket match. :)
 

AlbertHall

Joined Jun 4, 2014
9,622
Those "6A" figures translate into turn-on time. It's charging a capacitor. And yes, very generally, the higher the Ids current, the faster the turn-on time needs to be to limit I^2R (Ohmic) heating. You have so much resistance in your gate circuit, you might use it to keep time in a cricket match. :)
But TS isn't trying to quickly turn on or off. The aim is to partly turn on the MOSFET to draw the desired current.
 

jpanhalt

Joined Jan 18, 2008
9,043
But TS isn't trying to quickly turn on or off. The aim is to partly turn on the MOSFET to draw the desired current.
Well, he should look at this graph:
1583614212189.png

He has not said what package he plans to use. The TO-220 package for that device has a thermal resistance of 62°C/W. Let's assume he is creeping up from a Vgs of 4,5 V, so 10 A@ 25V = Rds of 2.5 Ω, and I^2 x R = 250 W. Now, at 62°C/W = 250x62 = 15,500 °C. It better not be there very long.

The better way is PWM with a good gate driver since his goal is 30A.
 

Thread Starter

cspwcspw

Joined Nov 8, 2016
61
Those "6A" figures translate into turn-on time. It's charging a capacitor. And yes, very generally, the higher the Ids current, the faster the turn-on time needs to be to limit I^2R (Ohmic) heating. You have so much resistance in your gate circuit, you might use it to keep time in a cricket match. :)
Indeed! If I want to test a 7Ah battery, say, or a car or solar battery, the times are likely to be in tens of minutes or hours rather than microseconds. So I want to adjust for a constant load really slowly over long timeframes. So plenty of resistance and capacitance seem OK. And the MOSFET is deliberately being kept in its Ohmic region - it *is* the dynamic load, rather than the more common situation where the MOSFET switches ON or OFF fast to drive an external load. So I reckoned I should not need a MOSFET driver.

So yes, long timing probably more suitable for slow cricket matches!
 
Top