মূল বিষয়বস্তুতে যান
Learn/Sound & motion/DC motors and drivers
Sound & motion · Lesson
12 min read

DC motors and drivers

Control speed and direction through an H-bridge driver.

What You Will Learn

  • Explain why GPIOs can't drive motors directly
  • Use IN1/IN2 for direction
  • Use PWM on EN for speed

A small DC motor can draw 200–1000 mA — far beyond the 20 mA a pin can give — and it creates voltage spikes when it stops. A motor driver (H-bridge) like the L298N or TB6612 does the heavy lifting; the Arduino only sends signals.

IN1IN2Motor
HIGHLOWforward
LOWHIGHreverse
LOWLOWstop (coast)
HIGHHIGHbrake
DC motor speed & directionarduino-uno
Open in Lab
UNOATmega328P: The 8-bit AVR microcontroller that runs your sketch (16 MHz, 32 KB flash, 2 KB RAM).ATmega328PUSB-B: USB connection for uploading sketches and for the Serial Monitor. Also powers the board (5 V).DC jack: Barrel jack for 7–12 V from a battery pack or adapter (centre positive).ATmega16U2: Converts USB to serial for uploads and Serial.print().RESET: Restarts your sketch from the beginning (setup() runs again).L (D13): Built-in LED connected to pin 13 (LED_BUILTIN).ON: Power indicator.5 V regulator: Turns 7–12 V from VIN/jack into a steady 5 V.16 MHz: Clock source: the microcontroller runs 16 million cycles per second.ICSP: In-circuit programming header (SPI). Used to burn a bootloader; not needed for normal uploads.DRIVERstop70%
Note: Knob = speed, button = direction.
Power motors from their own battery pack, connected to the driver's motor supply, and connect that battery's − to the Arduino's GND.

Check Your Understanding

Test what you learned in this lesson

1How do you change a DC motor's speed through a driver?