Control a DC Fan with an N-Channel MOSFET

Last updated May 2019

Introduction

Welcome to ProteShea – in this tutorial, we’ll be showing you how to control a DC fan with a N-channel MOSFET and Arduino Uno. The fan requires 200mA at +5Vdc which is over the max current that an Arduino Uno (revision 3) pin can source. If you consult the datasheet for the ATmega328, the max current per pin is 40mA. Going over the maximum current limit can damage the microcontroller so make sure you determine the load current before connecting any device to an Uno pin.

Disclaimer

ProteShea, LLC is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com

Some links may be affiliate links, in which ProteShea, LLC earns a commission if you use that affiliate link. Please note that this is at no additional cost to you and helps us in creating more content.

N-Channel Metal-Oxide Semiconductor Field-Effect Transistor (MOSFET)

A MOSFET can be used for amplifying or switching signals – in this example, we’ll be using it as a switch. It consists of 3 terminals: gate, source, and drain (pinout is below). The N-channel MOSFET is a voltage-controlled device, as opposed to a BJT (Bipolar Junction Transistor) which is current-controlled. There are two types of N-channel MOSFETs: enhancement- and depletion-type. An enhancement type MOSFET is normally off when the gate-source voltage is 0V, so a voltage must be applied to the gate for current to flow through the drain-source channel. A depletion-type MOSFET is normally on when the gate-source voltage is 0V, and thus current flows through the drain-source channel until a positive voltage is applied at the gate. 

Schematic Symbol
N-Channel MOSFET Pinout

The 2N7000 N-channel MOSFET is enhancement-type so we must set the Arduino output pin high to provide power to the DC fan. The maximum current that a MOSFET can source varies, but the one we are using can source 200mA. Some MOSFETs can source up to 30-50A, and as a result, the size increases to be able to handle that amount of current.

Controlling Gate Voltage with Output from Uno

Twin Insight: You’ll want to add a series resistor between the Uno output pin and the Gate of the MOSFET. This will limit the current to the gate since the Uno can only source a max of 40mA and the Gate may try to pull more than that. We recommend using a 220Ω series resistor to limit the current to ~23mA.

Wiring

First, let’s place the N-channel MOSFET onto the breadboard (if using a breadboard instead of Modulus) and make sure that each lead has its own node. Tie the source pin to GND, the gate to Uno pin 2, and the drain to the black wire on the fan. The red wire of the fan gets connected to the positive rail on the breadboard. 

Circuit Schematic

FuelCan Setup

I placed the breadboard in the bottom storage compartment to limit the length of the jumper wires and mounted the Arduino Uno to the FuelCan’s prototyping area. We need to supply +5V and GND to the power and ground rails on the breadboard. Use the provided banana jack to test-lead clip cables to do so. You will need two male header pins to mount the test-lead clips to the breadboard side. Plug the Type A side of the USB cable into the USB1 receptacle and the Type B side into the Uno’s receptacle. Power up the FuelCan with the AC-DC power adapter.

For additional information about the Fuelcan-910, click here or download the user guide.

Software

Once the wiring is complete and the FuelCan is powered up, we can now load the sketch onto the Uno. The sketch is below – it is quite simple compared to the previous projects. All the code does is toggle Uno pin 2 from low to high with a 5 second delay in between. When the pin is high, the fan turns on, and when the pin is low, the fan turns off.

About Author

Eric Shea is the founder of ProteShea and is an electrical engineer. He wishes to have a major impact on bridging the gap between engineering theory and real-world applications. He has worked at Kratos Defense, SpaceX, Air Force Research Laboratory, and Polaris Industries. He received a M.S. in electrical engineering from the University of Pittsburgh and a B.S. in electrical engineering from the University of Florida.

Categories
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on google
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
ProteShea

Learn. Apply. Create.

290 NW Peacock Blvd #880143
Port Saint Lucie, FL 34988