Skip to content
MechStuff

MechStuff

''Making stuff… Simpler''

  • Home
  • MechStuff
  • News
  • How Stuff Works
  • Engines
  • Mech-Tech
  • TechStuff
  • Robotics
    • Robot Stuff
    • Tutorials
  • Engineering Marvels
  • For Mechanical Engineers
    • Games for Mechanical Engineers
    • Movies for Mechanical Engineers
    • Projects for Mechanical engineers
  • Contact Us
  • About us

How to use motor driver L298N – Arduino tutorial

2
motor driver L298N tutorial

Hellloooo people, today we’ll be seeing what is a motor driver module, how to use it and where to use it – its connections and coding. So without wasting time, let’s directly jump to our motor driver L298N Arduino tutorial.

What is motor driver ?

The thing is whatever you do, the Arduino supplies maximum of 5V 1A as output; which is enough to power LEDs or smaller applications but not a motor, a LED strip or our bot! So for applications demanding more current or voltage we need a higher power source as well as a means of control. This is where motor driver comes into play, it lets more power flow through itself by taking commands from the Arduino, simple?

So first things first,

Requirements –

  • Motor driver module L298N
  • 2 9V batteries
  • Arduino Uno/Mega
  • A 50/100/200 rpm motor
  • Jumpers/Wires
  • A slice of Pizza to celebrate 😉

Connections of Motor driver L298N – Arduino tutorial

Connections of motor driver L298N - Arduino tutorial
Connections of Motor driver L298N – Arduino

12V – Battery +ve
GND – Arduino GND, Battery -ve
2 Signal pins – Pin 7 & 8 of Arduino
2 wires from application terminals – motor wires

Code –

void setup() {
  
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  }


void loop() {
  digitalWrite(7, HIGH);   //clockwise rotation
  digitalWrite(8, LOW);
  delay(5000);
  digitalWrite(8, HIGH);   //anticlockwise rotation
  digitalWrite(7, LOW);
  delay(5000);

}

That’s it! Power up your Arduino with your cable or battery and you are good to go. Here is a video tutorial which will make things super easy for you!

Also here is a video tutorial on Obstacle avoiding robot using an ultrasonic sensor and this same motor driver module..! Go try it, what are you waiting for? It’s a mere 10 min job!

Tutorial on obstacle avoiding robot

Also, needless to say, if you face any difficulties, comment down below.. I’ll get to them as fast as I can 😀

Share this Stuff :

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • More
  • Click to email a link to a friend (Opens in new window)
  • Click to print (Opens in new window)

Related

Tutorials

2 comments on “How to use motor driver L298N – Arduino tutorial”

  1. Amit Nikhade says:
    October 31, 2020 at 11:17 AM

    whenever I connect the ENA and ENB pins to the Arduino-L298 motor driver. The motor slows down and stops

    Reply
    1. Jay Baviskar says:
      December 14, 2020 at 10:47 AM

      Hmph.. quite interesting! I need more information what have you done & are you exactly trying to do

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Idealist by NewMediaThemes