Using IRF520 MOSFET Switch button for Arduino

Project Video
Project Details

This code is for IRF520 MOSFET module to control DC load using arduino without any relay. This device can work with up to 100V and continuously control a 2A load. With proper heat sink it can handle up to 9A but we have tested it up to 4A.

Schematic diagram for IRF520 MOSFET Module

Project Code

 * IRF520 MOSFET Switch module for Arduino
 * Written by Ahmad Shamshiri for
Date modified: Jun 09, 2018 at 18:58 at Ajax, Ontario, Canada
watch video instruction for this code:

#define control 8 // pin that controls the MOSFET

void setup() {
  // IRF520 MOSFET Tutorial by Robojax
  pinMode(control,OUTPUT);// define control pin as output


void loop() {
  // IRF520 MOSFET Tutorial by Robojax

  digitalWrite(control,HIGH); // turn the MOSFET Switch ON
  delay(2000);// Wait for 2000 ms or 2 second

  digitalWrite(control,LOW); // Turn the MOSFET Switch OFF
  delay(2000);// Wait for 2000 ms or 2 second


If you found this Arduino course helpful, please support me so I can continue creating content like this. support me via PayPal