Why are there only 3 pins on MOSFET transistors? Where is the ground for the GATE power?

I'm trying to switch solenoids with the 5v output from a microcontroller using an N channel MOSFET transistor.
I'm familiar with relays but not so much transistors, which is probably why I'm getting confused.
From what I can determine, the DRAIN and SOURCE pins are like a normally open switch, and the GATE is the coil of sorts that closes the switch if it produces a nonzero voltage. If I hook up the DRAIN and SOURCE to a 24v power supply (the grnd to DRAIN and the SOURCE to the solenoid), and I have a 5v battery for the GATE....how does that physically attach to the GATE pin? Ultimately I'll use the output from the microcontroller, but in the meantime I'd like to do it manually. I realize I need a switch for the battery to toggle the GATE on and off, but if the +5v from the battery goes into GATE, where does the battery's ground go?

sort by: active | newest | oldest
klee27x7 years ago
You connect the negative terminal of the 5 V battery to the negative terminal of your 24V power supply. And connect your Source pin there, too. The drain pin goes to the "low" side of the solenoid coil. The other side of the coil must attach to the +24V rail. And don't forget a back-EMF diode.

Just make sure that your microcontroller is always output high or low, and never high impedance. Also, put a 100k pull down resistor on the gate, so that it doesn't float while the device is off. It could cook the instant you turn it on, unless your MOSFET is overrated.
uuuuuunnnnnn (author)  klee27x7 years ago
So both power supplies use the same ground. thanks!
Things got a little confusing after this - thanks for all the follow ups, but I think I threw you a bit by confusing drain and source in my original post. ehhh.
For using an N-channel Mostfet in this configuration, yes.
klee27x klee27x7 years ago
...If your solenoid must switch from the "hi" side, it gets a lot more complicated. You must use a P channel MOSFET. Source goes on the +24 rail, Drain goes on solenoid high side, and you put a 100k pullup resistor on the Gate. Now the gate must be pulled down to 12V, or so, in order to turn on. So you'd need to rig up a resistor divider or a zener diode and drive it with an NPN transistor or an N-channel driver MOSFET. If you pull the gate more than 12-20V (depending on P-Fet) from the Source pin (i.e. if you pull it all the way from +24V to ground rail), it will be damaged.
klee27x klee27x7 years ago
Umm.. unless of course you go with a common positive rail setup, joining the 5V battery positive rail to the +24 volt rail, and leave the negative terminals isolated.
klee27x klee27x7 years ago
Umm... also, the Drain and Source pins are not exactly like an open switch. Actually, when off, the Drain-Souce junction is like a diode. On an N channel FET, the anode of this diode is on the Source side. So current can freely flow "backwards" through this junction, from Source to Drain. On a P channel FET, this is reversed.
seandogue7 years ago
using a N channel, you generally do low side switching. (Yes, high side is possible, just sayin)

the gate is referenced to the drain, which is normally connected to system ground.
This is likely ONLY if you are using it as a digital switch, not when using it as an amplfier.

True enough. But the question does appear to refer to switching.  Using a Mosfet as a voltage dependent resistor or amplifier is a different beast than the simplicity of using it as a switch, which is simply a matter of saturating the gate.

The Mostfet can be to some degree paralleled or modeled like a bipolar transistor, in that the drain is complementary to the emitter on a bipolar, the source to the collector, and the gate to the base. The big difference is that the gate is voltage driven wheras the base is current driven. (And there is no base-emitter diode drop, allowing the mostfet to have an effective on resistance that approaches zero.
Many moons ago I fell for the "MosFETs can be easily paralleled cra&" because I missed the caveat "but only when they are driven in saturation"....cost me a fortune in transistors !
Welll...they *can be, (sand I have done it quite successfully in a few cases) but it's a dicey deal...as I recall they have to be matched. Every leaf's different, and some more than others....pop... fizzle..magic smoke.

doh...by paralleled, I meant "analogized"...sorry for any confusion there...I must remember to be careful with my seadogue-istic vernacular.
IMHO, you can't get away from adding degenerating resistors when you parallel the damned things, just in case.