Ugenz Academy/IoT Tutorial

Motor Drivers

10 min read1,820 words

Reading progress

Keep learning

Motor Drivers in Electronics

1. Introduction to Motor Drivers

A motor driver is an electronic circuit or device that controls the operation of an electric motor. It allows a low-power controller, such as an Arduino or ESP32, to control a motor that requires more current or voltage than the controller can provide directly.

Motor drivers are commonly used in robotics, automation systems, electric vehicles, IoT projects, and industrial machinery.

For example, an ESP32 GPIO pin can provide a control signal, but it cannot directly supply the high current required by most DC motors. A motor driver acts as an interface between the controller and the motor.

2. Why Are Motor Drivers Needed?

Motor drivers are necessary for several reasons:

  • Higher current: Motors often require more current than microcontroller pins can supply.
  • Voltage compatibility: They allow a low-voltage controller to control a motor powered by a separate supply.
  • Direction control: Many motor drivers allow a motor to rotate clockwise or anticlockwise.
  • Speed control: They can adjust motor speed using Pulse Width Modulation (PWM).
  • Electrical protection: Some drivers provide protection against overcurrent, overheating, and voltage spikes.

Important: A motor driver does not necessarily increase voltage. It switches and controls the power supplied by an appropriate motor power source.

3. Basic Working Principle

A motor driver receives control signals from a microcontroller and uses them to control the electrical power delivered to the motor.

Microcontroller

Arduino / ESP32

Sends direction and speed signals

Motor Driver

L298N / TB6612FNG / MOSFET driver

Controls motor power and direction

Electric Motor

Rotates according to the control signals

The motor usually receives power from a separate supply connected to the motor driver's power terminals. The controller and driver generally need a common ground when using ordinary GPIO control signals.

4. Types of Motor Drivers

Different motor drivers are designed for different types of motors and applications.

Motor driver typeMain purposeCommon application
H-bridge driverControls DC motor direction and speedRobot cars
MOSFET driverSwitches or controls motor power efficientlyFans, pumps, DC motors
Stepper motor driverControls stepper motor movementCNC machines, 3D printers
Servo motor controllerGenerates position-control signalsRobotic arms
Brushless DC (BLDC) driverElectronically commutates a brushless motorDrones, electric vehicles
Three-phase motor driverControls three-phase motor powerIndustrial automation

The appropriate driver depends on the motor type, operating voltage, current requirements, and desired control method.

5. H-Bridge Motor Driver

An H-bridge is an electronic circuit that allows current to flow through a DC motor in either direction. It typically uses four switching devices arranged in an H-shaped configuration.

Datei:RP6 H-Brücke.jpg – RN-Wissen.de

rn-wissen.de

How an H-Bridge Works

  • Forward rotation: One diagonal pair of switches turns on, allowing current to flow through the motor in one direction.
  • Reverse rotation: The opposite diagonal pair turns on, reversing the current direction.
  • Stop: The switches are configured to stop the motor or allow it to coast, depending on the driver.
  • Braking: Some drivers can electrically brake the motor by configuring the outputs appropriately.

Never turn on both switches in the same half-bridge simultaneously. This can create a direct short circuit across the power supply, known as shoot-through.

6. Popular Motor Driver Modules

Motor Driver L298N 2A Dual Motor – Harish Projects

L298N Motor Driver

A widely used dual H-bridge module for controlling two brushed DC motors or one bipolar stepper motor. It is common in beginner robot-car projects.

  • Supports forward and reverse control.
  • Accepts PWM signals for speed control.
  • Uses bipolar transistor technology and can lose significant power as heat.

Tb6612Fng Motor Driver Module Performance Ultra Small Volume 3 Pi Matching Performance Ultra L298N

TB6612FNG Motor Driver

A compact MOSFET-based driver for controlling two small brushed DC motors.

  • Generally more efficient than the L298N.
  • Supports direction and PWM speed control.
  • Requires checking the board's continuous and peak current limits.

A4988, Stepper Motor Driver Module – Adjustable Current, Microstepping

A4988 Stepper Motor Driver

A driver designed for bipolar stepper motors, often used in 3D printers and CNC projects.

  • Supports step-and-direction control.
  • Provides microstepping.
  • Requires correct current-limit adjustment and suitable cooling.

ReadytoSky 30A 2-4S ESC Speed Controller With 5V / 2A BEC for Brushles

BLDC Electronic Speed Controller (ESC)

An electronic speed controller switches power through the phases of a brushless DC motor in the correct sequence.

  • Commonly used in drones and RC vehicles.
  • Requires a compatible motor and control protocol.
  • Must be selected according to motor current and voltage ratings.

7. DC Motor Direction Control

A brushed DC motor changes its direction of rotation when the polarity across its terminals is reversed.

Input AInput BTypical motor operation
HIGHLOWForward
LOWHIGHReverse
LOWLOWCoast or stop, depending on driver
HIGHHIGHBrake or stop, depending on driver

These states are common for an H-bridge, but the exact behavior depends on the motor driver's datasheet and input configuration.

