# Learning abot MOSFETs with iCircuit & LTSpice

Im tyring to get into my first solenoid project and I started learning about mosfets. I thought I understood BJTs until I ran into MOSFETs. Ive seen about 10 videos on youtube which are quite helpdul and so far I understand I need to choose my MOSFET correctly. I wanted to start with anything I had available but quickly realized I need a Logic Level MOSFET and I need to carefully wire my circuit with a fuse for the lead acid battery (12V) powering the 12V/2.5A or 12V/350mA valve options I have. I also would like to eventually use an optocoupler to separate the circuits just to be on the safe side. But for now I want to get a clearer picture of what happens in the circuit with a MOSFET when I apply the gate voltage.

So it was suggested I try to model it in LTSpice and iCircuit and Id like help making sure my setup is correct. Here is LTSpice and what Id like to know is how to make an analysis where I ramp up the voltage from 0-5V at the gate such that I can study the V and A at different points in the circuit:

In iCircuit I have a setup like this:

Marciokoko:
Id like to know is how to make an analysis where I ramp up the voltage from 0-5V at the gate such that I can study the V and A at different points in the circuit

Dare I say at this point, No, you don't want to ramp up the voltage at all.

The whole point (well, for me) is that MOSFETs provide a near zero resistance switch when fully turned on by the 5v gate (yes, good on you for realising you absolutely need Logic Level MOSFETs).

But if you partially switch on the MOSFET you will get a much higher resistance between Source & Drain which then means much more heat generated - thus negating the whole point (for me) of MOSFETs.

Anyway, partially switching on any transistor will limit the current flow not really adjust the voltage (other than by Ohms law).

You could use PWM on a MOSFET for motor control though...

Perhaps I've misunderstood your requirements here?

Ralph

Thanks for driving that point home about the mosfet being on or off. I guess I was erroneously thinking of it as a pot.

I think what I'm stuck on, aside from some symbology between bjt's and mosfets, vis a vis npn vs. pnp, is what and how it happens in the mosfet that opens and closes the gate because I got confused from bjt's, jfets and now mosfets. So I thought I might build a few circuits with each one to see. And while it might be useful, the circuits won't clear up my confusion of what is happening at each PN Junction.

I think I just have to look at more videos is all.

I do have a few specific questions such as:

Why does the symbol for npn mosfet have an arrow pointing into the gate whereas for pnp mosfet it points out, yesterday for bjt's everything is flipped around?

Not sure how spice works, but try a resistor 10k gate to ground.

.

Thanks for driving that point home about the mosfet being on or off.

No - When we use a transistor (fet or bjt etc) we drive it full on or off so that it acts as a switch. In other words it is digital.

The area between full on and full off is known as the active zone and is where we work if we want an amplifier, in which case we work hard to stay out of the full on/off areas to avoid distortion/clipping.

When picking a mosfet or bjt look for one which will cope with twice the current across the load.

Your valve is an inductive load and requires a diode across it.

Mark

Koko,
Pot is a fair analogy, with the base/gate being the tap. The more force you put on the tap, the further on, or off, you drive the tap. Just remember, that in a digital switching application, you want to drive the tap full on or full off.

You're getting there. keep at it.

Ok I’ve been comparing my options as I study Diodes, BJTs, JFETs and MOSFETs again.

Here is an comparison of what I have:

