🤖 Week 7, Day 5: Motor Drivers and Power Electronics
Theme: Actuators & Drive Systems
Topic: Motor Drivers and Power Electronics
Learning Goal: Understand the circuits and control strategies that convert digital commands into motor current.
Introduction
A motor driver is the bridge between a robot’s brain (microcontroller/CPU) and its muscles (motor). It must:
- Accept low-power digital commands (3.3V, mA)
- Deliver high-power analog current (12-48V, 1-100A)
- Protect against faults (overcurrent, overtemperature, stall)
- Provide feedback (current, temperature, fault status)
Today we’ll explore the circuits that make this possible.
The H-Bridge: Fundamental Building Block
What Is an H-Bridge?
An H-bridge is a circuit with four switches (transistors) arranged in an “H” configuration, allowing bidirectional current through a motor:
V_supply
|
Q1 ----+---- Q3
| | |
--+-- Motor --+--
| | |
Q2 ----+---- Q4
|
GND
Operating Modes
| Q1 | Q2 | Q3 | Q4 | Motor |
|---|---|---|---|---|
| ON | OFF | OFF | ON | Forward |
| OFF | ON | ON | OFF | Reverse |
| ON | OFF | ON | OFF | Brake (short circuit) |
| OFF | ON | OFF | ON | Brake (short circuit) |
| OFF | OFF | OFF | OFF | Coast (freewheel) |
Critical: Q1+Q2 or Q3+Q4 must NEVER be ON simultaneously — this creates a shoot-through (direct short across power supply).
PWM Speed Control
Rather than simply switching ON/OFF, motor drivers use Pulse Width Modulation (PWM):
Duty Cycle = T_on / (T_on + T_off)
- 0% duty: Motor off
- 50% duty: Half speed (average voltage)
- 100% duty: Full speed
PWM frequency considerations:
- Too low (<1 kHz): Audible whining, torque ripple
- Optimal (10-20 kHz): Above human hearing, good response
- Too high (>100 kHz): Switching losses increase, EMI problems
Regeneration
When a motor decelerates, it acts as a generator. The H-bridge must handle this energy:
Options:
1. Dissipate in resistors (simple, wasteful)
2. Return to battery (efficient, requires bidirectional converter)
3. Dump to capacitor (brief energy storage)
Transistor Technologies
MOSFET (Metal-Oxide-Semiconductor Field-Effect Transistor)
The dominant switch for motor drivers:
Advantages:
- High switching speed (ns to μs)
- Low on-resistance (R_ds(on) = 1-50 mΩ)
- Voltage-controlled (no gate current in steady state)
- Easy to parallel for higher current
Key parameters:
- V_ds(max): Maximum drain-source voltage (typically 30-100V)
- I_d(max): Maximum continuous drain current (1-300A)
- R_ds(on): On-resistance (determines conduction loss)
- Q_g: Gate charge (determines switching energy)
Losses:
P_conduction = I² × R_ds(on)
P_switching = 0.5 × V × I × (t_rise + t_fall) × f_pwm
IGBT (Insulated Gate Bipolar Transistor)
Used for very high power (>1 kW):
Advantages:
- Lower conduction losses at high voltage (>300V)
- Higher current density than MOSFET
Disadvantages:
- Slower switching (μs)
- Tail current (slow turn-off)
- Not suitable for low-voltage (<100V) applications
GaN (Gallium Nitride) and SiC (Silicon Carbide)
Emerging wide-bandgap semiconductors:
| Parameter | Silicon MOSFET | GaN | SiC MOSFET |
|---|---|---|---|
| Switching speed | ~100 ns | ~10 ns | ~50 ns |
| R_ds(on) | 10 mΩ | 5 mΩ | 8 mΩ |
| Voltage | <200V | <650V | <1700V |
| Cost | Low | Moderate | High |
| Temperature | 150°C | 200°C | 200°C |
Applications:
- GaN: High-frequency, compact drives (drones, EV chargers)
- SiC: High-voltage, high-temperature (EV traction, industrial)
Motor Driver Architectures
1. DC Motor Driver (Single H-Bridge)
Components:
- H-bridge (4x MOSFETs)
- Gate drivers (boost voltage for high-side switches)
- Current sense resistor + amplifier
- PWM generator (microcontroller or dedicated IC)
- Protection logic (overcurrent, overtemperature)
Example ICs:
- TB6612FNG: 1.2A dual H-bridge, $2
- DRV8833: 1.5A dual H-bridge, $1.50
- VNH5019: 30A single H-bridge, $8
2. Stepper Motor Driver
Requirements:
- Dual H-bridge (bipolar) or dual half-bridge (unipolar)
- Current chopping (regulate winding current)
- Microstepping waveform generation
- Step/direction interface
Current Chopping Principle:
1. Apply voltage to winding
2. Current rises: di/dt = (V - I×R) / L
3. When I > I_target: switch OFF, current decays through diodes
4. When I < I_target: switch ON again
5. Repeat at 20-50 kHz chop frequency
Example ICs:
- A4988: 2A, 1/16 microstepping, $3
- TMC2209: 2.8A, 1/256 microstepping, silent chop, $6
- DRV8825: 2.5A, 1/32 microstepping, $4
3. BLDC Motor Controller (ESC)
Requirements:
- Three-phase bridge (6 MOSFETs)
- Commutation logic (Hall sensor or sensorless)
- Speed control loop (PWM duty → RPM)
- Current limiting
- Regenerative braking (for advanced controllers)
Phases of Operation:
Step 1: Energize A+B-, measure C back-EMF
Step 2: Energize A+C-, measure B back-EMF
Step 3: Energize B+C-, measure A back-EMF
... (6-step commutation)
Example controllers:
- SimonK: Open-source firmware for drone ESCs
- BLHeli_32: Advanced 32-bit ESC firmware
- ODrive: Open-source FOC controller for robotics
- VESC: Open-source ESC for EVs and robots
4. Servo Drive (Industrial)
Requirements:
- Three-phase bridge + FOC control
- High-resolution encoder interface (sin/cos, BISS, EnDat)
- Multi-loop control (position/velocity/current)
- Fieldbus communication (EtherCAT, CANopen, Modbus)
- Safety functions (STO - Safe Torque Off)
Example products:
- Elmo Gold Twitter: 100W-5.5kW, EtherCAT, $500-2000
- Maxon EPOS4: 250W-1.5kW, CANopen/EtherCAT, $300-1000
- Copley Controls: 100W-10kW, various fieldbuses
Control Strategies
Open-Loop PWM
Simplest approach: PWM duty cycle maps directly to speed:
# Pseudo-code
pwm_duty = speed_command / max_speed # 0.0 to 1.0
set_pwm(pwm_duty)
Problems:
- No speed regulation (varies with load)
- No position knowledge
- No current limiting
- No fault protection
Use for: Simple fans, pumps, toys — not robotics.
Closed-Loop Velocity Control
Add encoder feedback to regulate speed:
# Velocity PI control loop (1 kHz)
velocity_error = target_velocity - measured_velocity
integral += velocity_error * dt
command_current = Kp * velocity_error + Ki * integral
pwm_duty = command_current / max_current
Advantages:
- Maintains speed under load variation
- Can compensate for battery voltage sag
- Enables precise velocity profiles
Closed-Loop Position Control
Add position feedback for precise positioning:
# Cascaded position-velocity loops
# Position loop (100 Hz)
position_error = target_position - measured_position
velocity_command = Kp_pos * position_error
# Velocity loop (1 kHz)
velocity_error = velocity_command - measured_velocity
integral += velocity_error * dt
current_command = Kp_vel * velocity_error + Ki_vel * integral
# Current loop (10 kHz)
current_error = current_command - measured_current
voltage_command = Kp_cur * current_error
pwm_duty = voltage_command / battery_voltage
Advantages:
- Precise position tracking
- Smooth motion with velocity feedforward
- Current limiting protects motor and driver
Protection and Safety
Overcurrent Protection
if measured_current > I_max:
disable_pwm()
set_fault_flag(OVERCURRENT)
require_reset()
Implementation:
- Hardware comparator (fast, <1 μs response)
- Software monitoring (backup, ~100 μs response)
- Foldback current limiting (gradual reduction)
Thermal Protection
T_estimated = T_ambient + I² × R × R_th
if T_estimated > T_max:
reduce_current_limit()
log_warning()
if T_estimated > T_critical:
disable_drive()
set_fault_flag(OVERTEMP)
Stall Detection
A stalled motor draws maximum current but produces no motion:
if current > stall_threshold and velocity == 0 for > stall_time:
disable_pwm()
set_fault_flag(STALL)
Safe Torque Off (STO)
Industrial safety standard (IEC 61800-5-2):
- Independent hardware circuit cuts PWM signals
- Response time <1 ms
- SIL 3 / PLe safety rating
- Used in collaborative robots for human proximity detection
Power Supply Considerations
Battery Selection
| Chemistry | Nominal V | Energy Density | Discharge Rate | Cycles | Cost |
|---|---|---|---|---|---|
| LiPo | 3.7V/cell | 150-200 Wh/kg | 20-100C | 300-500 | Medium |
| LiFePO4 | 3.2V/cell | 90-120 Wh/kg | 5-30C | 2000+ | Medium |
| Li-Ion 18650 | 3.6V/cell | 250 Wh/kg | 3-10C | 500-1000 | Low |
| NiMH | 1.2V/cell | 60 Wh/kg | 5-10C | 500 | Low |
For mobile robots: LiPo or LiFePO4 (lightweight, high discharge) For stationary robots: Li-Ion 18650 or AC power (cost, longevity)
Voltage Regulation
Motors need direct battery voltage, but logic needs 3.3V/5V:
Battery (12V-48V)
|
+--> DC-DC Buck --> 5V (motor driver logic)
| |
| +--> LDO --> 3.3V (microcontroller, sensors)
|
+--> Direct to H-bridge (motor power)
Important: Keep motor power and logic grounds separate (star grounding) to prevent noise coupling.
Practical Design Example
Application: 6-DOF robot arm joint
- Motor: BLDC, 24V, 5A continuous, 15A peak
- Control: Position servo with encoder
- Communication: CAN bus to central controller
Driver Selection:
- Architecture: 3-phase bridge + FOC
- Voltage: 30V max (24V + margin)
- Current: 20A peak capability
- Interface: CANopen + encoder input
- Safety: STO input
Selected: Elmo Gold Solo Twitter (compact servo drive)
- Voltage: 12-100V
- Current: 8A continuous / 16A peak
- Encoder: Incremental + absolute support
- Communication: EtherCAT, CANopen
- Safety: STO, SIL 3
- Cost: ~$800
Power Budget:
6 joints × 24V × 5A × 0.8 (efficiency) = 576W mechanical
Battery: 24V × 25Ah LiFePO4 = 600Wh
Runtime at full load: 600Wh / 576W = ~1 hour
Actual runtime (partial load): 3-4 hours
Summary
| Key Point | Takeaway |
|---|---|
| H-bridge | Fundamental circuit for bidirectional DC motor control |
| PWM | Duty cycle controls effective voltage and speed |
| MOSFETs | Dominant switch technology; GaN/SiC emerging for high performance |
| Driver types | DC H-bridge, stepper chopper, BLDC ESC, servo FOC |
| Protection | Overcurrent, thermal, stall detection — mandatory for reliability |
| Safety | STO (Safe Torque Off) for collaborative robots |
| Power | Battery selection and grounding critical for noise immunity |
Further Reading
- Application Note: Texas Instruments “Understanding Motor Driver Current Ratings”
- Book: Mohan, Undeland, Robbins — Power Electronics: Converters, Applications, and Design
- Open Source: ODrive Documentation (odriverobotics.com) — FOC controller for robotics
- Open Source: VESC Project (vedder.se) — open-source BLDC controller
Tomorrow (Day 6): Python Practice — Building a Motor Control Simulator.