Make it mech
  • Home
  • How & Why
    • Arduino
    • Leapmotion with arduino
    • Sensors/Modules
    • Basic Electronics
    • NodeMcu
    • LabView
    • MATLAB
    • Industrial Automation
  • Projects
    • arduino projects
    • Brain Wave Decoder
    • Circuit Diagrams
    • Electrical
    • IEE Projects
  • Ideas
  • Videos
  • Arduino
  • Robotics
  • Circuits
  • Electrical
  • LeapMotion
  • EEG
  • IOT
  • LabView
  • MATLAB
  • NodeMcu
  • Mechatronics
  • Sensors
  • Motivation
  • Soft skills
  • Success
Make it mech
Home Arduino

How & why to use L298N Module | l298n motor driver connection with arduino

Kane Dan by Kane Dan
September 3, 2021
in Arduino, Mechatronics, Sensors/Modules
How & why to use L298N Module | l298n motor driver connection with arduino

Related posts

Top 10 Arduino Based Projects For Final Year Students | Arduino project ideas

Top 10 Arduino Based Projects For Final Year Students | Arduino project ideas

May 10, 2021
How to use L293d Module motor shield with Arduino

How to use L293d Module motor shield with Arduino

January 30, 2021
L298N motor driver connection with Arduino and why we use motor drivers. This is the quick tutorial about dual H-bridge motor driver module. We will discuss how Arduino dc motor speed control using PWM works.
The Arduino h bridge code and for the connection of Arduino with motor driver l298n circuit diagram. How we can interface h bridge module with Arduino and the h bridge circuit Arduino. This is the Arduino beginners tutorial about l298n motor driver connection with Arduino.

01: Contents:


  1. Why use the motor driver?
  2. Types of motor drivers
  3. Applications of motor driver
  4. L298N Dual h-bridge module introduction
  5. l298N dual H-bridge specifications
  6. L298N dual H-bridge pin configuration
  7. Motor driver controller logic
  8. Interfacing L298N module with Arduino

Motor driver H-bridge l298 with Arduino


01: Why use the motor driver?:


As its name shows that a driver so it can drive not just a motor but also some other applications. The motors can not run on lower current so we need a higher current that current is generated by the motor driver.

The question here is why we use a specific driver for controlling our motor. We can not connect our motors directly to the controller board it can cause a damage to the board. Any microcontroller including Arduino can draw a very little amount of current so we can not drive our motors with this less amount of current. There is always a bridging network required between interfacing with microcontrollers. It is used for Arduino dc motor speed control using PWM.

02: Types of Motor Drivers:


There are many different motor drivers available. And if we talk about IC’s the two most common ic’s are (l293d, l298). we can make a circuit using these two IC’s. We can also make motor drivers using Transistors and switches logic.

But making the motor driver circuit using transistors and switches could be less efficient. So just to avoid some messy work or we can say any sort of extra work we use the ready made IC’s. There is no need to explain the core concept of using H-bridges in depth here. Other than Linear integrated IC  the other types are bipolar stepper motor driver, H-bridge motor driver the servo motor driver and the DC motor driver and brushless motor driver.


03: Applications of the Motor driver:


Some are the applications of motor drivers are:
  • DC motor controlling
  • Relay and solenoid switching
  • Stepping motor
  • LED and bulb displays
  • Automotive applications
  • Audio-visual equipment
  • Car audios
  • Navigation systems
  • Robotics

04: L298N Dual h-bridge module introduction:


We can drive two motors using this module. As its name suggests Dual H-bridge there are 2 outputs for motors. This module is developed using l298 IC. So we can use it for driving DC motors or other motors and can be easily used for robotics purposes etc.

See below the sources portion for Pinout configuration of the Dual H-Bridge L298N module and l298n motor driver connection with Arduino.


05: l298N dual H-bridge specifications:


  • The supply area Vs: 7V to 35V
  • Source 5V from the board can also be used.
  • The peak current of driven part Io: 2A
  • Maximum power consumption: 20W (when the temperature T = 75 °C)
  • Dimensions: 43 x 43 x 26mm
  • Weight: 26g

06: L298N dual H-bridge pin configuration:


  • Motor 1 out
  • Motor 2 out
  • 5v: The 5v input pin
  • En1: (The Enables PWM signal pin for driving speed of Motor 1)
  • En2:  (The Enables PWM signal pin for driving speed of Motor 2)
  • 5V Enable pin: not necessary if we are using a supply voltage 12V DC or greater. Just remove the jack.

l298n

 


07: Motor driver controller logic:


Motor 1 Motor 2 A B Action to perform
Low Low 0 0 Stop
High Low 12V 0 Clockwise
Low High 0 12V Anti-clockwise
High High 12V 12V Brake

l298n motor driver connection with Arduino


08: L298N circuit diagram:


