Interfacing IRF520 MOSFET Driver Module (HCMODU0083) with Arduino

Table of Contents

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.


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.

  made on 28 oct 2020
  by Amir Mohammad Shojaee @ Electropeak
*/ #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.


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.

Liked What you see?

Get updates and learn from the best

More To Explore

Leave a Reply

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