Home > Microcontroller >Microcomputer Circuits > Drive an N-channel MOSFET with a microcontroller

Drive an N-channel MOSFET with a microcontroller

Source: InternetPublisher:Zi1HYSH Keywords: Microcontroller MOSFET Updated: 2025/12/16

Drive N-channel MOSFETs and microcontrollers

MOSFET transistors are an excellent choice for driving high-current devices such as motors or high-power RGB LEDs. Compared to bipolar transistors, they offer very low switching resistance and very low heat dissipation. This guide aims to explain how to drive N-channel MOSFETs using a microcontroller such as a PIC or ATMEGA. Transistors generate heat when driving large loads because of the voltage drop (Vce) across them, and heat (watts) = voltage * current. This can lead to thermal runaway within the transistor, which, if not handled carefully, can ultimately damage the device.

A FET (Field-Electronic Field-Controlled Transistor) acts like a digital switch, capable of turning on and off between its drain and source terminals by adjusting the voltage potential at its gate. When an FET is on, it typically has a resistance of less than 0.01 ohms; when off, it functions like an open circuit. Due to its low resistance in the on-state, an FET can carry large currents without generating heat.

FETs are turned on by voltage potential, not current, so they have very high input impedance. Because of this, you only need a single voltage to turn them on, making them ideal for digital electronic devices.

Drive an N-channel MOSFET with a microcontroller

Have you ever considered using a FET (Field-Electronic Field Test) to switch a target device instead of a transistor? If not, then you should read on, as FETs offer many advantages over transistors. The pin arrangement of an FET is similar to that of a transistor; consider the following analogy:

Transistor FET

Collector Drain

Base Gate

Emitter Source

Similar to transistors, there are two types of FETs: N-channel and P-channel. Depending on your application, you will need to choose the appropriate one. N-channel FETs are best used when switching the FET to ground because no drive circuitry is required—even if the target supply voltage is higher than the gate logic voltage. If you want to control the supply voltage of the target device, please refer to the P-channel MOSFET guide. Consider the following circuit: (Note that only the gate voltage is needed, not the current as in a transistor):

Example of an N-channel MOSFET

The circuit described above is an example of how to drive a motor using an N-channel FET. When driving an inductive load, a reverse-biased diode connected in parallel with the motor should be used, but this is not necessary for a purely resistive load.

One of the biggest advantages of FETs is their huge input impedance, but this must be handled carefully. If the gate is not grounded, it may float high. This isn't a problem when the microcontroller is on and the output is configured in one of two states (high, 5V or low, 0V)—but it's a major issue when the microcontroller is off or on. In the diagram below, the switch isolates the gate, similar to what would happen if the control pin were set to an input with several megaohms of impedance (note that the FET doesn't turn off):

FET floating

To correct this, place a resistor (10K or higher) at the gate and ground the FET:

FET ground

I haven't delved into any specific FET models yet; I'm just covering the basics. There are different types of FETs available, but most require high Vgs voltages to operate. For microcontrollers, logic-level MOSFETs are preferable because they don't require driver circuitry to switch high voltages. They can be driven directly from 5 volts, and some even as low as 3 volts.

Among hundreds of different N-channel logic level MOSFETs, I used the following models:

N-channel logic level MOSFET

STP36NF06L

Finally, please remember that FETs are very sensitive to static electricity, so handle them with care. However, I haven't damaged one yet in my "amateur" work.

Drive an N-channel MOSFET with a microcontroller

Drive an N-channel MOSFET with a microcontroller

Drive an N-channel MOSFET with a microcontroller

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号