Arduino Mechatronics Sensors/Modules

Motor drivers and Dual H-bridge l298 arduino module interfacing

Motor driver H-bridge l298 with 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

Step: 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.

Step: 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.

Step: 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

Step: 04L298 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.

Step: 05l298 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

Step: 06l298 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 arduino pinout

Step: 07Motor driver controller logic

Motor 1Motor 2ABAction to perform

Step: 08Interfacing l298 module with Arduino

Connect your module with Arduino as according to your connection.See the image below for connections;
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.

Step: 09Arduino Code

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 code you can run and test your module and control the speed of can also make a function of (forward-back-reverse and so on).I hope you understand the concept.

About the author



Mechatronics Engineer - Solution Architect - Entrepreneur
Crazy about traveling & Writing - Being Average isn't a choice.Be happy & always have faith on yourself.

1 Comment

Click here to post a comment
Thanks for submitting your comment!