The L298N Dual H-Bridge Motor Controller is a device which allows you to control two independent DC motors using 5V digital logic signals, such as the digital output pins of an Arduino. The L298N can also be used to control a single stepper motor or two sets of LED lighting strips.
In this tutorial, we’ll learn how to control two 6-volt DC motors with the L298N.
First, we will enlighten ourselves by learning a bit of the history of DC motors and discovering how they actually work. We will also learn what an “H-Bridge” is, how it works and how we can control the direction of rotation of a DC motor with it.
We will also discuss the concept of Pulse Width Modulation, or PWM, as it is used to control the speed of DC motors.
Then we will look at how the L288N H-Bridge module actually works, how to hook it up to a couple of motors and how to power it correctly.
Next, we will connect the L298N Dual H-Bridge Motor Controller to an Arduino. Once that’s done we’ll run a motor demo sketch to put the device through its paces.
After the demo, we will expand upon our sketch to allow a couple of potentiometers (connected to the Arduino’s analog inputs) to control the speed of each motor.
And lastly, we will replace the potentiometers with a joystick and use it to control the motors. And by using this setup, we will build an Arduino-driven car!