Objective: demonstrate use of MOSFET

You will need: ESP8266 on breakout board (or similar), IRLZ44N MOSFET, LED, 10kΩ and 330Ω resistors, patch leads and small breadboard.



This project demonstrates a simple use of a MOSFET to drive an LED. The ESP8266 can drive LEDs without needing to use a MOSFET but where the load on a single pin is more than 20mA or the combined load on all pins is more than 100mA a MOSFET or transistor is needed. You'll also need a MOSFET if you wish to drive a 5V mechanical relay as the current required is about 100mA and more than a single pin can provide.

To use a MOSFET successfully with microcontroller output voltages, you need a logic level MOSFET; these are usually identifiable by an L in the part number, e.g. IRLZ44N or IRL540.

Logic level MOSFETs, such as the IRLZ44N, can be used with ESP8266 projects to switch high currents at voltages higher than 5V. The International Rectifier device will switch 47A at up to 55V, subject to being fitted to a suitable heat-sink and de-rated for its expected operational temperature. Not all IRLZ44Ns have the same specification with regards to current limits so check the corresponding datasheet for details of your device. For the TO-220 package the pins are, from left to right in the diagram above, Gate, Drain, Source.

You will need to connect a 10kΩ pull-down resistor across the gate and source connections, otherwise even small electrostatic voltages on the gate will switch on the MOSFET - just touching the bare wire on the gate is sufficient.

The Gate Threshold Voltage, listed in the electrical characteristics as VGS(th), needs to be exceeded for the device to conduct - for the IRLZ44N it's 2V. However, at 2V the MOSFET is barely on and will only conduct a very small current, perhaps 1µA. You need to refer to the charts in the data sheet to see what current you can switch with what gate voltage. In general, the gate voltage will dictate the current you can switch so for circuits based on 3.3V, you may need to use a logic level converter to boost the gate voltage to 5V if your MOSFET does not switch the current you need.

Link to sketch source code.

MOSFET and LED wiring diagram

Do this with an Arduino or a Raspberry Pi.