8. Motor Speed Control Using PWM

Pulse Width Modulation (PWM) controls average motor power by rapidly switching the driver's output on and off.

The duty cycle represents the percentage of each PWM period during which the signal is active.

D=T_ONT_period×100%D=\frac{T\_{\text{ON}}}{T\_{\text{period}}}\times100\%

Where:

  • DD = duty cycle
  • T_ONT\_{\text{ON}} = time the signal remains on
  • T_periodT\_{\text{period}} = total PWM period

For example, a 60% duty cycle means the signal is active for 60% of each period.

Example PWM signals

Higher duty cycle generally produces greater average motor power.

25% duty cycle

25% ON

50% duty cycle

50% ON

75% duty cycle

75% ON

PWM duty cycle does not translate directly into the same percentage of motor speed. Actual speed depends on the motor, load, supply voltage, driver losses, and control system.

9. Interfacing a Motor Driver with Arduino or ESP32

A typical two-motor driver module may have the following connections:

Driver connectionPurpose
Motor supply (VM or VIN)Supplies power to the motor
Logic supply (VCC or logic pin)Powers driver control circuitry, as specified
GNDCommon electrical reference
IN1, IN2Control motor A direction
IN3, IN4Control motor B direction
ENA, ENB or PWM inputsEnable and control motor speed
OUT1, OUT2Connect to motor A
OUT3, OUT4Connect to motor B

The exact pins vary between modules. Some boards combine enable and PWM inputs, while others use a dedicated sleep or standby pin.

Example: Controlling an L298N with an ESP32

This example runs one DC motor forward, stops it briefly, and then runs it in reverse. It uses Arduino-style code for the ESP32.

const int IN1 = 27;
const int IN2 = 26;
const int ENA = 25;

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

  // Enable motor at full PWM duty
  digitalWrite(ENA, HIGH);
}

void loop() {
  // Forward
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  delay(2000);

  // Stop/coast
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  delay(1000);

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

  // Stop/coast
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  delay(1000);
}

Wiring notes:

  • Connect the motor to OUT1 and OUT2.
  • Connect the ESP32 control pins to IN1 and IN2, and GPIO25 to ENA.
  • Connect the motor supply to the module's motor-power input.
  • Connect ESP32 GND and driver GND together.
  • On typical L298N modules, remove the ENA jumper if you want to control ENA from GPIO25.
  • Do not power the motor directly from an ESP32 GPIO pin. Verify the motor supply, driver ratings, and module wiring before powering the circuit.

10. Motor Driver vs. Motor Controller

These terms are sometimes used interchangeably, but they can refer to different functions.

FeatureMotor driverMotor controller
Main roleSwitches and delivers electrical power to the motorDetermines how the motor should operate
Typical inputLogic or PWM signalsCommands, feedback, or a target speed/position
Main functionPower switching and current handlingControl logic and regulation
ExampleL298N, TB6612FNGMicrocontroller running speed-control software

A motor-control system can contain both: a controller calculates the desired motor behavior, and the driver supplies the required electrical power.

11. Applications of Motor Drivers

Motor drivers are used in many electronic systems:

  • Robotics: Control robot-car wheels and robotic mechanisms.
  • IoT automation: Operate fans, pumps, blinds, and actuators.
  • 3D printers: Move stepper motors along multiple axes.
  • Drones: Control brushless motors through ESCs.
  • Industrial systems: Operate conveyors, pumps, and machinery.
  • Home appliances: Control motors in fans, washing machines, and other devices.
  • Automotive electronics: Drive cooling fans, pumps, and other actuators.

12. Advantages and Limitations

AdvantagesLimitations
Allows microcontrollers to operate higher-power motorsAdds cost and circuit complexity
Supports direction and speed control when designed for itGenerates heat and has power losses
Protects low-power controller outputs from direct motor loadsHas maximum voltage and current limits
Enables automation and remote motor controlElectrical noise may affect nearby circuits
Some drivers include current limiting and thermal protectionNot every driver supports every motor type

13. Safety and Design Considerations

When selecting or wiring a motor driver:

  1. Check stall current: A motor can draw much more current when starting or stalled than while running freely.
  2. Check voltage ratings: Ensure the motor supply stays within the driver's specified operating range.
  3. Consider heat dissipation: Use appropriate heatsinking or cooling if required.
  4. Manage electrical noise: Follow the datasheet's recommendations for decoupling capacitors, wiring, and suppression.
  5. Avoid reverse-polarity and short-circuit conditions: Use suitable protection.
  6. Use the correct driver: A small DC motor driver should not be assumed suitable for a large motor or mains-powered equipment.

14. Summary

A motor driver is an essential interface between a low-power controller and an electric motor. It enables functions such as direction control, speed control, and controlled power delivery. H-bridge drivers are common for brushed DC motors, stepper drivers are used for precise incremental movement, and ESCs control brushless DC motors.

Choosing the right motor driver requires checking motor type, operating voltage, stall current, control method, thermal limits, and safety requirements.

Keep learning. Keep building. Keep growing.

© 2026 Ugenz Academy