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

TypeControl MethodPrecisionSpeedTorqueUse Case
DC brushedPWM voltageLowHighLow-mediumSimple mechanisms, toys
DC brushless (BLDC)ESC (electronic commutation)MediumVery highMediumDrones, fans, pumps
StepperStep pulsesVery high (open loop)LowMedium3D printers, CNC
ServoPWM position signalHighMediumMediumRobot arms, RC, pan/tilt
Linear actuatorVoltage/PWMLowLowHighLocks, 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

ModeStep AngleSmoothnessTorque
Full step1.8°LowestHighest
Half step0.9°Better~70%
1/16 microstep0.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).