/ Wednesday, 15 February 2017 / No comments / , ,

Motor drivers and Dual H-bridge l298 arduino modules interfacing

                Motor driver H-bridge l298 with arduino



Contents:            


  • Why to use motor driver ? 
  • Types of motor drivers
  • Applications of motor driver
  • L298N Dual h-bridge module introduction     
  • l298N dual H-bridge specifications
  • L298N dual H-bridge pin configuration
  • Motor driver controller logic 
  • Interfacing l298N module with arduino


    Why to use motor driver ?

    As its name shows that a driver so it can drive not just a motor but also some other applications.A motor driver is a current amplifier; the function of motor drivers is to take a low-current control signal and then turn it into a higher-current signal that can drive a motor.
    The question here is about 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 micro-controller including Arduino can draw a very little amount of current so  we can not drive our motors with this less amount of current.Secondly there is always a bridging network required between interfacing with micro-controllers. 

    Types of motor drivers:

    There are many different motor drivers available.if we talk about ic's two most common ic's are l293d and l298. we can make a circuit using these two ic's. Instead of going to make a logic using transistors and switches we preffered 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, servo motor driver, DC motor driver, and  bushless motor driver .

    Applications of 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 microcontroller that can drive 2 motors.The module is developed using l298 IC.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 ~ 35V
      • Source 5V from the boardcan 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: 

          • Out A: Motor A lead out
          • Out B: Motor B lead out
          • 5v: 5v input (unnecessary if your power source is 7v-35v, if the power source is 7v-35v then it can act as a 5v out)
          • EnA: Enables PWM signal for Motor A
          • EnB: Enables PWM signal for Motor B
          • 5V Enable : remove this if using a supply voltage greater than 12V DC

            Motor driver controller logic :


            M1M2ABMotion
            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;


            Now open the arduino software and programm according to the logic.
            Define your motors pins and remember connect enable pins of motor only with pwm pins on arduino.
            Power your module using any external supply,a 12 volt battery.
            Run the sketch and vary the speed of motors by changing the values of enable pins.

            Arduino Code:


            int m1e = 3;
            int m11 = A2;
            int m12 =A3;

            int m2e = 5;
            int m21 = A4;
            int m22 = A5; 

            void setup(void)
            {

            pinMode(m1e, OUTPUT);
            pinMode(m11, OUTPUT);
            pinMode(m12, OUTPUT);

            pinMode(m2e, OUTPUT);
            pinMode(m21, OUTPUT);
            pinMode(m22, OUTPUT);
            }

            void loop(void)
            {
            analogWrite(m1e,250);
              digitalWrite(m11, HIGH);  //Motor 1 drives forward
              digitalWrite(m12, LOW);

              analogWrite(m2e,250);
             digitalWrite(m21, HIGH);  //Motor 2 drives forward 
              digitalWrite(m22, LOW);
            delay(1000);
            analogWrite(m1e,0);
              digitalWrite(m11, HIGH); //motor 1 stops
              digitalWrite(m12, HIGH);

              analogWrite(m2e,0);
             digitalWrite(m21, HIGH); motor 2 stops
              digitalWrite(m22,HIGH);
            }

            This is the example code you can run and test you 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 This Post :
            Tags : , ,
            Related Posts

            No comments:

            Post a Comment

            Social Media

            Popular Posts