Stufin
Home Quick Cart Profile

L298N Motor Driver IC

Buy Now on Stufin

Component Name

L298N Motor Driver IC

Overview

The L298N Motor Driver IC is a dual full-bridge driver designed to control the speed and direction of two DC motors. It is a widely used and popular component in robotics, automation, and other applications that require motor control. The L298N is a high-current, high-voltage driver that can handle up to 2A of current per channel, making it suitable for medium to large-sized motors.

Functionality

The L298N Motor Driver IC is primarily used to control the speed and direction of two DC motors. It can be used to

Control the speed of two DC motors independently

Change the direction of rotation of two DC motors

Brake or coast two DC motors

Drive stepper motors (with proper control circuitry)

The L298N takes input signals from a microcontroller or other control device and outputs a high-current, high-voltage signal to the motors. The IC includes onboard voltage regulators, short-circuit protection, and overtemperature protection, making it a reliable and safe choice for motor control applications.

Key Features

Dual Full-Bridge DriverThe L298N can control two DC motors independently, allowing for precise control over speed and direction.
High-Current CapabilityThe IC can handle up to 2A of current per channel, making it suitable for medium to large-sized motors.
High-Voltage CapabilityThe L298N can operate at input voltages up to 24V, making it suitable for high-voltage motor applications.

Onboard Voltage Regulators

The IC includes onboard voltage regulators, which provide a stable 5V output for use with microcontrollers or other devices.

Short-Circuit ProtectionThe L298N includes short-circuit protection, which prevents damage to the IC in the event of a motor short-circuit.

Overtemperature Protection

The IC includes overtemperature protection, which prevents damage to the IC in the event of overheating.

Enable Inputs

The L298N includes enable inputs, which allow the user to enable or disable the motor driver outputs.

Logic Inputs

The IC includes logic inputs, which allow the user to control the motor direction and speed.

Pinout and Logic

The L298N has a 15-pin package, with the following pinout

VCC

Input voltage (up to 24V)

GND

Ground

Enable1Enable input for motor 1
IN1Logic input for motor 1 direction
IN2Logic input for motor 1 speed
OUT1Output for motor 1
OUT2Output for motor 1
Enable2Enable input for motor 2
IN3Logic input for motor 2 direction
IN4Logic input for motor 2 speed
OUT3Output for motor 2
OUT4Output for motor 2
5V5V regulated output

The L298N uses a simple logic input scheme, where the direction and speed of each motor are controlled by the IN1-IN4 inputs. The enable inputs (Enable1 and Enable2) allow the user to enable or disable the motor driver outputs.

Applications

The L298N Motor Driver IC is commonly used in

Robotics

Automation

CNC machines

3D printers

Motorized systems

Conclusion

The L298N Motor Driver IC is a versatile and reliable component for controlling the speed and direction of two DC motors. Its high-current capability, high-voltage capability, and onboard voltage regulators make it a popular choice for a wide range of applications.

Pin Configuration

  • L298N Motor Driver IC Documentation
  • The L298N Motor Driver IC is a high-power, dual full-bridge driver designed to drive inductive loads such as DC motors, relays, and solenoids. It has a built-in overcurrent protection and thermal shutdown feature, making it a reliable choice for various IoT and robotics applications.
  • Pin Description:
  • The L298N Motor Driver IC has a total of 16 pins, which are divided into two sections: the control logic section and the power driver section.
  • Control Logic Section (Pins 1-8):
  • 1. ENABLE A (ENA): Enables or disables the motor A. When set to logic high (VCC), the motor A is enabled. When set to logic low (GND), the motor A is disabled.
  • 2. INPUT 1 (IN1): Controls the direction of motor A. When set to logic high (VCC), the motor A rotates in one direction. When set to logic low (GND), the motor A rotates in the opposite direction.
  • 3. INPUT 2 (IN2): Controls the direction of motor A. When set to logic high (VCC), the motor A rotates in one direction. When set to logic low (GND), the motor A rotates in the opposite direction.
  • 4. ENABLE B (ENB): Enables or disables the motor B. When set to logic high (VCC), the motor B is enabled. When set to logic low (GND), the motor B is disabled.
  • 5. INPUT 3 (IN3): Controls the direction of motor B. When set to logic high (VCC), the motor B rotates in one direction. When set to logic low (GND), the motor B rotates in the opposite direction.
  • 6. INPUT 4 (IN4): Controls the direction of motor B. When set to logic high (VCC), the motor B rotates in one direction. When set to logic low (GND), the motor B rotates in the opposite direction.
  • 7. SENSE A (SA): Sense output for motor A, used to detect overcurrent conditions.
  • 8. SENSE B (SB): Sense output for motor B, used to detect overcurrent conditions.
  • Power Driver Section (Pins 9-16):
  • 9. VCC: Power supply input for the internal logic circuitry.
  • 10. V Motor A (VA): Power supply input for motor A.
  • 11. Motor A Output 1 (OUT1): Output pin for motor A, connected to one terminal of the motor.
  • 12. Motor A Output 2 (OUT2): Output pin for motor A, connected to the other terminal of the motor.
  • 13. V Motor B (VB): Power supply input for motor B.
  • 14. Motor B Output 1 (OUT3): Output pin for motor B, connected to one terminal of the motor.
  • 15. Motor B Output 2 (OUT4): Output pin for motor B, connected to the other terminal of the motor.
  • 16. GND: Ground connection for the internal logic circuitry and power driver.
  • Connection Structure:
  • To connect the L298N Motor Driver IC, follow these steps:
  • 1. Connect the VCC pin (9) to a suitable power supply (typically 5V) for the internal logic circuitry.
  • 2. Connect the V Motor A (VA) pin (10) and V Motor B (VB) pin (13) to a suitable power supply (typically 6-24V) for the motors.
  • 3. Connect the motor A to the OUT1 (11) and OUT2 (12) pins.
  • 4. Connect the motor B to the OUT3 (14) and OUT4 (15) pins.
  • 5. Connect the ENABLE A (ENA) pin (1) and ENABLE B (ENB) pin (4) to the control logic (e.g., microcontroller) to enable or disable the motors.
  • 6. Connect the INPUT 1 (IN1) pin (2) and INPUT 2 (IN2) pin (3) to the control logic to control the direction of motor A.
  • 7. Connect the INPUT 3 (IN3) pin (5) and INPUT 4 (IN4) pin (6) to the control logic to control the direction of motor B.
  • 8. Connect the SENSE A (SA) pin (7) and SENSE B (SB) pin (8) to the control logic to detect overcurrent conditions.
  • Important Notes:
  • Make sure to use a suitable heat sink for the L298N Motor Driver IC to prevent overheating.
  • Use decoupling capacitors between the power supply pins and the GND pin to reduce noise and prevent voltage spikes.
  • Always follow proper safety precautions when working with high-power motor applications.
  • By following this documentation, you can successfully connect and use the L298N Motor Driver IC in your IoT or robotics projects.

