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
Software Apps
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.