Learning to use the L298N DC Motor Driver helps you control bidirectional motors reliably in robotics and DIY projects. This guide explains the pinouts, specs, and practical examples so you can integrate the module with microcontrollers and power supplies quickly.
The L298N module combines two full H-bridges into one compact package, enabling direction control and speed regulation for two DC motors. Understanding the core functions and limits ensures safe, stable operation in your circuits.
| Module Feature | Typical Value | Notes | Reference |
|---|---|---|---|
| Motor Channels | 2 | Each channel drives one DC motor | Common dual H-bridge |
| Continuous Current per Channel | 2 A | Limited by heatsink and power supply | Device safe zone |
| Peak Current per Channel | 3 A | Short bursts only; avoid overheating | Short duration |
| Logic Supply Voltage | 5 V | Accepts 5 V from microcontroller | Input compatible with 3.3–5 V |
| Motor Supply Voltage | 5–35 V | Must be higher than logic voltage | Check heatsink for high voltage |
L298N Pinout Details
Power and Ground Connections
Start by connecting the power terminals correctly to avoid damage. The +12V and GND pins handle motor power, while the 5V and GND pins supply regulated logic power. Make sure the heatsink is attached for higher currents.
Input Control Signals
Connect IN1 to IN4 and IN2 to IN3 through your microcontroller or driver circuit. These pins set the direction of each motor, while the ENA and ENB inputs manage speed via PWM.
Motor Output Terminals
Link your motors to OUT1, OUT2 for Channel A and OUT3, OUT4 for Channel B. Polarity does not matter since you can invert direction through software control.
Understanding Key Specs
Current and Voltage Limits
The L298N DC Motor Driver handles up to 2 A continuously and 3 A per channel briefly. Ensure your motor stall current stays within these limits to protect the H-bridge and prevent overheating.
Heat Management and Efficiency
At higher currents, heat buildup can reduce efficiency and trigger thermal shutdown. Use a proper heatsink, avoid long full-load runs, and monitor temperature during extended tests.
Logic and Motor Isolation
The module separates logic and motor power grounds, which helps reduce noise. For cleaner operation, tie the 5V pin to a regulated source and keep heavy motor wiring away from signal lines.
Wiring and Circuit Setup
Follow clear wiring steps to connect the L298N to a microcontroller and power source without signal conflicts. A clean layout improves reliability and simplifies debugging.
Step-by-Step Connection Guide
First, connect the motor supply and ground, then link the logic supply separately. Attach IN1–IN4 to PWM or digital pins, and connect ENA and ENB to PWM-capable pins for speed control.
Sample Project Connections
In typical robot platforms, OUT1 and OUT2 drive one wheel while OUT3 and OUT4 drive the other. Use female-to-male jumpers for the control pins and secure motor cables with strain relief.
Practical Examples
Basic Forward and Reverse Control
Set IN1 high and IN2 low for forward motion, and reverse the pattern for backward movement. Toggle ENA or ENB with different PWM values to adjust speed smoothly.
Direction Reversal with PWM
Switch direction by changing IN states while varying duty cycle on the enable pins. This method allows precise speed and direction adjustments for smooth robot maneuvers.
Stopping and Coasting Behavior
Setting both inputs to the same logic level stops the motor, but the motor may freewheel. Use braking through software or external circuits if you need faster stops.
Implementation Checklist
- Verify motor supply voltage is within 5–35 V range before connecting
- Use a common ground between microcontroller and motor power
- Limit continuous current per channel to 2 A with heatsink
- Test direction and PWM control at low power first
- Secure wiring and strain relief to prevent loose connections
- Monitor temperature during extended operation
FAQ
Reader questions
Can I power the L298N directly from a 12 V battery?
Yes, you can connect a 12 V battery to the motor supply input; the onboard 5V regulator will generate logic power for the control pins.
What happens if I exceed the 2 A continuous current limit?
Exceeding the current limit may cause overheating, thermal shutdown, or permanent damage to the H-bridge chips on the module.
How do I generate PWM signals to control motor speed?
Send a PWM waveform to ENA or ENB from a microcontroller, and adjust the duty cycle to smoothly increase or decrease motor speed.
Can I drive a stepper motor with the L298N module?
You can drive stepper motors by using the module as a full bridge for two windings, but peak currents and heat management need careful attention.