Motors and Actuators
Motors convert electrical energy into mechanical motion. The choice of motor type — DC brushed, brushless, stepper, or servo — depends on the required speed, torque, precision, and control complexity. Understanding motor physics and control is essential for any system that moves.
Why It Matters
Every robot has actuators. Drones use brushless motors. 3D printers use steppers. Robot arms use servos or geared DC motors. Knowing the motor model (back-EMF, torque constant), control method (PWM, commutation), and practical considerations (gear ratios, heat) determines whether your robot performs or stalls.
Motor Types
| Type | Control Method | Precision | Speed | Torque | Use Case |
|---|---|---|---|---|---|
| DC brushed | PWM voltage | Low | High | Low-medium | Simple mechanisms, toys |
| DC brushless (BLDC) | ESC (electronic commutation) | Medium | Very high | Medium | Drones, fans, pumps |
| Stepper | Step pulses | Very high (open loop) | Low | Medium | 3D printers, CNC |
| Servo | PWM position signal | High | Medium | Medium | Robot arms, RC, pan/tilt |
| Linear actuator | Voltage/PWM | Low | Low | High | Locks, valves, platforms |
DC Motor Model
A DC motor is governed by two coupled equations:
Electrical: V = R·I + L·dI/dt + Ke·ω (Ke = back-EMF constant)
Mechanical: J·dω/dt = Kt·I - b·ω - τ_load (Kt = torque constant, Ke = Kt)
At steady state: ω = (V - R·I) / Ke. Higher voltage → higher speed. More load → more current → more torque.
PWM Speed Control
Average voltage = duty cycle × supply voltage. At 50% duty, 12V supply → average 6V → roughly half speed.
// Motor speed via PWM duty cycle
// TIM->ARR = 999 (1kHz PWM at 1MHz timer)
void set_motor_speed(uint16_t duty) { // 0-999
TIM2->CCR1 = duty;
}An H-bridge enables bidirectional control (forward/reverse):
VCC VCC
| |
[Q1 HIGH] [Q2 LOW]
| |
+---- Motor ----+
| |
[Q3 LOW] [Q4 HIGH]
| |
GND GND
Q1+Q4 ON: current flows left→right (forward)
Q2+Q3 ON: current flows right→left (reverse)
Never Q1+Q2 or Q3+Q4 simultaneously! (shoot-through = short circuit)
Brushless DC Motors (BLDC)
No brushes — commutation is electronic. Three-phase windings, permanent magnet rotor. Higher efficiency, longer life, higher speed than brushed.
ESC (Electronic Speed Controller): reads motor position (back-EMF or Hall sensors) and sequences the three phases:
Phase A: + + 0 - - 0 ← repeating six-step commutation
Phase B: - 0 + + 0 -
Phase C: 0 - - 0 + +
ESC input: PWM signal (1000-2000µs pulse, same as servo)
1000µs = off, 2000µs = full speed
Brushless motors are rated by KV (RPM per volt, no-load): a 2300KV motor on a 11.1V (3S) battery spins at ~25,000 RPM unloaded.
Stepper Motors
Move in precise angular steps (typically 1.8° = 200 steps/revolution). No feedback needed for positioning (open loop).
Drive Modes
| Mode | Step Angle | Smoothness | Torque |
|---|---|---|---|
| Full step | 1.8° | Lowest | Highest |
| Half step | 0.9° | Better | ~70% |
| 1/16 microstep | 0.1125° | Smooth | ~20% |
Full step sequence (2-phase on):
Step 1: A+ B+
Step 2: A- B+
Step 3: A- B-
Step 4: A+ B-
Microstepping uses current waveforms (sine/cosine) to position the rotor between full steps.
Servo Motors
DC motor + gearbox + position sensor (potentiometer) + control board, all in one package. Accepts PWM signal specifying desired angle:
PWM signal at 50 Hz (20ms period):
1.0ms pulse → 0°
1.5ms pulse → 90° (center)
2.0ms pulse → 180°
┌──┐ 20ms
─────┘ └──────────────────────────
1-2ms pulse width = angle command
// Servo on TIM2_CH1, 50Hz (PSC+ARR for 20ms period)
void set_servo_angle(float degrees) {
// Map 0-180° to 1000-2000µs pulse
float pulse_us = 1000 + (degrees / 180.0f) * 1000;
TIM2->CCR1 = (uint32_t)(pulse_us * TIM2->ARR / 20000);
}Continuous rotation servos: modified servos where 1.5ms = stop, <1.5ms = one direction, >1.5ms = other direction. Used for wheels.
Gear Ratios
Gears trade speed for torque:
output_torque = input_torque × gear_ratio
output_speed = input_speed / gear_ratio
A 10:1 gearbox gives 10× torque but 1/10 speed. Most robot joints use geared motors to achieve the high torque and low speed needed for precise movement.
Backlash: mechanical play in gears. For precision applications (robot arms), use harmonic drives or cycloidal reducers (near-zero backlash).
Related
- Transistors as Switches — H-bridge for DC motor control
- GPIO and Digital IO — PWM output for motor control
- Interrupts and Timers — PWM generation with timer peripherals
- Drone Flight Dynamics — BLDC + ESC for quadcopter propulsion
- Kinematics — joint motors drive robot arm segments
- PID Controller — closed-loop motor speed/position control