5  DC Motors

actuators
dc
motors

5.1 Start With the Story

Imagine a ventilation fan that works perfectly on the bench but stalls when dust builds up in the duct. The command did not change, but the physical load did, so the motor current, heat, and proof of airflow changed too.

That is why a DC motor story starts with the load, not the code. Choose the driver, PWM range, protection, and feedback around the worst motion the motor may face, not just the unloaded spin you can see on a desk.

Phoebe the physics guide

Phoebe’s Why

Turning “80 ms spike versus 2 s stall” into a firmware rule needs a current-sense circuit and an ADC, and each half of that chain has its own physics. The circuit half is Ohm’s law: a small sense resistor turns the motor’s 180 mA, 600 mA, and 1.8 A regimes into voltages an amplifier can lift into the ADC’s range. The digitizing half is two separate promises, easy to conflate. Quantization asks how finely each sample is resolved – that is a bit-depth question, set by the ADC’s reference voltage and word length. Sampling rate asks whether the waveform was even looked at often enough to trust what it shows – that is a Nyquist question, set by the fastest thing actually happening on that current line, which for a PWM-driven motor is the chopper switching frequency, not the slow “is it stalled yet” decision. Undersample relative to that switching ripple and the ripple does not vanish – it aliases, folding down into exactly the low-frequency band the 80 ms/2 s fault logic is trying to read cleanly.

The Derivation

Ohm’s law across the current-sense resistor, then a fixed-gain amplifier stage:

\[V_{sense} = I_{coil}\times R_{sense}, \qquad V_{out} = V_{sense}\times G\]

Nyquist sets the sampling-rate floor for the fastest real component on the line – here, the PWM chopper frequency:

\[f_s \geq 2f_{pwm}\]

An under-sampled component aliases to an apparent frequency inside the sampled band:

\[f_{alias} = \left|f_{pwm} - k f_s\right|, \quad k=\mathrm{round}(f_{pwm}/f_s)\]

Quantization step and resulting dynamic range for an \(N\)-bit ADC over reference \(V_{ref}\):

\[q = \frac{V_{ref}}{2^N}, \qquad \mathrm{SNR_{dB}} = 6.02N+1.76\]

Worked Numbers: This Chapter’s Three Current Regimes

  • Sense voltage at each of this chapter’s own currents (catalog-typical \(R_{sense}=0.1\ \Omega\), amplifier gain \(G=10\)): \(180\) mA \(\to V_{out}=0.180\) V; \(600\) mA \(\to 0.600\) V; \(1.8\) A stall \(\to 1.800\) V – three clearly separated levels before any digitizing happens
  • Quantization is not the bottleneck: a catalog-typical \(N=10\)-bit ADC on a \(3.3\) V reference gives \(q = 3.3/1024\) \(= 3.22\) mV, orders of magnitude finer than the \(0.42\)\(1.2\) V gaps between the three regimes – resolution was never the risk here
  • Sampling rate is the bottleneck: a catalog-typical \(20\) kHz motor-driver chopper frequency needs \(f_s \geq 40\) kHz by Nyquist. A control loop naively sampling the current line at \(1{,}200\) Hz instead gives \(k=\mathrm{round}(20{,}000/1{,}200)=17 \to f_{alias} = |20{,}000-17\times1{,}200|\) \(= 400\) Hz – the 20 kHz ripple reappears disguised as a 400 Hz wobble sitting squarely inside the timescale the 80 ms-spike-versus-2 s-stall logic is trying to read

5.2 Overview: DC Motors Are Continuous-Motion Loads

A DC motor converts electrical power into continuous rotation. It is a good actuator choice when an IoT system needs a fan, pump, wheel, conveyor, small gearbox, or other rotating load where speed and direction matter more than exact position.

The beginner mistake is treating a DC motor like a small LED. A motor is an inductive, moving, high-current load. A microcontroller command must cross a driver boundary, survive startup current, handle back-EMF, and produce enough physical evidence that the useful motion actually happened.

Start with the load numbers. A small 6 V gearmotor might draw 180 mA with no load, 600 mA while pushing a real mechanism, and 1.8 A when stalled. The controller pin is only a logic signal; it cannot be the motor supply. The driver, wires, connector, battery, and voltage regulator must tolerate the worst case long enough for the fault strategy to work. A driver rated for 700 mA because the motor “usually runs at 600 mA” is too close to the edge if the mechanism can jam.