Code Examples

L298N Motor Driver IC Documentation
Overview
The L298N Motor Driver IC is a high-power, dual H-bridge motor driver capable of driving two DC motors or one stepper motor. It's widely used in robotics, automation, and IoT projects. This documentation provides an overview of the component, pinouts, and code examples to get you started.
Pinouts
The L298N Motor Driver IC has a 15-pin package with the following pinouts:
VCC (Pin 1): Positive supply voltage (5V-24V)
 Input 1 (Pin 2): Input pin for Motor A
 Input 2 (Pin 3): Input pin for Motor A
 Enable 1 (Pin 4): Enable pin for Motor A
 Input 3 (Pin 5): Input pin for Motor B
 Input 4 (Pin 6): Input pin for Motor B
 Enable 2 (Pin 7): Enable pin for Motor B
 Sense A (Pin 8): Sense pin for Motor A
 Sense B (Pin 9): Sense pin for Motor B
 GND (Pin 10): Ground
 VCC (Pin 11): Positive supply voltage (5V-24V)
 Output 1 (Pin 12): Output pin for Motor A
 Output 2 (Pin 13): Output pin for Motor A
 Output 3 (Pin 14): Output pin for Motor B
 Output 4 (Pin 15): Output pin for Motor B
Code Examples
### Example 1: Basic Motor Control with Arduino
In this example, we'll control two DC motors using an Arduino board and the L298N Motor Driver IC.
```c++
const int enA = 2;  // Enable pin for Motor A
const int in1 = 3;  // Input pin for Motor A
const int in2 = 4;  // Input pin for Motor A
const int enB = 5;  // Enable pin for Motor B
const int in3 = 6;  // Input pin for Motor B
const int in4 = 7;  // Input pin for Motor B
void setup() {
  pinMode(enA, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
}
void loop() {
  // Set motor speed
  analogWrite(enA, 128);  // Set speed for Motor A (0-255)
  analogWrite(enB, 128);  // Set speed for Motor B (0-255)
// Forward movement
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  delay(1000);
// Reverse movement
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  delay(1000);
}
```
### Example 2: Stepper Motor Control with Raspberry Pi
In this example, we'll control a stepper motor using a Raspberry Pi and the L298N Motor Driver IC.
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# Define stepper motor pins
step_pin = 17
dir_pin = 23
enable_pin = 24
GPIO.setup(step_pin, GPIO.OUT)
GPIO.setup(dir_pin, GPIO.OUT)
GPIO.setup(enable_pin, GPIO.OUT)
try:
  while True:
    # Enable stepper motor
    GPIO.output(enable_pin, GPIO.LOW)
# Set direction
    GPIO.output(dir_pin, GPIO.HIGH)
# Step the motor
    for i in range(100):
      GPIO.output(step_pin, GPIO.HIGH)
      time.sleep(0.001)
      GPIO.output(step_pin, GPIO.LOW)
      time.sleep(0.001)
# Change direction
    GPIO.output(dir_pin, GPIO.LOW)
# Step the motor
    for i in range(100):
      GPIO.output(step_pin, GPIO.HIGH)
      time.sleep(0.001)
      GPIO.output(step_pin, GPIO.LOW)
      time.sleep(0.001)
except KeyboardInterrupt:
  GPIO.cleanup()
```
Additional Resources
L298N Datasheet: [www.st.com/resource/en/datasheet/l298n.pdf](http://www.st.com/resource/en/datasheet/l298n.pdf)
 Arduino Motor Library: [www.arduino.cc/en/Reference/Motor](http://www.arduino.cc/en/Reference/Motor)
 Raspberry Pi GPIO Library: [www.raspberrypi.org/documentation/usage/gpio/library/](http://www.raspberrypi.org/documentation/usage/gpio/library/)