🧠 What is L298N?

The L298N is a dual H-bridge motor driver module that lets you control the direction and speed of two DC motors independently, or one stepper motor.

It acts like a bridge between your Arduino (low power) and the motors (higher power).


βš™οΈ Features

FeatureDetails
Voltage input5V – 35V (motor power)
Logic voltage5V (from Arduino or onboard reg)
Max current~2A per channel (peak)
Channels2 (A & B – for 2 DC motors)
Can controlDirection & Speed (PWM)
ExtrasBuilt-in 5V regulator

πŸ”Œ Pinout Breakdown

PinPurpose
IN1 / IN2Control motor A direction
IN3 / IN4Control motor B direction
ENA / ENBPWM speed control (A/B)
12V / +VMotor power supply (e.g. battery)
GNDCommon ground
5VLogic power out (if jumper is on)

🧠 Pro tip: If you’re powering motors with >12V, remove the 5V jumper and power logic separately from Arduino.


πŸ”„ How H-Bridge Works

An H-bridge is a circuit that can reverse the polarity of voltage applied to a load (motor), allowing it to spin forward or backward πŸš—β†”οΈ

IN1 HIGH, IN2 LOW  => Motor spins forward
IN1 LOW, IN2 HIGH  => Motor spins backward
IN1 = IN2          => Brake or stop

Speed is controlled by sending PWM to ENA (for motor A) or ENB (motor B).


πŸ› οΈ Arduino Code Example (1 Motor)

// Motor A
const int IN1 = 7;
const int IN2 = 8;
const int ENA = 9; // Must be PWM-capable

void setup() {
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(ENA, OUTPUT);
}

void loop() {
  // Forward
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  analogWrite(ENA, 150); // Speed: 0–255
  delay(2000);

  // Reverse
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  analogWrite(ENA, 200);
  delay(2000);

  // Stop
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  analogWrite(ENA, 0);
  delay(1000);
}

πŸ§ͺ Use Cases

βœ… 2WD/4WD robots
βœ… Line followers
βœ… Tank-style robots
βœ… Stepper motor control
βœ… Conveyor belts, sliders


⚠️ Limitations

⚠️ Gets hot β€” consider a heatsink πŸ₯΅
⚠️ Not ideal for high-current motors (>2A)
⚠️ A bit bulky compared to modern alternatives (like DRV8833)


πŸ”§ Alternatives

DriverPros
L9110SSmaller, less current
DRV8833Efficient, compact
TB6612FNGCooler, faster switching
πŸ“‘Broadcast the signal β€” amplify the connection.

Leave a Reply