I was under the impression that a MOSFET could more or less act as a high speed switch which you control with the square wave output from a microcontroller. Given the pin voltage is 3.3v and the desired external voltage is 20v why am I getting 3.3v at the drain? I'm super confused and frustrated. The IRF510 has a gate voltage of 2-4v. 3.3v is right in the middle should have worked fine.
This circuit is what everyone else uses to drive LED's and motors, but I'm not getting results. I've tested the pin on the o-scope, the signal looks great, but when I probe the drain it's the same signal at 3.3v, not 20v. Any help would be great, and yes I know this is similar to someone else's post. I've read about 30 and they do not get me closer to solving my problem. I've rebuilt the circuit about a dozen times. Save me from this insanity!!!
No, that's why your circuit can not work properly.
The threshold voltage of 2-4V must be exceeded before the MOSFET starts conducting at all. If your particular MOSFET requires 4V then the 3.3V of the ESP output have no effect at all. Use a logic level MOSFET instead.
Thanks. Why do they publish 2 to 4 volts? 2 is below the threshold. Just curious. But I believe what your are saying. I'll look for a better component.
These are acceptable production limits. The gate voltage has to become less than 2V for turning off and more than 4V for turning on. For power MOSFETS the gate voltage must increase further to allow for more current.
Yeah, try something with a part number "IRL..." instead of "IRF...". The "L" normally indicates it has a logic-level gate. But even that is no guarantee it will work with 3.3V. The manufacturers may assume "logic level" means 5V.
I think it may simply be a coincidence that you measure 3.3V on the drain, and the gate voltage is also 3.3V. There is no reason they should be the same, as far as I know. In a MOSFET, the drain is not connected to the gate.
A MOSFET does not "output a voltage". The drain and source pins of a MOSFET act like a resistor. If the MOSFET is fully switched on, that resistance drops to it's minimum value, which is usually only a few tens or hundreds of milliohms. When the MOSFET is fully switched off, that resistance should be many megaohms.
If you look at the datasheet you will see that Vgsth is specified as some low microamps of current. It is a number that the gate must be "Below" to insure the MosFet is not conducting (very much).
You will need to look at one of the graphs that shows Current as a function of drain voltage with plots for various gate voltages.
Thanks for the response. If I remove the load it outputs the same at those terminals. I think it's the wrong MOSFET. I've order some new ones that are supposedly digital friendly. It's been a really hair pulling experience. Something so simple is so stubborn.
Or you can use a regular bipolar transistor which can be saturated with about 0.7V base-to-emitter. Or double that for a Darlington transistor (two transistors cascaded into one package).
Under "ideal conditions" A MOSFET usually has less voltage-drop across it than a transistor but I don't know if you can find a MOSFET that turns fully-on with only 3.3V.
Transistors are "current driven" whereas MOSFETs are "voltage driven". The circuit is different and you need a resistor in series with the base to limit the current.
That's an interesting work-around. From what I've read MOSFET seems to be the go-to solution for driving higher voltage/current loads using the GPIO as the gate signal. Not being an engineer, I don't know what all the specs mean when I chose parts. I have to learn the hard way. Hopefully, these next batch of parts will get me on my way. After all the beauty of Arduino is to actualize concepts and without getting mired down into all the minutia of tech. K.I.S.S.
IMHO, I use the mosfets. I have almost all mosfets anymore... much more simple to use..
They are so basic to todays electronics, all of our computers are based on them...
The automotive industry is one of the biggest users of mosfets for a good reason...
For 3.3V machines I use a IRLZ24NPBF mosfet and I've had good success with them... They are about a $1 each... got 10 for 9 bucks and 5 bucks shipping.
Bipolar transistors have applications they excel in, MosFets the same.
However for driving higher current loads from processor output pins MosFet's are the best solution. You only need to select a "logic" level MosFet. IMHO MosFets are very "KISS"
MosFets:
Draw little or no current from the digital output.
When fully turned on the voltage drop from drain to source is extremely small meaning you could control higher currents with less heat generated in the MosFet (vs a bipolar transistor).
Darlington bipolar transistors are absolutely NOT for this type of application. They are designed to signal amplification and not switching.
Exactly! Another example MOSFETs are not KISS. Because this specification is quite unimportant.
When you have a schematic with a BJT you can simply substitute another BJT with appropriate maximum current and voltage rating (easily understandable spec) and it should work. With a MOSFET you need much more info.
What? Darlingtons are mainly for load switching. They are old. They drop considerable voltage compared to a MOSFET. But when switching say 40 V with CE drop of up to 2 V is not so bad - "only" 5% loss.
One on the helpers here used to say that the Vgs(th) spec was where the MOSFET turns OFF. If one uses the MOSFET at a drain current close to 250 microamps that is valid for switching ON. But, who uses a power MOSFET at that low a drain current?
Vgs(th) is a specification telling the designer where the device starts to conduct.
If you had a 250 µa load, at the specified Vgs(th) the device would only be partly ON.
And because the Vgs(th) spec is usually rather wide there is no way to reliably operate near the Vgs(th)
It is a test spec JohnRob. As I read it, if I connect gate to drain and apply a constant current of 250 microamps between gate and source, the voltage across the device should be between 1 and 2 volts. What good is that?