I believe that if I understand the parameters of these devices it will help me understand more clearly the differences of how they work. I just tried reviewing the set up for a 12VDC/195mA solenoid valve I would be powering from a 12V lead acid battery. Its based on an instructable I found which used a BJT (TIP120) with a 1N4004 diode. (http://www.instructables.com/id/Controlling-solenoids-with-arduino/).

The diode’s most important parameter is the Peak Rep Reverse Voltage from what I gather. The instructable calls for a 4004 but states a 4001 will do. I have a 4007. The values for each are:

4001 - 50V
4004 - 400V
4007 - 1000V
4148 - 100V - I also happen to have a 4148 so I guess I could use this one instead.

What other parameters should I look out for with Diodes besides the VRRM?

Moving on to Switching:

I guess I have seen many tutorials with Arduino about running solenoids with BJTs like the TIP120 because those solenoids used require very little current. If my solenoid draws 194mA at 12VDC, why would the TIP120 not work, or would it? Im looking at the IC which is collector current and its stated as 5A. Am I interpreting that correctly?

Turning over to the MOSFETs, I understand that IRF510 and IRF540 are not LL and so they dont have an RDSon for 4.5V. I also know that mosfets or transistors are meant to be used ON or OFF, but not gradually as I once thought I could get away with milking the IRF510 for the few mA it might produce at 5V at the Base.

It turns out I dont have an IRF510 anyway, what I do have is an IRLB-8721 which is great because it IS a LL mosfet. So Ill start with that.

I just have one doubt about mosfets and datasheets. I was looking at another arduino tutorial that uses a ZVN2110A, which is also not a logic level mosfet. I was thinking, since its Vthreshold is 0.8V-2.4V, I could get a bit of mA out of it. So even though RDSon was 10V = 2A, I figured I might get about 1A at 5V. Then I looked at the curves and saw this:

and thus I realized I didnt really understand these curves. Why does the curve show a reading of about 6.5A at 10V instead of the 2A of RDSon? I just noticed there are two V values, the one on the x-axis and the iso-volt curves. How should I read that graph?

The voltages on the "iso volt curves" are the associated gate voltage. This thing does not really turn on until you get well above 5 V of gate voltage.

The 2A of RDS on is just telling you where they measure it. I am guessing the "10V" for Rds(on) is the gate voltage, So you would measure RDS(on) at the point where the Vgs = 10 V curve hits 2 A, or about 1 V, for an RDS(on) of 0.5 Ohms, really high for a MOSFET.

In general terms your TIP120 would work if all it was passing was 120mA. But the resistance between collector and emitter would be higher than that of a logic level MOSFET.

So some circuits would not perform as well (eg motors) if they have a large resistance transistor in series with them, as the voltage drop would be too much. The voltage drop across a fully switched on MOSFET is pretty minimal, although that 0.5 ohm one mentioned above is about the highest I've ever seen!

As the resistance is greater in a transistor than in a MOSFET (OK, that too is a transistor but a special type) so the heat increases and hence the need for heatsinking. MOSFETs with a low RDSon do not require heatsinks!

As it happens I don't think your TIP120 will either: 12v @ 120ma = 1.44W which it may be able to dissipate without further ado.

Your choice of diode (IN4007) would also work, it is just physically bigger than a IN4001 (and has a higher voltage tolerance, probably *why *it's bigger). Big components mean you cannot construct a small device which may not be an issue in your project at all.

Just as a personal observation I don't think I've ever seen anyone take so much trouble over the characteristics and parameters of components as you - you will be the guru of MOSFETs by the time you finish. Impressive!

So the voltage on each curve is the gate voltage, or Vgs. So they applied:

6V = < 1A
7V = < 2A
8V = 3A
9V = 5A
10V = 6.5A
11V = 8.5A

all for an 8-10V Vds.

And for RDSon they follow the curve of 10V Vgs and where it met the 2A current, its at 1Vds. So that is where they got the resistance reading for RDSon. So how would I interpret that? If I applied 10V at the gate, I could put 1A through a 1V load?

@Ralph
Well I want to know what the most important parameters mean in order to make sure I understand what they mean and how the device works. Im not following your 120mA comment, where is the 120mA limit coming from?

Typically you put a voltage on the gate and sweep VDS, in this case 0-10 V (I don't know where you get the 8-10 V number) You do this for every gate voltage, and then build up the curve.

If you are measuring only RDS(on) you set the gate voltage, and run up the drain voltage until you reach the specified drain current and do the calculation.

Your interpretation is incorrect. RDS(On) is the internal resistance. If you put 10 V on the gate and run up the current to 1 A, you can have any resistive load you want. But the device will have 1/2 ohm of resistance, so if you have 1 A through a 1 ohm load there will be 1 V across the load and 0.5 V across the device for an internal power dissipation of 0.5 W.

What do you mean by this:

Typically you put a voltage on the gate and sweep VDS, in this case 0-10 V. You do this for every gate voltage, and then build up the curve.
[\quote]

Who does this, the manufacturers? What for?

Marciokoko:
…what Id like to know is how to make an analysis where I ramp up the voltage from 0-5V at the gate such that I can study the V and A at different points in the circuit

As mentioned by others, you don’t want to switch on a MOSFET slowly in the real world, but so that you can see what happens in terms of voltage and current, I’ve attached the simulation you’re after.
The gate voltage ramps up from 0V to 5V over 1 second.

I haven’t updated my LTSpice for a while, so had to use a different logic-level MOSFET, but aside from that it’s pretty much the same as your circuit. (You could swap the MOSFET if you want.)

Just unzip and click on the *.asc file to open the schematic, then choose “Run” from the “Simulate” menu.
I’ve plotted the MOSFET gate voltage, the current through the load resistor R1, and the voltage between Vcc and Vout.

Here’s a pic of the plot, for anyone without LTSpice:-
(Right-click and “View Image” or similar for full size.)

MOSFET_Test.zip (4.49 KB)

Ralph_S_Bacon:
Your choice of diode (IN4007) would also work, it is just physically bigger than a IN4001 (and has a higher voltage tolerance, probably why it’s bigger).

Ralph, you would think that a 1N4007 would be bigger, but in reality a 1N4001 and 1N4007 are the same size, physically:-

There’s a bit of variation in the physical size, but that’s not necessarily related to the voltage rating.

marcioko:
The diode’s most important parameter is the Peak Rep Reverse Voltage from what I gather.

The other equally important parameter is the forward current, of course.

Thanks @OldSteve.

Yes, the forward current of the Diode is important.

As for the LTSpice file you sent, how do you run a v-ramp simulation?

So as V ramp from 0 to 5V, current through R1 jumps from 0 to 2.5A…and

also as V ramps upwards, Vcc-Vout potential jumps from 0 to 12V.

Ok so how can this be interpreted…oh wait, let me look at the mosfet you used…

Max Drain current at 10V is between 4-5A, so it should make sense that we get 2.5A at 5V.

Vth is 0.5-1.1V, and the current begins to flow in your plot at 1V more or less

RDSon is 29mOhms at 4.5Vgs = 5A, but we only got 2.5A?

Marciokoko:
Thanks @OldSteve.

Yes, the forward current of the Diode is important.

As for the LTSpice file you sent, how do you run a v-ramp simulation?

Didn’t you run the example. It does a v-ramp, from 0V to 5V, and shows the command that accomplishes this.

So as V ramp from 0 to 5V, current through R1 jumps from 0 to 2.5A…and

also as V ramps upwards, Vcc-Vout potential jumps from 0 to 12V.

Ok so how can this be interpreted…oh wait, let me look at the mosfet you used…

What do you mean by “how can this be interpreted”? As the MOSFET turns on, it’s drain gets closer and closer to 0V, until the whole 12V is across the 4.8Ω resistor. No interpretation is necessary - it’s all right there in front of you.

Max Drain current at 10V is between 4-5A, so it should make sense that we get 2.5A at 5V.

? Where does 10V come into it? Vcc is 12V, the resistance of R1 is 4.8Ω. 12V/4.8Ω = 2.5A. (For simplicity, I’m ignoring the small voltage drop across the MOSFET here.)

RDSon is 29mOhms at 4.5Vgs = 5A, but we only got 2.5A?

You’ve completely lost me here. If 2.5A is flowing through the (turned on) MOSFET, which has an Rds(on) of 29mΩ, then the voltage drop across the MOSFET will be 29mΩ x 2.5A = 72.5mV - a negligible amount. And the power dissipated within the MOSFET would be 72.5mV x 2.5A = 181mW.

I just did, above. There’s nothing more I can add, to be honest. It’s all very straightforward.
I hope you can follow it now. I’m running out of explanations.

The vramp command doesn't show up on my end. Actually the file sometimes crashes my app at times. The ltspice directive window is empty for some reason.

As for my interpretation, 10v came from the datasheet. What I'm trying to do is interpret the datasheet characteristic output curves.

I want to understand how to read the parameters in the datasheets, particularly Rdson. When Rdson states:

4.5Vgs
5.0A ID
29mOhms

I thought it meant that 5A at the drain will flow if 4.5V are applied at the gate but I guess that doesn't really make sense because it also depends how much VDS is.

Marciokoko:
The vramp command doesn’t show up on my end. Actually the file sometimes crashes my app at times. The ltspice directive window is empty for some reason.

The command is on the schematic. It’s this:- “PULSE(0 5 0 1s 0)”
And the window to set it up looks like this:-

If you right-click on the V1 voltage source, the “Independent voltage source” setup window will open.

As for my interpretation, 10v came from the datasheet. What I’m trying to do is interpret the datasheet characteristic output curves.

I want to understand how to read the parameters in the datasheets, particularly Rdson. When Rdson states:
4.5Vgs
5.0A ID
29mOhms

I thought it meant that 5A at the drain will flow if 4.5V are applied at the gate but I guess that doesn’t really make sense because it also depends how much VDS is.

That’s right - The drain current is actually determined by the load resistance and the supply voltage.

All the figures that you quote are saying is that with 4.5V between gate and source, the MOSFET will be turned fully on and the ‘on’ resistance will be 29mΩ, and that this is with 5A flowing.

OldSteve:
Ralph, you would think that a 1N4007 would be bigger, but in reality a 1N4001 and 1N4007 are the same size, physically

How strange. I have some diodes that are most definitely chunkier than 1N4001s so I had assumed they were of that family just bigger (current and voltage capacity).

As my age progresses trying to read that writing on that tiny, round component is a bit of a challenge even with a strong light and a magnifying glass. Mind you, these diodes are probably 10 20 30 years old and have never been used precisely for the reason I mentioned: too big!

But one day they will come in handy I'm sure.

Ralph_S_Bacon:
How strange. I have some diodes that are most definitely chunkier than 1N4001s so I had assumed they were of that family just bigger (current and voltage capacity).

As my age progresses trying to read that writing on that tiny, round component is a bit of a challenge even with a strong light and a magnifying glass. Mind you, these diodes are probably 10 20 30 years old and have never been used precisely for the reason I mentioned: too big!

But one day they will come in handy I'm sure.

Yeah Ralph, I know what you mean. My eyesight is going down the drain too. Those diodes might be 1N540x series - 3A. I have a few of them sitting here too, but rarely need to use them.

Edit: I put everything in labelled bags as soon as they arrive these days, so I don't have to try to read labels/colour codes very often. And if I have any doubt with a resistor, instead of trying to 'read' it, I grab the DMM now.