INTERFACE L298N MOTOR DRIVER MODULE WITH ARDUINO UNO
In this tutorial, we will know about L298N motor driver module . What is e? l298n motor driver modul Why use l298n motor driver module? and learn how to interface motor driver module with Arduino board?. If you want to build a robot then you must definitely know the l298n motor driver module.
It is a two common technique for controlling speed and rotation direction of dc motor.
1.PWM(Pulse Width Modulation)
PWM:- Speed control of dc motor can be done with PWM technique. While the average voltage of the operating voltage of dc motor is adjusted with sending series of ON-OFF pulses. The average voltage of prepositional to the width of pulses knows as duty cycle.
When duty cycle is higher then the speed of dc motor is higher. And when duty cycle is lower then the speed of dc motor is lower. In this way control the speed of dc motor with PWM technique.
H-bridge can be control spinning rotation direction of dc motor. It can be changed the polarity of it’s input voltage. H-bridge circuit have four mosfet or transistor as switches with motor this like arrangement H type.
When logic gate switch 1 and logic gate switch 4 will on and switch 2 and switch 3 will OFF at the same time ,then the current will flow left to right side of dc motor so dc motor will run forward direction.
When logic gate switch 1 and logic gate switch 4 will OFF and switch 2 and switch 3 will ON at the same time ,then the current will flow right to left side of dc motor so dc motor will run reverse direction.
What is L298N motor driver module ?
L298N motor driver is a high power dc motor driver module for control dc motor and stepper motor. It has single dual H-bridge channel ic and 78M05 5v regulator ic in module. This module have two output terminals for control two dc motors or 4 dc motors . That is why this module can capable two dc motors separately with direction and speed control of dc motor.
Pin Out of the L298N motor driver module
L298N motor driver chip — L298N motor driver ic is high power dc motor control dual H-bridge channel. It’s means you can control 2 dc motor or 4 dc motor with spinning direction and speed control of dc motor separately.
- It is a external input dc power supply for operate dc motor.
- It is 5V dc power supply for activate logic gate circuit inside the L298n ic.
- You can enable or disable logic gate circuit of dual H-bridge logic gate circuit of l298n ic by the 5v jumper pin. When 5v jumper pin placed, then the 5v supply provide for activate logic gate circuit. And when 5v jumper pin removed , then 5v supply is not provide for activate logic gate circuit.
GND — Ground pin is common pin.
- IN1, IN2 and IN3, IN4 are input pins to control direction of two dc motor A and dc motor B.
- Enable A pin is used to PWM signal for speed control of dc motor A. Enable B pin is used to PWM signal for speed control of dc motor B.
- It has a dual H- bridge channel IC.
- It can working voltage 5V to 35V dc.
- It can capable 46V operating voltage for dc motor.
- It can be controlled 2A amp for driver current.
- It can control maximum power 25 watt.
Application:-
How does it work ?
We known that l298n motor driver is dual H- bridge channel module. This module can control the two dc motor with direction and speed of dc motor separately. There are 4 inputs pins IN1, IN2 and IN3, IN4 for spinning direction control of dc motor A and dc motor B. And there are 2 enable pins ENA and ENB for speed control of dc motor A and dc motor B. All inputs pins in1, in2 and in3, in4 are connected to digital pins of micro controller. When micro controller high signal provided to in1 pin and low signal provided to in2 and high signal provided to in3 and low signal provided to in4 of l298n motor driver module. Then motor A and Motor B is run forward direction. And when micro controller low signal provided to all inputs pin in1, in2 & in3, in4 then motor A and motor B is stopped.
IN1 IN2 IN3 IN4 DIRECTION
0 0 0 0 Stop
1 0 1 0 Forward
0 1 0 1 Reverse
1 0 0 1 Left
0 1 1 0 Right
Component required:-
Schematics diagram:-
It,s a schematics of l298n motor driver with Arduino Uno. How we have connected digital input pins of l298n motor driver module with digital pins of Arduino.Shown in below.
Circuit Diagram:-
This is a circuit diagram of l298n motor driver with Arduino uno board. That’s connection is very simple.Firstly we have connected Vcc pin of l298n driver module to 12v battery and gnd pin of l298n motor driver module is connected to all gnd pin of 12v battery and Arduino uno. 5v pin of l298n motor driver module is connected to Vin pin (input voltage pin) of Arduino uno. Here we have connected pair of dc motor in pair of dc motor output pins of l298n motor driver module. And ENA (enable pin) is connected to D7 of Arduino and IN1 and IN2 (input pin) are connected to D6 and D5 of Arduino. And also ENB (enable pin) is connected to D2 of Arduino and IN3 and IN4 (input pin) are connected to D3 and D4 of Arduino.
Interface l298n motor driver module with Arduino uno
L298N — Arduino Uno
12V — From the 12v battery
//Motor A and Motor B will rotated forward direction
//Motor A and Motor B will rotated reverse direction
//Turn ON both motor A and motor B
//Increasing 0 speed to maximum speed
//Decreasing maximum speed to 0 speed
//Stop both motor A and motor B