PWM is a control method, not a proof of motion. A 70% duty command on a 6 V supply gives an average applied drive of roughly 0.70 x 6 = 4.2 V before motor dynamics and driver losses, but the shaft speed still depends on load torque, back-EMF, friction, and supply sag. If a fan only needs approximate airflow, open-loop PWM plus a temperature response may be enough. If a conveyor must move parts reliably, the design needs current, encoder, limit-switch, or process evidence.

Direction matters too. A one-direction fan can use a low-side MOSFET or motor-driver channel with flyback handling. A robot wheel, valve runner, or reversible roller needs an H-bridge so firmware can command forward, reverse, coast, or brake. The motor family is the same, but the driver boundary changes with the motion job.

An H-bridge places four controlled switches around a DC motor. Turning on opposite switch pairs drives current through the motor in forward or reverse direction, low-side switching can brake the motor, and turning all switches off lets the motor coast.
Figure 5.1: An H-bridge changes the current path through the same DC motor, giving firmware distinct forward, reverse, brake, and coast behaviors.

If you only need the intuition, use this rule: use PWM for speed, a transistor or H-bridge for current, protection for inductive kick, and feedback when speed or position must be proven.

5.2.1 Core DC Motor Ideas

  • Speed by average power: PWM switches the motor supply rapidly. The duty cycle changes the average delivered power, so the motor tends to run faster or slower under its current load.
  • Direction by current path: An H-bridge changes the direction of current through the motor so the shaft can rotate forward or reverse.
  • Torque by current: Higher load usually means more current. Startup, stall, jam, and heavy-load cases matter when selecting a driver and power supply.
  • Evidence by feedback: An encoder, limit switch, current measurement, airflow, pressure, or process sensor can prove more than command acknowledgement alone.

5.2.2 Beginner Example

A small ventilation fan can use a transistor or MOSFET driver and PWM if it only needs one direction. A wheeled robot needs an H-bridge because it must reverse. A conveyor may need a gearbox and feedback because the useful result is movement under load, not just a spinning shaft on the bench.

5.2.3 Overview Knowledge Check

5.3 Practitioner: Size The Driver Around The Real Load

A practical DC motor design starts with the load, not with a driver module. The record should state supply voltage, running current, startup or stall current, direction need, braking need, PWM behavior, thermal margin, protection, and the evidence used to confirm motion.

Open-loop PWM is often enough for a fan or pump where approximate flow is acceptable and another sensor can confirm the process. Closed-loop control is needed when the system must hold a target speed, track movement under changing load, or prove that a mechanism reached a useful state.

5.3.1 Review Workflow

  1. Name the mechanical job. Record whether the motor drives airflow, pumping, wheels, a roller, a valve, a gear train, or another load.
  2. Capture current evidence. Measure or obtain running, startup, and blocked-load current under representative conditions.
  3. Select the driver boundary. Use a low-side switch for one-direction loads, an H-bridge for reverse or brake, and a rated motor driver for higher current or control features.
  4. Add protection. Include inductive energy handling, supply decoupling, thermal margin, wiring limits, and safe behavior during reset or power loss.
  5. Define feedback. Decide whether speed, position, current, limit switches, airflow, pressure, or process data will confirm useful output.
  6. Retest after change. Reopen the record when the motor, gearbox, load, supply, PWM settings, driver, enclosure, or failure mode changes.

5.3.2 Driver Review Ledger

Design Item Evidence To Record Review Question Common Failure
Power stage Supply voltage, running current, startup current, blocked-load current, wiring, and thermal path. Can the driver and supply survive the real load with margin? The motor works unloaded but resets the controller or overheats under real startup load.
Control mode One-direction switch, H-bridge direction control, brake/coast behavior, PWM range, and ramp policy. Does the command set match the motion and stop behavior the load needs? Reversing direction immediately while the mechanism is still moving or jammed.
Protection Flyback or recirculation path, snubber needs, bulk capacitance, fuse or current limit, and reset-safe output state. Where does inductive energy and fault current go? Back-EMF or inrush causes driver damage, microcontroller resets, or unsafe default motion.
Feedback Encoder, limit switch, current sense, process sensor, timeout, expected response, and manual recovery path. How does the system know motion succeeded, stalled, or failed? Software reports success because it sent PWM even though the load did not move.

