Skip to content

Motor Driver Boards

Introduction

A motor driver board is the power electronics module that sits between the MCU and the motor. Since the MCU's GPIO output current (typically <20 mA) is insufficient to directly drive a motor (which typically requires hundreds of milliamps to tens of amps), the driver board handles power amplification and current direction control.

H-Bridge Principle

Basic Structure

The H-bridge is the core circuit for DC motor driving, consisting of 4 switches (MOSFETs or BJTs) arranged in an "H" shape:

    VCC
     │
  ┌──┴──┐
  │     │
 Q1     Q3
  │     │
  ├─ M ─┤     M = Motor
  │     │
 Q2     Q4
  │     │
  └──┬──┘
     │
    GND

Operating Modes

Q1 Q2 Q3 Q4 Motor State
ON OFF OFF ON Forward
OFF ON ON OFF Reverse
ON OFF ON OFF Braking (high-side short)
OFF ON OFF ON Braking (low-side short)
OFF OFF OFF OFF Free coast

Forbidden State

The upper and lower switches on the same side (Q1+Q2 or Q3+Q4) must never be turned on simultaneously; otherwise, the power supply is directly short-circuited, causing instant damage! Driver ICs typically include dead-time protection internally.

PWM Speed Control

Speed is controlled by applying a PWM signal to the H-bridge switches, regulating the average voltage:

\[ V_{avg} = V_{supply} \times \frac{D}{100\%} \]

Where \(D\) is the duty cycle. PWM frequency is typically chosen at 20–50 kHz (above human hearing range).

L298N Dual H-Bridge Driver Module

Specifications

Parameter Value
Drive channels 2 (dual H-bridge)
Operating voltage 5–35V
Drive current 2A/channel (3A peak)
Logic voltage 5V (onboard regulator)
Control method DIR + PWM or IN1/IN2/ENA
Package Large DIP with heatsink

Wiring Diagram

                  ┌──────────────┐
 Motor A+ ────────┤ OUT1    +12V ├── Motor power (7-12V)
 Motor A- ────────┤ OUT2     GND ├── Common ground
 Motor B+ ────────┤ OUT3      5V ├── Can output 5V to MCU
 Motor B- ────────┤ OUT4         │
                  │              │
 Arduino D5 (PWM)─┤ ENA     ENB ├─ Arduino D6 (PWM)
 Arduino D2 ──────┤ IN1     IN3 ├─ Arduino D4
 Arduino D3 ──────┤ IN2     IN4 ├─ Arduino D7
                  └──────────────┘

Control Code

// L298N dual motor control
#define ENA 5   // PWM speed control
#define IN1 2   // Direction control
#define IN2 3
#define ENB 6
#define IN3 4
#define IN4 7

void motorA(int speed) {
    // speed: -255 ~ 255
    if (speed >= 0) {
        digitalWrite(IN1, HIGH);
        digitalWrite(IN2, LOW);
        analogWrite(ENA, speed);
    } else {
        digitalWrite(IN1, LOW);
        digitalWrite(IN2, HIGH);
        analogWrite(ENA, -speed);
    }
}

void motorB(int speed) {
    if (speed >= 0) {
        digitalWrite(IN3, HIGH);
        digitalWrite(IN4, LOW);
        analogWrite(ENB, speed);
    } else {
        digitalWrite(IN3, LOW);
        digitalWrite(IN4, HIGH);
        analogWrite(ENB, -speed);
    }
}

Limitations

  • Low efficiency (BJT voltage drop ~2V, high power dissipation and heat)
  • Suitable for low-power beginner projects; not recommended for production robots

TB6612FNG

Specifications

Parameter Value
Drive channels 2
Operating voltage 2.5–13.5V
Drive current 1.2A/channel (3.2A peak)
Logic voltage 2.7–5.5V
On-resistance 0.5 ohm (MOSFET)
Standby mode Yes (STBY pin)
Package Small SSOP24

Advantages

  • MOSFET-based driver with very low voltage drop (~0.5V vs. 2V for L298N), high efficiency
  • Compact form factor, suitable for tight designs
  • Supports PWM frequencies up to 100 kHz
  • Built-in thermal shutdown protection

Wiring

TB6612FNG    MCU
AIN1    ←── GPIO (direction)
AIN2    ←── GPIO (direction)
PWMA    ←── PWM  (speed)
BIN1    ←── GPIO
BIN2    ←── GPIO
PWMB    ←── PWM
STBY    ←── GPIO (HIGH=active)
VM      ←── Motor power
VCC     ←── Logic power (3.3/5V)
GND     ←── Common ground
AO1/AO2 ──→ Motor A
BO1/BO2 ──→ Motor B

Waveshare General Driver for Robots

Overview

The Waveshare General Driver for Robots integrates multiple interfaces into a single board.

Specifications

