The Short Answer: Wire Gauge, Ratings, and Terminal Map
If you are looking up how to wire a mosfet to control a high-current DC load (like a 12V heating element, LED array, or water pump) from a 3.3V microcontroller, here is the exact specification for a standard 15A, 12V DC build:
- MOSFET Pick: IRLZ44N logic-level MOSFET module (Rated for 47A continuous drain current, 55V Vds).
- DC Load Wiring: 12 AWG stranded copper wire (Red for V+, Black for GND).
- AC Mains Wiring (Power Supply Input): 14 AWG stranded copper wire (Black for Line, White for Neutral, Green for Earth Ground).
- Signal Wiring: 22 AWG jumper wires (Blue for PWM Signal, Black for GND, Red for VCC).
Decision Tree: Picking the Right MOSFET for Your Load
Not all MOSFETs are created equal. The wrong choice will result in melted silicon or a microcontroller that fails to trigger the gate. Use this decision matrix to lock in your component:
| Load Profile | MCU Logic Level | Recommended Component |
|---|---|---|
| 12V DC, < 5A | 5V (Arduino Uno/Mega) | IRF520 Module |
| 12V/24V DC, 5A – 30A | 3.3V (ESP32 / Pi Pico) | IRLZ44N Module (Default Pick) |
| > 30A DC or AC Mains | Any | Solid State Relay (SSR-25DA) or Mechanical Contactor |
Default Recommendation: For the vast majority of modern maker projects using an ESP32 and a 12V/24V load under 30A, buy an IRLZ44N breakout module. It is fully enhanced at a 4.5V gate drive, making it perfectly compatible with 3.3V logic.
Tools and Materials List
- Power Supply: Mean Well LRS-350-12 (120V AC to 12V DC, 29A max output)
- Switching Module: IRLZ44N High-Power MOSFET Breakout Board
- Wire (DC): 12 AWG stranded automotive or THHN wire (Red and Black)
- Wire (AC): 14 AWG stranded copper wire (Black, White, Green)
- Wire (Signal): 22 AWG Dupont jumper wires
- Connectors: 12 AWG and 14 AWG bootlace ferrules
- Tools: Ferrule crimping tool, wire strippers, digital multimeter, non-contact voltage tester (NCV)
- Protection: 1N4007 flyback diode (mandatory if switching inductive loads like motors or solenoids)
Mains Safety and Power Supply Wiring (AC Side)
This build requires wiring 120V AC mains to an open-frame switching power supply. Before touching any AC terminals, turn off the branch circuit breaker at your main panel. Apply a lockout/tagout if possible, and verify the wires are dead using a non-contact voltage tester and a multimeter set to AC voltage. Never assume a wire is safe based on the wall switch position. If you are not comfortable with mains wiring, hire a licensed electrician to install a dedicated 120V outlet and use an IEC C13 plug-in cable instead of hardwiring the PSU.
Once the circuit is verified dead, prepare your 14 AWG AC wires by stripping 10mm of insulation and crimping a 14 AWG ferrule on each end. This prevents stray strands from bridging the tightly spaced PSU terminals.
- Land the 14 AWG Green wire onto the PSU terminal labeled
FG(Frame Ground) and tighten the screw to 1.2 Nm. - Land the 14 AWG White wire onto the PSU terminal labeled
N(Neutral). - Land the 14 AWG Black wire onto the PSU terminal labeled
L(Line/Hot). - Double-check that no bare copper is exposed outside the plastic terminal shrouds.
Wiring the MOSFET Module and DC Load (Step-by-Step)
Now we move to the low-voltage DC side. Strip 10mm of your 12 AWG wire and crimp 12 AWG ferrules. The ESP32 GPIO pins can only source about 40mA, which is plenty to charge the MOSFET gate capacitor via the module's opto-isolator, but we must keep the signal wires light (22 AWG).
- Land a 12 AWG Red wire from the PSU
V+terminal to the MOSFET moduleVIN(orP+) screw terminal. - Land a 12 AWG Black wire from the PSU
V-terminal to the MOSFET moduleGND(orP-) screw terminal. - Run a 12 AWG Red wire from the MOSFET module
OUT+terminal directly to your Load's Positive input. - Run a 12 AWG Black wire from the MOSFET module
OUT-terminal directly to your Load's Negative input. - Connect a 22 AWG Blue jumper wire from your ESP32
GPIO 13(or any PWM-capable pin) to the module'sSIGheader pin. - Connect a 22 AWG Black jumper wire from the ESP32
GNDpin to the module'sGNDheader pin. - Connect a 22 AWG Red jumper wire from the ESP32
3V3pin to the module'sVCCheader pin to power the onboard opto-isolator LED.
If your load is inductive (a DC motor, solenoid valve, or relay coil), you must solder a 1N4007 flyback diode across the load terminals, with the diode's silver stripe (cathode) pointing toward the positive Red wire. When the MOSFET switches off, the collapsing magnetic field generates a high-voltage reverse spike that will punch through the MOSFET's drain-source junction and destroy it instantly. The diode recirculates this spike safely back into the coil.
Verify and Test: Expected Multimeter Readings
Do not power the load until you have verified the circuit with a multimeter. Set your meter to DC Volts and place the Black probe on the Load's Negative terminal and the Red probe on the Load's Positive terminal.
- Signal LOW (ESP32 GPIO output 0): Expected reading is 0.0V to 0.2V. The MOSFET is blocking current.
- Signal HIGH (ESP32 GPIO output 1 / PWM 100%): Expected reading is 11.8V to 12.0V. The MOSFET is fully enhanced and passing current with minimal voltage drop.
- Earth Ground Continuity: Set meter to Continuity/Ohms. Place one probe on the PSU metal chassis and the other on the Green wire's source. Expected reading is < 1.0 Ω.
If your HIGH reading is hovering around 7V or 8V and the MOSFET heatsink is too hot to touch, immediately disconnect power and read the next section.
The Most Common Botch (and How to Fix It)
The single most frequent mistake makers make when learning how to wire a mosfet is using a standard IRF520 module with a 3.3V microcontroller like the ESP32 or Raspberry Pi Pico.
The Symptom: You send a HIGH signal from your ESP32, but the load only receives 7V instead of 12V. The MOSFET module's heatsink gets incredibly hot within seconds, and your PWM dimming or speed control feels sluggish and non-linear.
The Physics: The IRF520 is not a logic-level MOSFET. While its gate threshold voltage (Vgs(th)) might be listed as 2.0V to 4.0V, that is merely the voltage at which it begins to barely conduct a tiny leakage current. To achieve its rated low on-resistance (Rds(on)) and pass high current efficiently, the IRF520 requires 10V on the gate. When you feed it 3.3V from an ESP32, the MOSFET operates in its linear (resistive) region. It acts like a massive resistor, dropping 5V across its own silicon and dissipating that energy as heat, while starving your load of voltage.
The Fix: Swap the IRF520 module for an IRLZ44N module. The "L" in the part number designates it as a logic-level device. The IRLZ44N datasheet guarantees a very low Rds(on) at a gate drive of just 4.5V, meaning it will turn on completely, stay cool, and deliver the full 12V to your load when driven by a 3.3V ESP32 GPIO pin. Never rely on Vgs(th) to pick a switching MOSFET; always look at the Rds(on) test conditions in the datasheet.






