Motor driver board for controlling DC and stepper motors with an Arduino, ESP32, Raspberry Pi or other digital control system.
SKU: OT2099-B41 Article number: AA034 EAN: 8720589817425 Location: B03.01
Alternative
L9110S DC Stepper / Motor Driver Board H-Bridge
€ 2,40
View this alternative
How to connect the L298N Motor Driver Board red to an Arduino UNO or ESP32, with an example sketch you can upload straight away.
This example demonstrates how to control DC motors using an L298N motor driver board. The Arduino sets the motor rotation direction via digital logic pins and adjusts motor speed using PWM on the enable pin. The program cycles the motors forward, stops them, and then drives them in reverse.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : L298N Motor Driver Control with Arduino Uno
* Board : Arduino UNO (arduino:avr:uno)
* Parts : L298N Motor Driver Board
* Libraries : none (built-in)
*
* Codey Online is an AI-powered browser IDE for Arduino and ESP32.
* Describe your project and Codey writes the code, draws the wiring
* diagram and uploads it to your board, straight from the browser.
* This code is free to use, modify and share, without warranty.
* ==================================================================
*/
// L298N Motor Driver Control Demo
const int ENA_PIN = 5; // PWM speed control
const int IN1_PIN = 8; // Motor A direction 1
const int IN2_PIN = 9; // Motor A direction 2
const int IN3_PIN = 10; // Motor B direction 1
const int IN4_PIN = 11; // Motor B direction 2
void stopMotors() {
digitalWrite(IN1_PIN, LOW);
digitalWrite(IN2_PIN, LOW);
digitalWrite(IN3_PIN, LOW);
digitalWrite(IN4_PIN, LOW);
analogWrite(ENA_PIN, 0);
}
void driveForward(int speedVal) {
digitalWrite(IN1_PIN, HIGH);
digitalWrite(IN2_PIN, LOW);
digitalWrite(IN3_PIN, HIGH);
digitalWrite(IN4_PIN, LOW);
analogWrite(ENA_PIN, speedVal);
}
void driveReverse(int speedVal) {
digitalWrite(IN1_PIN, LOW);
digitalWrite(IN2_PIN, HIGH);
digitalWrite(IN3_PIN, LOW);
digitalWrite(IN4_PIN, HIGH);
analogWrite(ENA_PIN, speedVal);
}
void setup() {
Serial.begin(115200);
pinMode(ENA_PIN, OUTPUT);
pinMode(IN1_PIN, OUTPUT);
pinMode(IN2_PIN, OUTPUT);
pinMode(IN3_PIN, OUTPUT);
pinMode(IN4_PIN, OUTPUT);
stopMotors();
Serial.println(F("L298N Motor Driver initialized."));
}
void loop() {
Serial.println(F("Driving forward"));
driveForward(200);
delay(2000);
Serial.println(F("Stopping"));
stopMotors();
delay(1000);
Serial.println(F("Driving reverse"));
driveReverse(200);
delay(2000);
Serial.println(F("Stopping"));
stopMotors();
delay(1000);
}
Wiring diagram and example code generated by Codey.online — https://www.codey.online
This project controls two DC motors using an ESP32 and an L298N H-bridge driver. The sketch rotates both motors forward, stops them, drives them in reverse, and demonstrates PWM speed control. Connect external power to the L298N 12V terminal to provide enough current for larger motors.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : ESP32 Dual DC Motor Control with L298N
* Board : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
* Parts : L298N Motor Driver Board
* Libraries : none (built-in)
*
* Codey Online is an AI-powered browser IDE for Arduino and ESP32.
* Describe your project and Codey writes the code, draws the wiring
* diagram and uploads it to your board, straight from the browser.
* This code is free to use, modify and share, without warranty.
* ==================================================================
*/
const int ENA_PIN = 14;
const int IN1_PIN = 27;
const int IN2_PIN = 26;
const int IN3_PIN = 25;
const int IN4_PIN = 33;
const int ENB_PIN = 32;
void setMotors(int speedA, int dirA, int speedB, int dirB) {
// Motor A direction
if (dirA > 0) {
digitalWrite(IN1_PIN, HIGH);
digitalWrite(IN2_PIN, LOW);
} else if (dirA < 0) {
digitalWrite(IN1_PIN, LOW);
digitalWrite(IN2_PIN, HIGH);
} else {
digitalWrite(IN1_PIN, LOW);
digitalWrite(IN2_PIN, LOW);
}
analogWrite(ENA_PIN, speedA);
// Motor B direction
if (dirB > 0) {
digitalWrite(IN3_PIN, HIGH);
digitalWrite(IN4_PIN, LOW);
} else if (dirB < 0) {
digitalWrite(IN3_PIN, LOW);
digitalWrite(IN4_PIN, HIGH);
} else {
digitalWrite(IN3_PIN, LOW);
digitalWrite(IN4_PIN, LOW);
}
analogWrite(ENB_PIN, speedB);
}
void setup() {
Serial.begin(115200);
pinMode(ENA_PIN, OUTPUT);
pinMode(IN1_PIN, OUTPUT);
pinMode(IN2_PIN, OUTPUT);
pinMode(IN3_PIN, OUTPUT);
pinMode(IN4_PIN, OUTPUT);
pinMode(ENB_PIN, OUTPUT);
Serial.println("L298N Motor Driver Initialized");
}
void loop() {
// Drive forward
Serial.println("Moving Forward");
setMotors(200, 1, 200, 1);
delay(2000);
// Stop
Serial.println("Stopping");
setMotors(0, 0, 0, 0);
delay(1000);
// Drive backward
Serial.println("Moving Backward");
setMotors(200, -1, 200, -1);
delay(2000);
// Stop
Serial.println("Stopping");
setMotors(0, 0, 0, 0);
delay(1000);
// Speed ramp up
Serial.println("Ramping Speed Forward");
for (int spd = 0; spd <= 255; spd += 15) {
setMotors(spd, 1, spd, 1);
delay(100);
}
delay(500);
setMotors(0, 0, 0, 0);
delay(1500);
}
Wiring diagram and example code generated by Codey.online — https://www.codey.online
With this L298N Motor Driver Board, you can easily control DC motors and stepper motors using, for example, an Arduino, ESP32, Raspberry Pi, microcontroller, or other digital control system.
The module is built around the well-known L298N Dual H-Bridge motor driver. Thanks to the two integrated H-bridges, you can independently control two standard brushed DC motors, including direction and speed control. In addition, the module can be used to drive one bipolar stepper motor.
According to the specifications of this module, the motor supply voltage can be between 5 and 35 V DC. The logic operates at 5 V. The L298N supports a current of up to 2 A per channel under suitable conditions, with good cooling being important at higher loads.
The L298N is not only intended for stepper motors. The board is very suitable for controlling standard brushed DC motors.
With one module, up to two DC motors can be controlled separately:
Through the digital inputs, you can determine the direction of rotation of each motor. Via the ENA and ENB connections, a PWM signal can also be applied to control the motor speed.
This makes the following functions possible, among others:
This makes the module suitable for robot cars, vehicles, small machines, actuators, fans, and other DC motor projects, among other things.
The two H-bridges can also be used together to drive a bipolar stepper motor. The four motor outputs OUT1 through OUT4 are connected to the two coils of the stepper motor for this purpose.
The order in which IN1 through IN4 are driven then determines the direction of rotation and stepping pattern.
For DC motors, the speed can be controlled via PWM (Pulse Width Modulation).
To do this, remove the jumpers from ENA and/or ENB and connect these pins to a PWM output of the microcontroller.
If the corresponding jumper remains installed, the channel is continuously enabled and the motor can be controlled via the IN pins without a separate PWM signal.
Motor supply / VS
Connection for the supply voltage of the motors.
GND
Common ground for power and control. The GND of the microcontroller and the motor driver must be connected to each other.
5V
5V connection for the module logic. Depending on the configuration of the 5V regulator and jumper, this connection can function as either a power input or output.
OUT1 / OUT2
Output of H-bridge A. DC motor A is connected here.
IN1 / IN2
Digital control inputs used to determine the direction of rotation of motor A.
ENA
Enable input for motor A. Can also be used for PWM speed control.
OUT3 / OUT4
Output of H-bridge B. DC motor B is connected here.
IN3 / IN4
Digital control inputs used to determine the direction of rotation of motor B.
ENB
Enable input for motor B. Can also be used for PWM speed control.
| ENA | IN1 | IN2 | Function |
|---|---|---|---|
| HIGH | HIGH | LOW | Direction of rotation 1 |
| HIGH | LOW | HIGH | Direction of rotation 2 |
| HIGH | LOW | LOW | Stop/brake |
| HIGH | HIGH | HIGH | Stop/brake |
| LOW | X | X | Output disabled |
The actual direction of rotation depends on how the two motor wires are connected to OUT1 and OUT2.
For motor B, control works the same way via IN3, IN4, and ENB.
The L298N used is a dual full-bridge driver specifically designed for switching inductive loads such as DC motors, stepper motors, relays, and solenoids. According to the manufacturer, the L298 itself supports a motor supply voltage of up to 46 V and includes thermal protection, among other features.
For this complete module, a motor supply voltage of 5 to 35 V DC is maintained.
The specified maximum current of 2 A should be regarded as the maximum driver value. At higher continuous motor currents, significant heat loss occurs in the L298N. The practically usable continuous current therefore depends on, among other things, supply voltage, cooling, ambient temperature, and load.
Also check not only the nominal current of a DC motor, but also the startup and stall current. This can be several times higher than the current during normal operation.
The L298N uses bipolar output transistors and therefore has a greater voltage drop than modern MOSFET motor drivers. The voltage that actually reaches the motor is therefore lower than the applied supply voltage.
This is especially relevant for low-voltage motors. For applications where very high efficiency or very low voltage drop is important, a modern MOSFET driver may be a better choice.
The L298N Motor Driver Board is a versatile dual H-bridge for controlling both standard DC motors and stepper motors. With one module, two DC motors can be driven independently forward and backward, and the speed can be controlled via PWM. Alternatively, both H-bridges can be used together for one bipolar stepper motor.
Thanks to its simple digital control, this module is very suitable for use with Arduino, ESP32, and other microcontrollers.

| Dimensions | approx. 43 × 43 × 27 mm |
|---|---|
| Suitable for | brushed DC motors and bipolar stepper motors |
| Type | L298N Motor Driver Board |
| Control | digital logic |
| Driver IC | L298N |
| ENA | enable/PWM for motor A |
| ENB | enable/PWM for motor B |
| Driver technology | Dual H-Bridge / Dual Full Bridge |
| Number of DC motors | up to 2 independently controlled motors |
| Number of bipolar stepper motors | up to 1 |
| Logic supply voltage | 5 V DC |
| Motor supply voltage module | 5 – 35 V DC |
| Maximum rated motor current | 2 A |
| DC motor speed control | PWM via ENA and ENB |
| Direction control | yes |
| Dual H-bridge | yes |
| Heat sink | yes |
| Motor outputs | OUT1, OUT2, OUT3 and OUT4 |
| Control inputs | IN1, IN2, IN3 and IN4 |
| Enable inputs | ENA and ENB |
Works well
Works superbly. Better than with relays.
Very neat compact little board.
L298N Motor Driver Board red