Parameter Value
MCU ESP32-S3
DC motor drivers 4 channels (TB6612)
Servo interfaces Multiple PWM channels
Bus servos Supports STS/Dynamixel
Display 0.91" OLED
IMU Onboard 6-axis
Communication WiFi/BLE/UART/I2C/SPI
Power USB-C + battery connector

Features

  • One board addresses all driving needs for small robots
  • ESP32-S3 supports WiFi and BLE for remote control
  • Onboard OLED displays status information
  • Dual MicroPython and Arduino support

Suitable Scenarios

  • Wheeled cars
  • Small robotic arms
  • Educational robot platforms
  • Rapid prototyping

ODrive S3

Overview

ODrive is an open-source, high-performance BLDC driver for robotics and automation applications.

Specifications

Parameter Value
Drive channels Dual-channel BLDC
Voltage range 12–56V
Continuous current 40A/channel
Peak current 80A/channel
Control algorithm FOC (sinusoidal)
Current loop bandwidth >5 kHz
Encoder Incremental / SPI / Hall / Sensorless
Communication USB / CAN / UART / SPI / GPIO
Processor STM32F405

Feature Highlights

  • Current/velocity/position triple-loop closed-loop control
  • Supports trapezoidal and S-curve trajectory planning
  • Built-in anti-cogging calibration
  • ASCII and Native protocols
  • Open-source firmware, customizable

CAN Bus Multi-Axis Control

# ODrive CAN multi-axis control example
import can

bus = can.interface.Bus(channel='can0', bustype='socketcan')

def set_position(node_id, position):
    """Set ODrive position via CAN"""
    # Set Input Pos command: cmd_id = 0x00C
    arbitration_id = (node_id << 5) | 0x00C
    data = struct.pack('<fhh', position, 0, 0)  # pos, vel_ff, torque_ff
    msg = can.Message(arbitration_id=arbitration_id, data=data)
    bus.send(msg)

# Control two axes
set_position(0, 10.0)  # Axis 0: 10 turns
set_position(1, -5.0)  # Axis 1: -5 turns

Pololu Motor Drivers

Pololu offers a variety of small, high-quality motor driver modules:

Common Models

Model Current Voltage Features
DRV8833 1.2A 2.7–10.8V Dual-channel, ultra-compact
DRV8838 1.8A 0–11V Single-channel, minimal
TB6612FNG 1.2A 4.5–13.5V Dual-channel, classic
VNH5019 12A 5.5–24V Single-channel, high current
G2 18v17 17A 6.5–30V High current, high performance

Selection Reference

Motor current requirement:
  < 1A  ──→ DRV8833 / TB6612FNG
  1-5A  ──→ BTS7960 / L298N
  5-15A ──→ VNH5019 / G2 series
  > 15A ──→ ODrive / Custom MOSFET driver

Driver Board Wiring Considerations

Power Supply

  • Separate motor and logic power: Prevent motor noise from interfering with the MCU
  • Thick power wires: Use 16–18 AWG wire for high-current scenarios
  • Decoupling capacitors: Add large capacitors (100 uF–1000 uF) across the driver board power input
  • Flyback diodes: Inductive motor loads produce reverse voltage when de-energized; driver ICs usually include these internally

Grounding

Battery ─┬─→ Motor driver board ──→ Motor
         │        │
         │    Common GND ←── This connection must be reliable
         │        │
         └─→ Buck converter ──→ MCU

Common Ground Principle

The MCU and driver board GND must be connected; otherwise, logic signals have no reference level, and the driver board cannot correctly interpret PWM and direction signals.

EMI Protection

  • Add 0.1 uF ceramic capacitors across motor terminals (suppresses brush sparking)
  • Use shielded or twisted-pair cables to connect motors
  • Choose PWM frequencies that avoid communication frequency bands

Driver Solution Comparison

Solution Motor Type Current Cost Suitable Scenario
L298N Brushed DC 2A Low Beginner/educational
TB6612FNG Brushed DC 1.2A Low Small robots
BTS7960 Brushed DC 43A Medium Large chassis
Waveshare General DC + Servo 1.2A Medium Integrated small robots
ESC BLDC Varies Medium Drones
ODrive S3 BLDC 40A High Robot joints
Industrial servo drive AC Servo Varies High Industrial robots

Summary

  • The H-bridge is the fundamental DC motor driving circuit, using 4 switches to control current direction
  • The L298N is suitable for beginners but has low efficiency; the TB6612FNG is a better alternative
  • The Waveshare General Driver integrates ESP32 + motors + servos, suitable for small robots
  • ODrive is a high-performance open-source BLDC driver supporting FOC and CAN bus
  • Driver board selection primarily depends on current capacity, voltage range, and control method
  • Power supply design, common grounding, and EMI protection are critical for reliable operation

评论 #