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

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.

See Also:

How to use L293d Module motor shield with Arduino

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

Wireless remote control robot using nrf and arduino


  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

01Why 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.

02Types 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.

03Applications 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

04L298N 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.

05l298N 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

06L298N 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 module


07Motor 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

08L298N 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.

l298n motor driver connection with arduino

arduino h bridge code

09Arduino 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)
digitalWrite(motor11, HIGH);  //Motor 1 drives forward
digitalWrite(motor12, LOW);
digitalWrite(motor21, HIGH);  //Motor 2 drives forward
digitalWrite(motor22, LOW);
digitalWrite(motor11, HIGH); //motor 1 stops
digitalWrite(motor12, HIGH);
digitalWrite(motor21, HIGH); motor 2 stops


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.


Mechatronics Engineer-Solution Architect-Entrepreneur. Being Average isn't a choice.Keep working-Stay motivated & always have faith on yourself.

Related Articles

Leave a Reply

Back to top button