Back to Sensors & Actuators Series

Part 5: Actuators Deep Dive

July 14, 2025 Wasil Zafar 45 min read

Everything about actuators — DC motors, stepper motors, servos, solenoids, piezoelectric actuators, and pneumatic/hydraulic systems with driver circuits and code.

Table of Contents

  1. DC Motors
  2. Stepper Motors
  3. Servo Motors
  4. Solenoids & Relays
  5. Piezoelectric Actuators
  6. Pneumatic & Hydraulic
  7. Conclusion & Next Steps
Actuator Classification Taxonomy
graph TD
    A["⚡ Actuators"] --> E["Electric Motors"]
    A --> EM["Electromagnetic"]
    A --> FP["Fluid Power"]
    A --> AD["Advanced"]
    E --> E1["Brushed DC"]
    E --> E2["Brushless DC"]
    E --> E3["Stepper"]
    E --> E4["Servo"]
    EM --> EM1["Solenoids"]
    EM --> EM2["Relays"]
    FP --> FP1["Pneumatic"]
    FP --> FP2["Hydraulic"]
    AD --> AD1["Piezoelectric"]
    AD --> AD2["Shape Memory
Alloy"] AD --> AD3["Soft Robotics"] style A fill:#3B9797,stroke:#3B9797,color:#fff style E fill:#e8f4f4,stroke:#3B9797,color:#132440 style EM fill:#f0f4f8,stroke:#16476A,color:#132440 style FP fill:#e8f4f4,stroke:#3B9797,color:#132440 style AD fill:#f0f4f8,stroke:#16476A,color:#132440

DC Motors

Brushed DC Motors

The simplest and most ubiquitous electric motor. Brushed DC motors use mechanical commutation through carbon brushes that contact a rotating commutator, switching current direction in the armature coils to maintain rotation.

Brushed DC Motor Specifications

Motor Selection Guide
ParameterDescriptionTypical Range
Rated VoltageNominal operating voltage3V, 6V, 12V, 24V
No-Load SpeedRPM with no torque load100–30,000 RPM
Stall TorqueMaximum torque at zero speed0.1–100+ kg·cm
Stall CurrentCurrent drawn when rotor is locked0.5–50A
No-Load CurrentCurrent with no mechanical load10–500 mA
Motor Constant (Kv)RPM per voltMotor-specific
Driving Brushed DC Motors:
  • MOSFET switch: Single direction, PWM speed control (N-channel, logic-level gate)
  • H-Bridge: Bidirectional control (forward/reverse) + speed via PWM
  • Driver ICs: L298N (dual H-bridge, 2A), TB6612FNG (1.2A, efficient), DRV8871 (3.6A, single)
  • Flyback diode: ALWAYS required across motor terminals to protect against back-EMF spikes
// PWM motor control with STM32 timer
#include "stm32f4xx.h"

// TIM3 CH1 on PA6 → motor driver PWM input
void motor_pwm_init(void) {
    RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
    RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;

    // PA6 alternate function (AF2 = TIM3_CH1)
    GPIOA->MODER  |= (2U << 12);
    GPIOA->AFR[0] |= (2U << 24);

    // TIM3: 20 kHz PWM (84 MHz / (84 * 50) = 20 kHz)
    TIM3->PSC  = 84 - 1;     // 1 MHz timer clock
    TIM3->ARR  = 50 - 1;     // 20 kHz period
    TIM3->CCR1 = 0;          // Start at 0% duty
    TIM3->CCMR1 = (6U << 4) | TIM_CCMR1_OC1PE;  // PWM mode 1
    TIM3->CCER  = TIM_CCER_CC1E;
    TIM3->CR1  |= TIM_CR1_CEN;
}

// Set motor speed (0-100%)
void motor_set_speed(uint8_t percent) {
    if (percent > 100) percent = 100;
    TIM3->CCR1 = (uint32_t)percent * (TIM3->ARR + 1) / 100;
}

// Direction control via GPIO (connected to H-Bridge IN1/IN2)
void motor_set_direction(uint8_t forward) {
    if (forward) {
        GPIOB->BSRR = (1U << 0);          // PB0 = IN1 HIGH
        GPIOB->BSRR = (1U << (1 + 16));   // PB1 = IN2 LOW
    } else {
        GPIOB->BSRR = (1U << (0 + 16));   // PB0 = IN1 LOW
        GPIOB->BSRR = (1U << 1);          // PB1 = IN2 HIGH
    }
}

Brushless DC (BLDC) Motors

BLDC motors replace mechanical brushes with electronic commutation. Permanent magnets are on the rotor; stator coils are energized in sequence by an Electronic Speed Controller (ESC). Advantages include higher efficiency, longer life, less noise, and better power-to-weight ratio.

BLDC Commutation Methods:
  • Trapezoidal (6-step): Simplest, uses Hall sensors for rotor position. Two phases energized at a time
  • Sinusoidal: Smooth torque, requires encoder or resolver for precise position feedback
  • Field Oriented Control (FOC): Best performance, transforms 3-phase currents to direct/quadrature components via Clarke-Park transforms. Used in industrial servo drives and EV motors
  • Sensorless: Detects back-EMF zero-crossing to determine rotor position. No Hall sensors needed above minimum speed

Gear Motors & Encoders

Gear motors combine a DC motor with a gearbox to trade speed for torque. Common gear ratios range from 10:1 to 300:1. Adding a rotary encoder enables closed-loop position and speed control.

Stepper Motors

Stepper motors rotate in precise, discrete steps (typically 1.8° = 200 steps/revolution). They provide open-loop position control — each pulse advances exactly one step — making them ideal for CNC machines, 3D printers, and precision positioning.

Unipolar vs Bipolar

Stepper Motor Types

FeatureUnipolar (5/6 wire)Bipolar (4 wire)
CoilsCenter-tapped, only half winding usedFull winding
Torque~70% of bipolar (half coil)Higher torque (full coil)
DriverSimple: 4 transistors (ULN2003)H-Bridge per phase (A4988, DRV8825)
ComplexitySimpler drive circuitMore complex driver
Common Parts28BYJ-48 (cheap, low torque)NEMA 17, NEMA 23

Stepping Modes

Stepper Motor Stepping Modes:
  • Full Step: One phase energized at a time. 200 steps/rev. Maximum torque per step
  • Half Step: Alternates between one and two phases. 400 steps/rev. Smoother motion
  • Microstepping: Sine/cosine current waveforms. 1/2 to 1/256 microsteps. Very smooth but reduced holding torque at high microstepping

Stepper Drivers

// A4988 stepper driver control (Step/Dir interface)
#include "stm32f4xx.h"

#define STEP_PIN  (1U << 0)   // PA0 = STEP
#define DIR_PIN   (1U << 1)   // PA1 = DIR
#define EN_PIN    (1U << 2)   // PA2 = ENABLE (active low)

void stepper_init(void) {
    RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
    GPIOA->MODER |= (1U << 0) | (1U << 2) | (1U << 4);  // Output

    GPIOA->BSRR = EN_PIN;     // Disable driver (active low)
}

void stepper_enable(void) {
    GPIOA->BSRR = (EN_PIN << 16);  // EN = LOW (enable)
}

void stepper_set_direction(uint8_t clockwise) {
    if (clockwise)
        GPIOA->BSRR = DIR_PIN;
    else
        GPIOA->BSRR = (DIR_PIN << 16);
}

void stepper_step(void) {
    GPIOA->BSRR = STEP_PIN;         // STEP HIGH
    for (volatile int i = 0; i < 84; i++);  // ~1us pulse
    GPIOA->BSRR = (STEP_PIN << 16); // STEP LOW
}

void stepper_move_steps(int32_t steps) {
    stepper_set_direction(steps > 0);
    uint32_t abs_steps = (steps > 0) ? steps : -steps;

    for (uint32_t i = 0; i < abs_steps; i++) {
        stepper_step();
        // Delay for desired speed (e.g., 1ms = 1000 steps/sec)
        for (volatile int d = 0; d < 84000; d++);
    }
}

Servo Motors

Hobby Servos (PWM)

Hobby servos are closed-loop actuators with a built-in motor, gearbox, position potentiometer, and control circuit. They accept a 50 Hz PWM signal where pulse width determines position:

Servo PWM Specifications

ParameterStandard ServoExtended Range
PWM Frequency50 Hz (20 ms period)50 Hz
Min Position (0°)1.0 ms pulse0.5 ms
Center (90°)1.5 ms pulse1.5 ms
Max Position (180°)2.0 ms pulse2.5 ms
Signal Voltage3.3V or 5V logic3.3V or 5V
#!/usr/bin/env python3
"""Control servo motor with Raspberry Pi PWM"""

import RPi.GPIO as GPIO
import time

SERVO_PIN = 18  # GPIO18 (hardware PWM)

GPIO.setmode(GPIO.BCM)
GPIO.setup(SERVO_PIN, GPIO.OUT)

# 50 Hz PWM for servo
pwm = GPIO.PWM(SERVO_PIN, 50)
pwm.start(0)

def set_angle(angle):
    """Set servo angle (0-180 degrees)"""
    # Map angle to duty cycle: 0° = 2.5%, 180° = 12.5%
    duty_cycle = 2.5 + (angle / 180.0) * 10.0
    pwm.ChangeDutyCycle(duty_cycle)
    time.sleep(0.5)  # Wait for servo to reach position

# Sweep servo through positions
positions = [0, 45, 90, 135, 180, 90]
for angle in positions:
    print(f"Moving to {angle}°")
    set_angle(angle)

pwm.stop()
GPIO.cleanup()

Industrial Servo Systems

Industrial Servo vs Hobby Servo:
  • Feedback: High-resolution encoders (17-bit+) vs potentiometer
  • Control: FOC with current/velocity/position loops vs simple PWM position
  • Communication: EtherCAT, CANopen, RS485 vs PWM signal
  • Power: 100W–50kW vs 1–10W
  • Brands: Yaskawa, Mitsubishi, Siemens, ABB, Fanuc

Solenoids & Relays

Linear Solenoids

A solenoid is an electromagnetic actuator that converts electrical energy into linear (push/pull) motion. When current flows through the coil, the magnetic field pulls a ferromagnetic plunger into the core.

// Solenoid control with MOSFET and flyback diode
#include "stm32f4xx.h"

#define SOLENOID_PIN (1U << 5)  // PA5 → N-MOSFET gate

void solenoid_init(void) {
    RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
    GPIOA->MODER |= (1U << 10);  // PA5 output
    GPIOA->BSRR = (SOLENOID_PIN << 16);  // Start OFF
}

void solenoid_activate(void) {
    GPIOA->BSRR = SOLENOID_PIN;  // Gate HIGH → MOSFET ON → solenoid energized
}

void solenoid_deactivate(void) {
    GPIOA->BSRR = (SOLENOID_PIN << 16);  // Gate LOW → MOSFET OFF
    // Flyback diode (across solenoid) handles back-EMF safely
}

// PWM hold: reduce power after initial pull-in
// Solenoids need full power to pull in, but only ~30% to hold
void solenoid_activate_with_hold(void) {
    solenoid_activate();
    // Full power for 50ms pull-in
    for (volatile int i = 0; i < 4200000; i++);
    // Reduce to 30% PWM for hold (saves power and heat)
    // Switch to timer PWM output on PA5
}

Electromechanical Relays

A relay is a solenoid-actuated switch that uses a small control current to switch a much larger load current. They provide galvanic isolation between control and load circuits.

Relay Selection:
  • Mechanical Relay: Handles AC/DC, high current (10-30A), audible click. Slow (5-20ms). Limited lifecycle (100K-1M cycles)
  • Solid-State Relay (SSR): No moving parts, fast (<1ms), silent, long life. Better for frequent switching
  • Reed Relay: Very small, fast (0.5-2ms), low contact resistance. Low current only (0.5-1A)

Piezoelectric Actuators

Piezoelectric materials (PZT ceramics) expand or contract when voltage is applied, providing sub-nanometer positioning precision. They require high voltage (100-1000V) but consume almost no current (capacitive load).

Piezoelectric Actuator Types

TypeMotionTravelApplication
Stack (multilayer)Linear, sub-nm to ~100 µm0.1%–0.15% of lengthNanopositioning, fuel injectors
Bending (bimorph)Deflection up to several mmHigher travel, lower forceValves, micro-pumps, speakers
ShearLateral displacement1–10 µmAFM scanners, optical mounts
TubeXYZ scanning~10 µm per axisSTM/AFM microscopes

Pneumatic & Hydraulic Systems

Pneumatic actuators use compressed air, while hydraulic actuators use pressurized fluid. Both convert fluid pressure into linear or rotary motion.

Pneumatic vs Hydraulic:
  • Pneumatic: Clean, fast, simple. Lower force (~100-5000N). Compressible medium = less precise position control. Used in pick-and-place, packaging, clamping
  • Hydraulic: Very high force (kN to MN). Incompressible fluid = precise motion. Heavy, requires return lines. Used in excavators, presses, aircraft landing gear
  • Control valves: Solenoid-operated directional valves (2/2, 3/2, 5/2, 5/3) controlled by MCU GPIO through relay or MOSFET
  • Proportional valves: PWM-controlled for variable flow rate and pressure

Conclusion & Next Steps

Actuators are the muscles of embedded systems — converting electrical signals into physical motion. From the simplicity of brushed DC motors to the precision of piezoelectric stacks, each technology serves different force, speed, precision, and cost requirements.

Key Takeaways:
  • Brushed DC motors are simple but need H-bridges for bidirectional control
  • BLDC motors offer superior efficiency with electronic commutation
  • Stepper motors provide open-loop position control in precise steps
  • Servo motors combine motor + gearbox + feedback for closed-loop positioning
  • Always include flyback diodes on inductive loads (motors, solenoids, relays)

In Part 6, we cover Actuator Control Systems — PWM generation, H-Bridge circuit design, PID control theory, and closed-loop feedback implementation.