The direct answer to how do you control the speed of a DC motor is by using Pulse Width Modulation (PWM) via a dedicated motor driver IC or MOSFET H-bridge. By rapidly switching the supply voltage on and off (typically between 16kHz and 25kHz), you vary the effective average voltage reaching the armature. This dictates the motor's RPM without wasting massive amounts of power as heat, which is exactly what happens if you try to use a linear resistor or transistor to drop the voltage.
But slapping a PWM signal on a gate isn't enough. You need to match the motor type to your load profile, size the driver to survive the inevitable stall currents, and wire the terminals correctly. Here is the bench-tested guide to doing it right.
The Core Method: PWM and Driver Sizing
A DC motor's speed is roughly proportional to the applied voltage, while its torque is proportional to the current. When you use PWM, you are essentially tricking the motor's inductance into smoothing out the voltage pulses into a lower average DC level. A 12V motor driven with a 50% duty cycle PWM at 20kHz behaves much like it's connected to a 6V battery, but with vastly superior thermal efficiency in your control circuitry.
Sizing Rule of Thumb and Worked Load Example
The most common mistake makers make is sizing a motor driver based on the motor's continuous current rating. Motors don't draw continuous current when they start, stall, or reverse; they draw stall current.
The Rule of Thumb: Size your motor driver to handle at least 1.5× the motor’s continuous current for thermal headroom, AND ensure its peak current rating exceeds the motor’s absolute stall current.
Worked Example: You are building a motorized winch using a 12V brushed DC gearmotor. The datasheet states it draws 4A continuously under load, has an internal armature resistance of 0.8Ω, and peaks at 14A during a hard stall.
- Continuous Requirement: 4A × 1.5 = 6A continuous driver rating.
- Peak/Stall Requirement: 12V / 0.8Ω = 15A stall current. Driver must survive >15A peak.
- Component Selection: The popular L298N driver (2A continuous, 3A peak) will instantly trigger its thermal shutdown or melt. The Texas Instruments DRV8701 or a BTS7960-based module (43A peak, ~$12) is the correct choice here.
DC Motor Types, Torque Curves, and Load Profiles
Not all 'DC motors' are controlled the same way. A brushed motor needs a simple H-bridge, while a brushless motor requires a 3-phase inverter and complex commutation algorithms. Steppers and servos are entirely different beasts and are not interchangeable with standard continuous-rotation DC drives.
| Motor Type | Torque Curve Profile | Control Needs & Driver Demands | Relative Cost | Best Load Profile |
|---|---|---|---|---|
| Brushed DC (BDC) | High starting torque, drops linearly as speed increases. | Simple H-Bridge (e.g., VNH5019). PWM on enable pin or phase-locked PWM. | Low ($2 - $15) | Wipers, winches, basic conveyors, RC cars. |
| Brushless DC (BLDC) | Flat torque curve up to base speed, then drops. | 3-Phase Inverter + ESC or FOC controller (e.g., ODrive, SimpleFOC). Requires Hall sensors or sensorless back-EMF zero-crossing detection. | High ($40 - $150+) | Drones, e-bikes, CNC spindles, high-efficiency robotics. |
| Stepper | Maximum torque at zero speed (holding torque), drops off sharply at high RPM. | Constant-current chopper driver (e.g., TMC2209). Requires precise step-pulse timing, not just voltage PWM. | Medium ($10 - $30) | 3D printers, low-speed precision positioning. (Not for high-speed continuous rotation). |
| RC Servo | High torque within a limited 180° to 270° arc. | 50Hz PWM pulse (1ms to 2ms width) for position, not continuous speed. Internal potentiometer and H-bridge handle the rest. | Low to Med ($5 - $25) | Robotic arms, RC steering, camera gimbals. |
Wiring, Terminal Identification, and Commutation
Getting the physical connections right is where most debugging time is spent. Here is how to identify and wire the terminals for the two most common speed-controlled motors: Brushed and Brushless.
Brushed DC (BDC) Terminals
A standard BDC motor has two terminals, usually labeled M1/M2, A/B, or simply colored Red/Black.
- Wiring: Connect these to the OUT1 and OUT2 (or A and B) terminals of your H-bridge driver. Polarity doesn't matter for basic operation; reversing the wires simply reverses the default direction of rotation.
- The Flyback Diode: Motors are massive inductors. When your PWM signal switches 'off', the collapsing magnetic field generates a massive reverse voltage spike. Most modern driver ICs (like the DRV8701) have internal freewheeling diodes. If you are building a discrete MOSFET H-bridge, you must add external Schottky diodes across the motor terminals, or the voltage spike will punch through your MOSFETs.
Brushless DC (BLDC) Terminals
BLDC motors are essentially 3-phase AC synchronous motors driven by DC. They have two distinct wiring harnesses.
- Phase Wires (U, V, W): These are the three thick wires (often Yellow, Blue, Green). They connect to the 3-phase output terminals of your ESC or FOC driver. Swapping any two of these wires will reverse the motor's direction.
- Hall Sensor Wires: For closed-loop speed control, the motor needs to know its rotor position. This harness usually has 5 thin wires: 5V (Red), GND (Black), HU (Yellow), HV (Green), HW (Blue). These must connect to the driver's sensor inputs to enable precise commutation. Running a BLDC 'sensorless' relies on back-EMF and often results in rough, stuttering startup.
Failure Signatures: Diagnosing Hum, Overheat, and Stall
When your speed control circuit fails, the motor and driver will give you physical and acoustic clues. Here is how to read them.
1. The High-Pitched Hum (Acoustic Noise)
Symptom: The motor emits an annoying, high-pitched whine that changes pitch with the PWM duty cycle.
Cause: Your PWM frequency is too low. If you run a motor at 500Hz to 2kHz, the physical windings and laminations vibrate at that frequency (magnetostriction), acting as a speaker.
Fix: Increase your microcontroller's PWM timer frequency to at least 16kHz to 20kHz. This pushes the switching noise above the upper limit of human hearing. Be aware that pushing past 50kHz increases switching losses in your MOSFETs, requiring larger heatsinks.
2. Driver Overheat and Thermal Shutdown
Symptom: The motor runs for 30 seconds, stops abruptly, and the driver IC is too hot to touch. It resumes after cooling down.
Cause: You are exceeding the continuous RMS current rating of the driver package, or you have insufficient 'dead-time' in your H-bridge logic.
Fix: First, check your dead-time. If both the high-side and low-side MOSFETs in an H-bridge leg turn on simultaneously for even a microsecond, you short the power supply directly to ground (shoot-through), causing massive heat. Second, ensure your driver's continuous current rating matches the 1.5× rule of thumb mentioned earlier, and add a copper-pour heatsink or forced air cooling.
3. Hard Stall and Silicon Melt
Symptom: The motor mechanically jams. The driver IC physically cracks, vents magic smoke, or the PCB traces lift.
Cause: The motor stalled, drawing locked-rotor stall current ($I = V/R_{armature}$). The driver lacked Overcurrent Protection (OCP) or the OCP threshold was set too high.
Fix: Use drivers with built-in hardware current limiting (like the TI DRV series). Set the current sense resistor ($R_{sense}$) and the IPROPI pin voltage to trigger a fault and shut down the gates before the thermal mass of the silicon reaches its destruction point.
Frequently Asked Questions
How do you control the speed of a DC motor with a potentiometer?
You cannot wire a potentiometer directly in series with a DC motor to act as a variable resistor (rheostat). The motor will draw hundreds of milliamps, instantly burning out the carbon track inside a standard 10kΩ or 1kΩ pot. Instead, wire the potentiometer as a voltage divider to an analog input pin on a microcontroller (or to the reference pin of a dedicated PWM generator IC like the TL494). The microcontroller reads the voltage and outputs a corresponding PWM duty cycle to the motor driver.
How do you control the speed of a DC motor using PWM?
You generate a square wave (e.g., 20kHz) from a microcontroller or 555 timer circuit and feed it into the 'Enable' or 'PWM' pin of a motor driver IC. By changing the ratio of the 'ON' time to the 'OFF' time (the duty cycle), you change the average voltage the motor sees. A 25% duty cycle on a 12V supply yields roughly 3V at the motor terminals, resulting in low speed; an 80% duty cycle yields roughly 9.6V for high speed.
How do you control the speed of a 12V DC motor without a microcontroller?
If you want to avoid coding an Arduino or ESP32, use a standalone PWM generator module based on a 555 timer or a dedicated chip like the XL4015 (often sold as 'DC Motor Speed Control Modules' for $3 to $5). These boards have a built-in potentiometer, generate the high-frequency PWM signal internally, and include a beefy MOSFET on the board to handle up to 10A or 20A directly. You just wire your 12V power in, and the motor out.
Why does my DC motor stall or lose torque at low PWM duty cycles?
At very low duty cycles (e.g., 5%), the 'ON' pulses are so short that the motor's inductance prevents the current from ramping up to the level required to generate enough torque to overcome static friction. The voltage is low, and the current never peaks. To fix this, you can either implement 'current-mode control' (where the driver actively monitors and pushes current to maintain torque) or apply a brief 100% duty cycle 'kick' pulse to break static friction before dropping back down to your target low-speed PWM duty cycle.






