Overview & History
The DC motor is the workhorse of the actuator world—found in everything from children’s toys to industrial conveyor belts. Invented in the 1830s, the brushed DC motor converts direct-current electrical energy into rotational mechanical energy through the interaction of a magnetic field and current-carrying conductors.
Two main sub-types dominate embedded applications:
- Brushed DC motors – Use carbon brushes and a commutator for current switching. Simple, inexpensive, but brushes wear over time.
- Coreless DC motors – Replace the iron core with a self-supporting copper coil. Lower inertia, faster response, used in medical devices and drones.
Working Principle
A brushed DC motor operates on the Lorentz force principle. When current flows through a conductor placed in a magnetic field, a force is exerted on the conductor perpendicular to both the current direction and the magnetic field.
Brushed Motor Architecture
- Stator: Permanent magnets (or field windings) create a stationary magnetic field.
- Rotor (Armature): Wound copper coils mounted on a shaft that rotates inside the stator field.
- Commutator: Segmented copper ring that reverses current direction every half-turn, ensuring continuous rotation.
- Brushes: Spring-loaded carbon or graphite contacts that press against the commutator to deliver current.
Back-EMF Equation
As the motor spins, it generates a voltage opposing the supply (back-EMF):
V = IR + Keω
Where V = supply voltage, I = current, R = winding resistance, Ke = back-EMF constant, ω = angular velocity. At steady state, the motor draws just enough current to overcome friction and load torque.
Coreless Motor Differences
Coreless motors eliminate the iron armature core. The rotor is a thin, cylindrical copper coil that spins inside a permanent magnet housing. Benefits include:
- Very low rotor inertia → fast acceleration/deceleration
- No cogging torque → smooth rotation at low speeds
- Compact form factor ideal for micro-applications
- Higher efficiency at lower loads
Electrical & Mechanical Specifications
| Parameter | Brushed DC (typical) | Coreless DC (typical) |
|---|---|---|
| Voltage Range | 3 V – 48 V | 1.5 V – 12 V |
| Current (no-load) | 50–200 mA | 20–80 mA |
| Stall Current | 0.5–5 A | 0.2–2 A |
| Speed (no-load) | 3,000–20,000 RPM | 5,000–30,000 RPM |
| Stall Torque | 10–500 mN·m | 1–50 mN·m |
| Efficiency | 50–75% | 70–90% |
| Lifespan | 1,000–5,000 hrs | 2,000–10,000 hrs |
| Weight | 10 g – 2 kg | 1–50 g |
Driver Circuits
DC motors require driver circuits because microcontrollers cannot supply enough current directly. Common driver topologies include:
H-Bridge (L298N / L293D)
The H-bridge is the standard bidirectional DC motor driver. Four switches (transistors or MOSFETs) arranged in an “H” pattern allow current to flow through the motor in either direction.
- L293D: Dual H-bridge, up to 600 mA per channel (1.2 A peak). Built-in flyback diodes. Good for small motors.
- L298N: Dual H-bridge, up to 2 A per channel (3 A peak). Needs external flyback diodes. Module includes 5 V regulator.
- TB6612FNG: Modern MOSFET-based driver, 1.2 A continuous, lower voltage drop than L298N, higher efficiency.
MOSFET Driver (for single-direction)
For unidirectional speed control, a single N-channel MOSFET (e.g., IRLZ44N) with a flyback diode is the simplest and most efficient approach. PWM signal on the gate controls speed.
Control Methods
PWM Speed Control
Pulse Width Modulation is the primary method for controlling DC motor speed. By rapidly switching the supply voltage on and off, the average voltage delivered to the motor is varied:
- Duty Cycle 0% → Motor off
- Duty Cycle 50% → Half speed (approximately)
- Duty Cycle 100% → Full speed
Typical PWM frequencies for DC motors: 1–25 kHz. Higher frequencies reduce audible noise but increase switching losses.
PID Closed-Loop Speed Control
For precise speed regulation, combine PWM with an encoder feedback and PID controller. The encoder measures actual RPM, and the PID algorithm adjusts the duty cycle to maintain the setpoint despite load changes.
Direction Control
With an H-bridge, direction is controlled via two logic pins (IN1, IN2). Truth table for L298N:
| IN1 | IN2 | Motor Action |
|---|---|---|
| HIGH | LOW | Forward |
| LOW | HIGH | Reverse |
| LOW | LOW | Coast (free-spin) |
| HIGH | HIGH | Brake (short) |
Code Example — Arduino & ESP32
Arduino + L298N: Speed & Direction
// DC Motor control with L298N on Arduino
// Wiring: ENA→D9(PWM), IN1→D7, IN2→D8, Motor→OUT1/OUT2
const int ENA = 9; // PWM speed control
const int IN1 = 7; // Direction pin 1
const int IN2 = 8; // Direction pin 2
void setup() {
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
Serial.begin(9600);
}
void setMotor(int speed, bool forward) {
// speed: 0-255 (PWM duty cycle)
digitalWrite(IN1, forward ? HIGH : LOW);
digitalWrite(IN2, forward ? LOW : HIGH);
analogWrite(ENA, speed);
}
void stopMotor() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
analogWrite(ENA, 0);
}
void loop() {
Serial.println("Forward - 50% speed");
setMotor(128, true);
delay(3000);
Serial.println("Reverse - 75% speed");
setMotor(192, false);
delay(3000);
Serial.println("Brake");
stopMotor();
delay(2000);
}
ESP32: PWM Speed Control with LEDC
// DC Motor PWM control on ESP32 using LEDC
// Wiring: ENA→GPIO25, IN1→GPIO26, IN2→GPIO27
#include <Arduino.h>
const int ENA_PIN = 25;
const int IN1_PIN = 26;
const int IN2_PIN = 27;
// LEDC PWM config
const int PWM_CHANNEL = 0;
const int PWM_FREQ = 20000; // 20 kHz - above audible range
const int PWM_RESOLUTION = 8; // 0-255
void setup() {
Serial.begin(115200);
pinMode(IN1_PIN, OUTPUT);
pinMode(IN2_PIN, OUTPUT);
// Configure LEDC PWM
ledcSetup(PWM_CHANNEL, PWM_FREQ, PWM_RESOLUTION);
ledcAttachPin(ENA_PIN, PWM_CHANNEL);
}
void setMotor(int speed, bool forward) {
digitalWrite(IN1_PIN, forward ? HIGH : LOW);
digitalWrite(IN2_PIN, forward ? LOW : HIGH);
ledcWrite(PWM_CHANNEL, abs(speed));
}
void loop() {
// Ramp up speed
for (int spd = 0; spd <= 255; spd += 5) {
setMotor(spd, true);
Serial.printf("Speed: %d/255\n", spd);
delay(100);
}
delay(2000);
// Ramp down
for (int spd = 255; spd >= 0; spd -= 5) {
setMotor(spd, true);
delay(100);
}
delay(1000);
}
Real-World Applications
Robotics & Vehicles
- Differential-drive robot platforms
- RC cars and drones (coreless)
- Tracked vehicles and conveyor belts
- Robotic arm joint drives
Industrial & Consumer
- Power tools (drills, saws)
- Automotive: window lifts, wipers, seat adjustment
- Fans, pumps, and blowers
- Toys, electric toothbrushes
Advantages vs. Alternatives
| vs. Actuator | DC Motor Advantage | DC Motor Disadvantage |
|---|---|---|
| Stepper Motor | Higher top speed, simpler driver, lower cost | No inherent position holding; needs encoder for positioning |
| Servo Motor | Continuous rotation, higher speed, cheaper | No built-in position feedback |
| BLDC Motor | Simpler driver circuit, lower cost | Brush wear limits lifespan; lower efficiency |
| Solenoid | Continuous rotation vs. linear push/pull only | Cannot provide high instantaneous force |
Limitations & Considerations
- Brush Wear: Carbon brushes degrade over time, generating dust and electrical noise. Lifespan typically 1,000–5,000 hours.
- Electromagnetic Interference: Brush arcing creates EMI. Add 100 nF ceramic capacitors across motor terminals and from each terminal to the motor case.
- No Inherent Position Control: Unlike servos or steppers, a brushed DC motor has no built-in position feedback. Encoders must be added for closed-loop positioning.
- Heat Dissipation: At high loads, I²R losses in windings and brush friction generate significant heat. Thermal management may be needed.
- Inductive Kickback: Always include flyback diodes and decoupling capacitors to protect control electronics.
- Non-linear Response: Speed is not perfectly proportional to voltage due to friction, back-EMF, and load variations. PID control recommended for precision.