5.3.3 Worked Review: Pump Or Fan Path

A one-direction fan may not need an H-bridge, but it still needs a motor driver, supply margin, startup ramp, inductive protection, and a way to show whether airflow or temperature changed as expected. A pump used for dosing needs stronger evidence: expected current, runtime limit, flow or pressure confirmation, dry-run behavior, and safe shutdown on fault.

The difference is not only motor size. It is the consequence of wrong motion. A dashboard fan can tolerate approximate speed. A dosing pump or moving mechanism may require closed-loop confirmation and a conservative failure path.

5.3.4 Practitioner Knowledge Check

5.4 Under The Hood: Motion Evidence Comes From The Whole Loop

Under the hood, a DC motor is part of an electromechanical loop. PWM changes average electrical drive, current produces torque, load changes speed, speed changes back-EMF, and the useful physical process responds through airflow, pressure, wheel motion, or mechanism position. The design is trustworthy only when the loop has enough evidence at the right boundary.

Back-EMF is especially important. A spinning motor behaves partly like a generator, creating voltage opposite the applied supply. When the motor slows under load, that opposing voltage falls and current can rise. When the driver switches current off, stored inductive energy needs a safe recirculation path. These effects are why driver and protection choices cannot be left as afterthoughts.

Gearing changes the loop before software sees it. Suppose a motor has a no-load speed near 6000 rpm and is paired with a 30:1 gearbox. The unloaded output speed is about 6000 / 30 = 200 rpm before losses. If a wheel radius is 30 mm, its circumference is about 2 x 3.14 x 0.03 = 0.188 m. At 120 rpm under load, the wheel turns twice per second, so the ideal ground speed is about 2 x 0.188 = 0.376 m/s before slip. That calculation links PWM experiments to a physical result students can measure.

Current evidence should be interpreted over time. A startup spike of 2.0 A for 80 ms may be normal for a loaded motor, while 2.0 A for 2 s may mean a jam. A simple current limit that trips instantly can make the product unreliable; a timeout that ignores current can burn the driver. A more useful rule records normal startup duration, expected running current, blocked-load current, and the delay before firmware declares a fault.

The protection path also depends on the driver mode. In a low-side switch, inductive current needs a flyback or clamp path when the switch opens. In an H-bridge, current may recirculate through driver devices or diodes depending on whether firmware commands coast, brake, or reverse. The safety review should name that path explicitly, because back-EMF does not disappear just because the command changed.

5.4.1 Internal Behaviors To Surface

  • Back-EMF: Motor speed affects the opposing voltage generated by the motor, so current draw changes with load, acceleration, and stall conditions.
  • PWM Dynamics: Duty cycle, frequency, driver switching behavior, audible noise, thermal loss, and mechanical response should match the load and product context.
  • Closed Loop: Encoder or process feedback lets the controller compare target and actual behavior instead of assuming PWM equals speed.
  • Fault Handling: Timeouts, current limits, stall detection, jam recovery, brake/coast behavior, and manual override define safe operation after failure.

5.4.2 Failure Modes To Test

  • Startup surge: initial current causes supply sag, reset, or driver thermal stress.
  • Stall or jam: blocked rotation draws high current while software still reports commanded speed.
  • Back-EMF spike: switching or braking produces voltage stress without a safe current path.
  • Reverse shock: firmware reverses a moving load without coast, brake, or mechanical review.
  • Feedback mismatch: encoder speed looks normal while the driven process, such as airflow or fluid movement, is blocked.

5.4.3 Under-The-Hood Knowledge Check

5.5 Summary

  • DC motors are useful for continuous rotation, fans, pumps, wheels, conveyors, and geared mechanisms where speed and direction matter more than exact position.
  • PWM controls average drive, while an H-bridge is needed when the motor must reverse or use explicit brake/coast behavior.
  • Driver sizing must account for real load, startup current, blocked-load current, thermal path, wiring, and safe reset behavior.
  • Back-EMF and inductive switching require a safe current path and protection strategy.
  • Feedback or process evidence is needed when software must prove more than “command sent.”

5.6 Key Takeaway

Design DC motor outputs as electromechanical loops: command through a rated driver, protect the inductive load, size for startup and stall, and verify useful motion with appropriate evidence.

5.7 See Also