Oh boy, was I confused about this module at first! I found a fair amount of bits and pieces about it, but could not find the complete info that I was looking for. So I decided to create this tutorial for others who want to understand it better. I’m not an expert, but I have figured it out well enough to make what I think is a very clear and complete basic ‘primer’ on this device. Whether it’s right for your project is up to you to determine, but here’s info about the module itself, and especially about the mysterious jumpers (at least they were the biggest mystery to me).
What is it?
This module is a very inexpensive and convenient package based on the L298 dual full-bridge rectifier chip made by ST Microelectronics. It can be used to drive speed and direction for one servo or two standard DC motors, and drive other inductive loads like relays and solenoids. It can be controlled by microcontrollers like the Arduino.
Here is the description of the chip (not the module) from ST: The L298 is an integrated monolithic circuit in a 15-lead Multiwatt and PowerSO20 packages. It is a high voltage, high current dual full-bridge driver designed to accept standard TTL logic levels and drive inductive loads such as relays, solenoids, DC and stepping motors.
You can see the data sheet on their website here: http://www.st.com/en/motor-drivers/l298.html .
You could just purchase the chip and component parts and wire up your own parts, but this complete module is probably cheaper than the combined parts, and it’s certainly more convenient. As of January, 2017, the modules are selling on ebay for under $2.00! At this price they’re from China of course, but you can purchase them at higher prices in the United States if you can’t wait for the long shipping times from China.
I’ve read in forums that the L298 chip is about 15 or 20 years old, so there are better(?) chips available now. People seem to like the Pololu A4988 https://www.pololu.com/product/1182 . Stepper motor current limiting is apparently one of the big improvements, but none of the current-limiting chips come in this neat module format that I’m aware of. So this L298N module is fun and handy, certainly great for testing and little projects, but be careful if you need current-limiting features when driving stepper motors.
How to use it
If you buy from the auctions on Ebay you get the typical Chinese-translated-to-English descriptions that are neither complete nor understandable. And searching for other resources on the internet or YouTube results in some great information, I was not able to find any one source that was all-inclusive like I’m hoping this one is (for a basic primer anyway).
So here’s how you use this little beauty to control the speed and direction of a simple dc motor.
You can use only this module and a power supply to control the motor direction and have it run at either full speed or stop completely. You need a micro controller like an Arduino if you want to control the speed of your motor anywhere between full speed and off. I’ll assume you are familiar with an Arduino. If not, you’ll need to learn that first.
Powering the module —
It runs on from 5 to 35V. That means you can run your motors, servos, or other objects anywhere in that range. Click the photo for a larger version.
The module itself needs 5V for its internal logic and can generate the 5V through its own regulator if you input from 7 to 12V. If you run your motors under 7V or over 12V, the internal regulator will not function and you will need to apply your own external 5V to the module.
There is a jumper that applies your input voltage to the internal 5V regulator on the module. You must not use that jumper if you input less than 7V or more than 12V. Less than 7V and the regulator can’t do its thing to create a regulated 5V. More than 12V and you will burn out the 5V regulator.
A red LED will light when the internal 5V is active.
So you use PWM (pulse width modulation) to control the speed of the motor, and two ‘enable’ pins to control the direction.
…More coming soon…