Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use L298 Dual H Bridge Motor Speed Controller: Examples, Pinouts, and Specs

Image of L298 Dual H Bridge Motor Speed ControllerDesign with L298 Dual H Bridge Motor Speed Controller in Cirkit Designer

Introduction

The L298 Dual H Bridge Motor Speed Controller is an integrated circuit designed to control the direction and speed of DC motors. It is capable of driving two motors simultaneously in either direction, which makes it a popular choice for robotics, automation projects, and any application requiring bidirectional control of motors with speed variation.

Explore Projects Built with L298 Dual H Bridge Motor Speed Controller

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Bluetooth-Controlled Robotic Vehicle with Brushless Motor and Servo Steering: A project utilizing L298 Dual H Bridge Motor Speed Controller in a practical application
Bluetooth-Controlled Robotic Vehicle with Brushless Motor and Servo Steering

This circuit is designed to control multiple DC motors, a brushless motor, and a servomotor via an Arduino Nano, which is interfaced with an HC-05 Bluetooth module for wireless communication. The L298N motor driver is used to drive the DC motors, while an Electronic Speed Controller (ESC) is connected to the brushless motor. The servomotor and the ESC are directly controlled by the Arduino, which likely receives commands via Bluetooth to adjust the speed and position of the motors.

Open Project in Cirkit Designer
Image of Microcontroller-Driven Motor Control System with LCD Interface and Thermal Management: A project utilizing L298 Dual H Bridge Motor Speed Controller in a practical application
Microcontroller-Driven Motor Control System with LCD Interface and Thermal Management

This circuit controls two DC motors using an L298N motor driver, which is interfaced with a microcontroller. The microcontroller can adjust the speed and direction of the motors, and it also manages a hot end device through a relay module. Additionally, the circuit includes an I2C module connected to an LCD screen for display purposes, multiple pushbuttons for user input, and a buck converter to regulate voltage for the microcontroller.

Open Project in Cirkit Designer
Image of Bluetooth-Controlled Robotic Vehicle with Servo Actuation and Water Pump: A project utilizing L298 Dual H Bridge Motor Speed Controller in a practical application
Bluetooth-Controlled Robotic Vehicle with Servo Actuation and Water Pump

This circuit is designed to control multiple DC motors and servos, with the capability to adjust motor speeds and servo positions. It includes an L298N motor driver to manage the DC motors, a relay to control a water pump, and two Arduinos to handle logic and Bluetooth communication via an HC-05 module. The servos are directly controlled by one of the Arduinos, which receives commands to manipulate their positions, potentially for a robotic application.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Pin Name Description
1 Vs Power supply for the motors (up to 46V)
2 GND Ground
3 Vss Logic supply voltage (5V from Arduino)
4 Out 1 Output to motor A terminal 1
5 Out 2 Output to motor A terminal 2
6 Out 3 Output to motor B terminal 1
7 Out 4 Output to motor B terminal 2
8 EnA Enable motor A, PWM input for speed control
9 In1 Input 1 for motor A direction control
10 In2 Input 2 for motor A direction control
11 In3 Input 1 for motor B direction control
12 In4 Input 2 for motor B direction control
13 EnB Enable motor B, PWM input for speed control
14 GND Ground
15 GND Ground
16 GND Ground

Usage Instructions

How to Use the Component in a Circuit

  1. Connect the power supply for the motors to pin Vs and ground to GND pins.
  2. Connect the logic supply voltage (5V from Arduino) to Vss.
  3. Connect the motor terminals to Out 1 and Out 2 for motor A, and Out 3 and Out 4 for motor B.
  4. Connect the Arduino digital outputs to In1, In2, In3, and In4 for direction control.
  5. Connect the Arduino PWM outputs to EnA and EnB for speed control.

Important Considerations and Best Practices

Example Arduino Code

// Define the L298N control pins
const int enA = 9;
const int in1 = 8;
const int in2 = 7;
const int enB = 3;
const int in3 = 5;
const int in4 = 4;

void setup() {
  // Set all the motor control pins to outputs
  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
}

void loop() {
  // Turn on motor A & B
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  
  // Set speed to 200 out of possible range 0-255
  analogWrite(enA, 200);
  analogWrite(enB, 200);
  
  delay(2000); // Run motors for 2 seconds
  
  // Now change motor directions
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  
  delay(2000); // Run motors in the opposite direction for 2 seconds
  
  // Turn off motors
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
}

Troubleshooting and FAQs

Common Issues Users Might Face

Solutions and Tips for Troubleshooting

FAQs

Q: Can the L298 drive stepper motors? A: Yes, the L298 can be used to drive stepper motors with the correct stepping sequence.

Q: What is the maximum current the L298 can handle? A: The L298 can handle up to 2A per channel, but it's recommended to stay below the peak current for continuous operation.

Q: Do I need to use external diodes with the L298? A: The L298 has built-in diodes for back EMF protection, but adding external diodes can provide additional protection.

Q: How do I control the speed of the motors? A: Speed control is achieved by applying PWM signals to the EnA and EnB pins. Adjusting the duty cycle of the PWM signal will vary the speed of the motors.