Driving DC motors with L298N
Safe wiring, enable pins, and basic forward/reverse control.
INTERMEDIATE · about 30 minutes
Use a separate motor supply when possible. Share GND with the logic supply.
Wire IN1–IN4 to four GPIO pins and ENA/ENB to PWM-capable pins for speed control.
Never power motors from the MCU 5V pin — brownouts will reset your board mid-run.
Start with low PWM duty cycles on a stand so the chassis does not race across the desk.