Contents

Interfacing IRF520 MOSFET Driver Module (HCMODU0083) with Arduino

Discover how to effectively interface the IRF520 MOSFET Driver Module (HCMODU0083) with Arduino in this step-by-step tutorial. Learn about the key features of this module and explore its applications in controlling DC motors using Pulse Width Modulation (PWM) technique. With the ability to convert a constant input voltage to a variable voltage, this module allows precise control over the speed of your DC motor. Whether you’re a beginner or an experienced Arduino enthusiast, this guide will help you master the art of interfacing the IRF520 MOSFET Driver Module.

IRF520 MOSFET Driver Module Features

This module controls DC motors by PWM (Pulse Width Modulation) technique. These modules convert a constant input voltage to a variable voltage. DC Motor’s speed can also be controlled by changing the voltage across it. PWMs usually have a constant frequency and can control the engine speed by controlling the length of time that the pulse is HIGH (Duty Cycle). Engine speed control modules are very versatile and easy to use.

Note

DC motor’s voltage can be 0 to 24 volts and the maximum current can be up to 5A. In high currents heatsink is required.

You can download the datasheet of this module here.  

IRF520 MOSFET Driver Module Pinout

This sensor has 7 pins:

  • VCC: Module power supply – 5V
  • GND: Ground
  • SIG: PWM input signal
  • Vin: Input voltage 5-24 V
  • OUT: Module output for connecting to motor

You can see the pinout of this module in the image below.

Required Materials

Hardware Components

Arduino UNO R3 × 1
IRF520 MOSFET Driver Module × 1
6V DC Motor × 1
10K Potentiometer × 1
9V Battery × 1
9V Battery Clips with Bare Leads × 1
Male-Female jumper wire × 1
Male-Male jumper wire × 1
400 Tie point Breadboard × 1

Software Apps

Arduino IDE

Interfacing IRF520 MOSFET Driver Module with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to IRF520 sensor. Connect wires accordingly.

Step 2: Code

Upload the following code to Arduino.

/*
  IRF520-MOSFET-Driver
  made on 28 oct 2020
  by Amir Mohammad Shojaee @ Electropeak
  
Home
*/ #define PWM 3 int pot; int out; void setup() { Serial.begin(9600); pinMode(PWM,OUTPUT); } void loop() { pot=analogRead(A0); out=map(pot,0,1023,0,255); analogWrite(PWM,out); }

In this code, by rotating the potentiometer, the value of PWM pin 3 changes from 0 to 5. The voltage of the motor also changes from 0 to 9.
It can be seen that by turning the potentiometer, the motor speed can be controlled.

Warning

Be careful not to fully turn the pententiometer because the motor is a 6 volts DC motor and the input voltage is 9 volts and the motor may be damaged. Of course, you can use a lower voltage battery or a higher voltage motor.

Unlock the Potential of IRF520 MOSFET Driver Module with Arduino

The IRF520 MOSFET Driver Module combined with Arduino opens up a world of possibilities for motor control applications. By leveraging the power of PWM and the ease of Arduino programming, you can achieve precise and efficient control over your DC motors. Experiment with different voltages, explore advanced motor control techniques, and take your Arduino projects to new heights with the IRF520 MOSFET Driver Module.

Liked What You See?​
Get Updates And Learn From The Best​

Comments (4)

  • alen varghese ninan Reply

    can i use node mcu instead of arduino uno with irf540 N mosfet module . If no , can you tell me a better solution for this ?

    January 6, 2023 at 3:43 pm
    • Ali Abdolmaleki Reply

      Hi
      yes. you can use it. this module just need a PWM output for control and drive the motor

      March 1, 2023 at 11:25 am
  • Dana Reply

    How many of these could an Arduino turn on at the same time?

    January 24, 2024 at 1:18 am
    • Mohammad Damirchi Reply

      Hello Dana,
      If you’re using digital mode (non-PWM), the maximum number is determined by the available digital output pins on your microcontroller(any Arduino, ESP or STM). You can also expand the control range by using shift registers.
      For PWM mode (speed control), the maximum number is defined by the available PWM pins on your microcontroller or by using a PWM expander.

      January 24, 2024 at 4:59 am

Leave a Reply

Your email address will not be published. Required fields are marked *