L298N DC Motor driver module with arduino

 L298N DC Motor driver module with Arduino



there are many motor controllers  in this  industry L298N is one of them and it's a very popular and useful motor controller



What is l298n motor driver

when we are developing our robots and automated systems like programmed mechanical systems robot rovers etc. we have to use DC motors when we use DC motors we have to control these motors according to our requirements mainly we need to change the rotation directions and RPM of DC motors


in that situation, we can't control motors connecting with a microcontroller it's not proper and it's not because microcontrollers never can give enough voltage and enough current for DC motors 

Therefore we  have to use a motor controller as an interface between the microcontroller and DC motors

How does L298N motor driver work


👉basically, we can  control a spinning direction changing  negative and positive probes 

also, we can control RPM changing  voltage


👉motor controllers have been made based on the Dual H bridge theory and PWM theory(Pulse Width Modulation)

    

👉we can change the spinning direction using the H bridge theory

     PWM theory uses to control the RPM of the motor

                  Download L298N Motor Driver Datasheet


this is how to work the H bridge theory




what is PWM

we can change the RPM of a motor by changing by input voltage
in digital electronics we input a digital signal to the motor controller then  we can control the RPM of the motor by changing the duty cycle time of the digital signal

when changing the duty cycle time of the digital signal accordingly it changes the output voltage of the motor controller. then we can change the RPM of the motor





Technical specifications of  the L298N motor controller module


  • Max power 25W
  • logic signal input voltage( 0-5 v max 7v )
  •  max motor output voltage( 35v )
  • recommended motor output voltage( 7v - 12v )
  • continues current per channel (2A)

                      

             L298N Motor controller module pinouts




  • VS- this is the main power line  of the motor controller this pin gives power  to the H bridge IC and motors power line   this pin should be connected with the main power source positive terminal(7v -12v recommended voltage/35v max )

  • VSS-this is the power line of the logic IC (5v-7v)
  • GND-this is the common ground line It should be connected to the main power source negative terminal 


logic signal pins


there are four logic pins in the motor controller we can change the motor spinning direction by giving digital inputs to those pins




Enable pins(ENA & ENB)

in order to start rotating the motors, we should digitally pullup these pins as well as that we can stop the motors by pulling down these pins

we can control the  RPM of motors given by the PWM signal to the enable pins




Internal resistance power loss(voltage drop)

there is internal resistance in the motor controller  causing the internal resistance voltage drops to  around 2 volts this is a weakness of the motor controller

 

if we connect 12volts to motor power pins(Vs) , motors will receive 10 volts
it means output  power is less than input power cause of internal resistance





                       5v Enable jumper and 5v regulator





there is an inbuild 5v regulator in the motor controller. when enable jumper is in place (Vs) power supply connecting to the 5v regulator and regulator will turn on 

in this case, we don't need to give an external 5v to the (Vss) pin. cause internal logic IC getting powered by the 5v regulator. as well as that (Vss) pin  work as a power  output pin

we can get 5v and 0.5A from the (Vss) pin 

we can use it to power the Arduino or other modules that require 5v



Circuit Diagram




Click here to get the code