Tutorials

How to use motor driver L298N – Arduino 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

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 ๐Ÿ˜€

Jay Baviskar

View Comments

Recent Posts

Metal Fabrication – A complete guide for Engineering students

Metal fabrication plays a vital role in engineering, transforming metal into functional components of everyday…

5 months ago

CNC Machine Inspection Techniques Based on Blockchain Technology

The pieces being produced in complex machining services frequently have difficult patterns. They may need…

10 months ago

How does a Digital Height Gauge work?

Digital height gauges are precision measuring instruments used to determine the height of an object…

12 months ago

The Advantages of Multi-Cavity Injection Molds

Injection molding is a rapid prototyping and manufacturing process applicable in the mass production of…

1 year ago

What are Industrial Pins? | Types and Applications

Fastening hardware, such as industrial pins, serve various functions in all industries. Butprimarily, you can…

2 years ago

What to Expect from Your First Car Service

Owning and operating a car is one thing, but keeping it running smoothly is another…

2 years ago