Connect your module with Arduino as according to your connection. See the image below for l298n motor driver connection with Arduino.

Now open the Arduino software and program according to the logic.
Define motors pins and remember to connect enable pins of the motor only with PWM pins on Arduino.
Power the module using any external supply. A 12-volt battery.

Run and vary the speed of motors by changing the values of enable pins. It is Arduino dc motor speed control using PWM.

l298 pinout with arduino

Arduino h bridge code


09: Arduino H bridge code:


Here is the Arduino h bridge code. Open Arduino software and run the Arduino h bridge code and test your l298n motor driver connection with Arduino.
int m1e = 3;
int motor11 = A2;
int motor12 =A3;
int motor2e = 5;
int motor21 = A4;
int motor22 = A5;
void setup(void)
{
pinMode(motor1e, OUTPUT);
pinMode(motor11, OUTPUT);
pinMode(motor12, OUTPUT);
pinMode(motor2e, OUTPUT);
pinMode(motor21, OUTPUT);
pinMode(motor22, OUTPUT);
}
void loop(void)
{
analogWrite(motor1e,250);
digitalWrite(motor11, HIGH);  //Motor 1 drives forward
digitalWrite(motor12, LOW);
analogWrite(motor2e,250);
digitalWrite(motor21, HIGH);  //Motor 2 drives forward
digitalWrite(motor22, LOW);
delay(1000);
analogWrite(motor1e,0);
digitalWrite(motor11, HIGH); //motor 1 stops
digitalWrite(motor12, HIGH);
analogWrite(motor2e,0);
digitalWrite(motor21, HIGH); motor 2 stops
digitalWrite(motor22,HIGH);
}

 

This is the example Arduino h bridge code you can run and test your module and control the speed of motor as Arduino dc motor speed control using PWM. You can also make a function of (forward-back-reverse and so on).I hope you understand the concept.
This was the quick tutorial about l298n motor driver connection with Arduino and Arduino h bridge code. Subscribe to our YouTube channel Make it mech for video tutorials and ideas. Stay motivated and always have faith on yourself.
Tags: l2989n
Previous Post

How & Why to use Arduino | How to program an arduino

Next Post

How to use Labview and Arduino | linx labview installation

Related Posts

Top 10 Arduino Based Projects For Final Year Students | Arduino project ideas
Arduino

Top 10 Arduino Based Projects For Final Year Students | Arduino project ideas

May 10, 2021
How to use L293d Module motor shield with Arduino
Arduino

How to use L293d Module motor shield with Arduino

January 30, 2021
How to Use IR Sensor module with Arduino | How Arduino IR obstacle detector module works
Arduino

How to Use IR Sensor module with Arduino | How Arduino IR obstacle detector module works

January 30, 2021
How to Use Ultrasonic Sensor SR04 with arduino and How ultrasonic sensor works
Arduino

How to Use Ultrasonic Sensor SR04 with arduino and How ultrasonic sensor works

January 30, 2021
How to use LM35 Temperature Sensor with Arduino | arduino tutorials
Arduino

How to use LM35 Temperature Sensor with Arduino | arduino tutorials

January 30, 2021
What is Leap Motion Controller and How does Leap Motion Works
Arduino

What is Leap Motion Controller and How does Leap Motion Works

September 8, 2021
Next Post
labview install

How to use Labview and Arduino | linx labview installation

BROWSE BY CATEGORIES

  • Arduino (9)
  • arduino projects (7)
  • Basic Electronics (2)
  • Brain Wave Decoder (11)
  • Breadboard Circuits (1)
  • Circuit Diagrams (5)
  • Circuits (3)
  • EEG (11)
  • Electrical (2)
  • How & Why (1)
  • Ideas (9)
  • IEE Projects (2)
  • Industrial Automation (1)
  • Inspiration & Motivation (3)
  • IOT (3)
  • LabView (3)
  • Leapmotion with arduino (5)
  • MATLAB (1)
  • Mechatronics (7)
  • NodeMcu (1)
  • Projects (11)
  • Robotics (9)
  • Self Learning (3)
  • Sensors/Modules (6)
  • Soft skills (2)
  • Success (2)

Contact us

Email: marketing[at]shantelllc.com

Recent News

  • How & Why to Use DC Motors | How DC Motor Works
  • 220v AC to 12v DC Power Supply Step by Step Project
  • Battery Level Indicator Circuit With Low Charge Alarm | Inverter Battery Circuit
  • Privacy Policy
  • About Us
  • Contact Us

© 2023 Make it mech - All Rights Reserved

No Result
View All Result
  • Home
  • Politics
  • News
  • Business
  • Culture
  • National
  • Sports
  • Lifestyle
  • Travel
  • Opinion

© 2023 Make it mech - All Rights Reserved

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Go to mobile version