Mosfets and microcontrollers

Thread Starter

clintonb

Joined Mar 6, 2011
52
I was looking at controlling a 12v device using an atmega32 microcontroller. I understand that connecting the device to the mcu will burn out the pin because of the low resistance and the enormous current that will go through.

I looked at a 2N7000 mosfet to do the job but I can't seem to get my head around it. If I connect the source to the 12V negative and the drain to the 12 volt positive we have a circuit controlled by the gate. If you connect the mcu out pin to the gate, where is it grounded? I read that the mosfet and mcu out pin share a common ground but they are different circuits. I also read that the voltage closes the gate when you set the output on the pin to +5v. In a different article they say to connect the out pin to a 100ohm resistor then to gate but doesn't this change the voltage to the gate?

Can anyone offer any insight as to how this works?
 

John P

Joined Oct 14, 2008
2,026
"They are different circuits" may make this impossible. If you can't tolerate a connection between the high-power system and the microprocessor system, you'll have to use an isolator, probably an optical one. That's not difficult, but it changes things.

Assuming that's not the case, the microprocessor and the high-power circuit must have a common ground. It's standard in a situation like that to connect the two at only one point, so no loop can be formed. Having done that, the way the FET will work is if the gate is more than a certain voltage higher than the source, current can flow into the drain. That "more than a certain voltage" is tricky--you need to know the characteristics of the component and compare it to what you expect to do. In this document
https://www.fairchildsemi.com/datasheets/2N/2N7000.pdf

look at Figure 1, the "On-Region Characteristics". You have to find the Vgs (voltage gate to source) and see what current can pass at that level. If it's not enough, find another FET. The 2n7000 might do the job, but you really should use a "logic level FET" designed to use a low gate voltage.

The function of a resistor like the 100 ohm one is that it limits current flow out of the processor (or into it, when you turn the output off). No, it doesn't affect the gate voltage because the gate essentially looks like a capacitor to the processor; a little current will flow in until the gate charges relative to the source, but after that no current will flow.
 

MaxHeadRoom

Joined Jul 18, 2013
28,688
"If it's not enough, find another FET. The 2n7000 might do the job, but you really should use a "logic level FET" designed to use a low gate voltage.

.
I don't know if they are manufacturing the 2n7000 to different specs now but the original promotion by Siliconix in the '80's promoted it specifically aimed at TTL and CMOS applications.
As a 'Logic Compatible N-Channel Mosfet'.
They termed it a FETlington, due to the replacing of a bipolar Darlington.
The original spec showed Gate-source threshold of max 3v .
I have continued using it in these applications and have not seen any problem so far.
Max.
 

John P

Joined Oct 14, 2008
2,026
Drain-source resistance for the 2n700 seems to be 3 ohms minimum with a 5V gate voltage. What if Vgs is 3, or less? You can get FETS with way less resistance, but as far as I can find out, not many in a TO-92 package.
 
Top