arduino tutorials Dual h bridge with arduino
This media file is the property of (make it mech) or used with proper permissions 
If you have any query please contact us

 Motor driver H-bridge l298 with Arduino

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


    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. 

    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. So Instead of going to make a logic using transistors and switches, we preferred these 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.

    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



      L298 Dual H-bridge module introduction:

      l298 Dual H-bridge module is an interfacing module with a microcontroller that can drive 2 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.

      l298 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


          l298 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 h bridge with arduino tutorial
          This media file is the property of (make it mech) or used with proper permissions 
          If you have any query please contact us



            Motor driver controller logic :


            Motor 1Motor 2ABAction to perform
            Low           Low       0         0                 Stop   
            HighLow12V0Clockwise
            LowHigh012VAnti-clockwise
            HighHigh12V12VBrake


            Interfacing l298 module with Arduino:


            Connect your module with Arduino as according to your connection.See the image below for connections;
            how to interface l298n h bridge with arduino
            This media file is the property of (make it mech) or used with proper permissions 
            If you have any query please contact us


            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.

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





            Share To:

            Post A Comment:

            0 comments so far,add yours