Microcontrollers and Interfacing

Chapter 9
Actuators, Motors and Power Interfaces

Bachelor Program in Mechatronics Engineering
Microcontrollers and Interfacing   •   Bachelor

Actuators, Motors and Power Interfaces

Introduction

Microcontrollers process information at low voltage and modest current, whereas actuators convert electrical energy into physical action. A microcontroller pin may source or sink only a few milliamperes, while a solenoid, motor, relay coil, or power contactor may require hundreds of milliamperes or several amperes. Direct connection is therefore unsafe and usually impossible. A power interface separates the control domain from the energy domain while providing switching, protection, measurement, and electromagnetic compatibility.

This chapter develops practical methods for controlling relays, solenoids, brushed DC motors, stepper motors, and hobby servos. Particular attention is given to transistor drivers, H-bridges, pulse-width modulation (PWM), flyback protection, current sensing, thermal design, grounding, EMI, and electrical safety.

Learning Objectives

After studying this chapter, a student should be able to:

  1. Select an appropriate driver for a relay, solenoid, DC motor, stepper motor, or servo.
  2. Explain low-side and high-side switching and use MOSFETs correctly.
  3. Analyze H-bridge operation, PWM control, braking, and direction reversal.
  4. Calculate approximate current, power dissipation, duty cycle, and thermal requirements.
  5. Design flyback, current-sensing, grounding, and decoupling arrangements.
  6. Identify electrical, thermal, mechanical, and EMI hazards in actuator systems.
  7. Test an actuator interface systematically and safely.

1. The Power-Interface Concept

A complete actuator system contains five functional layers:

LayerFunction
CommandSoftware, switches, sensors, or a communication bus produce a desired action.
LogicThe microcontroller generates direction, enable, and PWM signals.
Power driverA transistor, bridge, or integrated driver switches actuator current.
Protection and measurementFlyback paths, fuses, current sensing, and thermal safeguards limit faults.
Actuator and loadElectrical energy produces motion, force, or switching.

The logic supply and actuator supply may be different. A 3.3 V microcontroller can control a 12 V motor only through a suitable interface. A common reference ground is often required for a logic-level gate signal, but grounding must be planned so that large motor currents do not flow through sensitive signal traces.

Important ratings include:

  • Voltage rating: maximum repetitive and transient voltage.
  • Current rating: continuous, peak, and stall or inrush current.
  • Switching rating: permissible frequency, rise time, and switching loss.
  • Isolation rating: withstand voltage and leakage for optocouplers or isolated drivers.
  • Thermal rating: junction temperature, package resistance, and permitted duty cycle.
  • EMC rating: immunity and emissions under the intended environment.

A component’s advertised current is not automatically safe in a real circuit. It depends on temperature, heat sinking, PCB copper, switching frequency, airflow, and the actuator’s actual current waveform.

2. Relays and Solenoids

A relay uses an energized coil to move contacts. The coil is an inductive load; when its current is interrupted, stored magnetic energy produces a voltage transient. A solenoid similarly converts coil current into linear force. Solenoids often have high pull-in current and lower holding current, making PWM or a two-level drive useful.

2.1 Low-side transistor driver

The standard interface uses an N-channel MOSFET between the coil and ground. The microcontroller drives the gate through a resistor, and a pull-down resistor ensures that the MOSFET remains off during reset. The coil is connected to the positive actuator supply. A flyback diode is connected across the coil, with its cathode at the positive supply and anode at the transistor side.

When the MOSFET turns off, the coil current continues through the diode. The diode reduces the voltage stress and electromagnetic interference, although it also causes relatively slow current decay. A Schottky diode, TVS clamp, zener arrangement, or active clamp can produce faster release when the application requires it.

EL = 1/2 L I2

Here, EL is stored magnetic energy in joules, L is inductance in henries, and I is coil current in amperes. This expression assumes a linear inductor and is an approximation when the magnetic core saturates.

A transistor’s conduction loss is approximately:

Pcond = IRMS2 RDS(on)

where Pcond is conduction power in watts, IRMS is RMS current, and RDS(on) is MOSFET drain-source on-resistance in ohms. This estimate applies when the MOSFET is fully enhanced and switching loss is small.

2.2 High-side switching

A high-side switch places the transistor between the supply and the load. It is useful when the load must remain near ground, when several loads share a protected return, or when disconnecting power is a safety requirement. P-channel MOSFETs simplify small high-side circuits but have higher resistance than comparable N-channel devices. N-channel high-side switches require a gate driver capable of raising the gate above the source, unless a specialized charge-pump or bootstrap driver is used.

2.3 Relay contact considerations

The coil driver and relay contacts are separate electrical problems. Contact ratings differ for resistive, inductive, lamp, and motor loads. DC arcs are difficult to extinguish because current does not naturally pass through zero. Contact suppression may use an RC snubber, diode, TVS, or varistor, selected according to AC or DC operation. Contact isolation does not eliminate the need for enclosure, fuse, creepage, clearance, and protective-earth practices.

3. Brushed DC Motors

A brushed DC motor produces torque through armature current and develops back electromotive force (back EMF) as it rotates. A simplified model is:

V = Ra Ia + La (dIa/dt) + Ke ω

where V is applied armature voltage, Ra is armature resistance, Ia is armature current, La is armature inductance, Ke is the back-EMF constant, and ω is angular speed in radians per second. The equation neglects brush voltage drop and nonlinear magnetic effects.

Motor torque is often approximated by:

T = Kt Ia

where T is electromagnetic torque in newton-metres and Kt is the torque constant in newton-metres per ampere. At stall, ω = 0, so current is limited mainly by winding resistance and the driver. Stall current can therefore be much higher than running current.

3.1 PWM speed control

PWM applies the supply in rapid pulses. For an ideal switch and a sufficiently inductive motor, the average applied voltage is approximately:

Vavg ≈ D VS

where D is duty ratio from 0 to 1 and VS is motor-supply voltage. This is an average model, not a guarantee of exact speed. Speed also depends on load torque, friction, supply voltage, current limiting, and controller dynamics.

PWM frequency must be high enough to avoid objectionable audible noise and current pulsation, but not so high that switching losses become excessive. The motor’s inductance, driver topology, and required current ripple determine the appropriate value.

4. H-Bridges

An H-bridge contains four controlled switches arranged around a motor. Turning on the upper-left and lower-right devices produces one polarity; turning on the upper-right and lower-left devices produces the opposite polarity. The bridge enables forward drive, reverse drive, braking, and sometimes high-impedance coasting.

Never turn on both switches in the same bridge leg. This creates shoot-through, a near-short circuit across the supply. Gate-driver dead time, hardware interlocks, and firmware sequencing are used to prevent it.

StateUpper-left/lower-rightUpper-right/lower-leftTypical result
Drive AONOFFMotor rotates one direction
Drive BOFFONMotor rotates opposite direction
CoastAll OFFAll OFFCurrent decays through parasitic paths or diodes
BrakeBoth motor terminals arranged near same potentialDepends on topologyMotor energy is dissipated electrically
FaultSame leg both ONProhibitedShoot-through

Integrated H-bridge drivers are often preferable because they include gate control, current limiting, undervoltage lockout, thermal shutdown, and fault reporting. Discrete bridges provide flexibility but require careful power-layout and protection design.

4.1 Worked example: PWM and power

A 12 V motor is operated at 60% duty ratio. Under the ideal average-voltage approximation,

Vavg ≈ 0.60 × 12 = 7.2 V.

If the measured average motor current is 1.5 A, the approximate electrical input power is

Pin ≈ Vavg Iavg = 7.2 × 1.5 = 10.8 W.

This is not necessarily the battery power or mechanical output power. Switching loss, copper loss, friction, and converter losses must also be considered.

5. Stepper Motors

A stepper motor moves in discrete magnetic states. Common two-phase bipolar motors require current in both windings, with polarity reversal supplied by two H-bridges. A stepper driver normally regulates winding current rather than applying an unrestricted voltage.

Microstepping divides a full step into smaller commanded increments by controlling phase currents, often approximately sinusoidally. It improves smoothness and reduces resonance, but it does not guarantee proportional positioning accuracy under changing load.

The commanded step rate determines speed. If a motor has Ns full steps per revolution and is commanded at fstep steps per second, the ideal rotational speed is:

nrpm = 60 fstep / Ns

Here nrpm is revolutions per minute. With microstepping factor m, the pulse rate required for a given speed becomes m times the full-step pulse rate.

A stepper can lose synchronism when acceleration, load torque, or speed exceeds its available torque. Good systems use an acceleration and deceleration profile rather than an instantaneous change to high step frequency. Current regulation also limits heating; a motor may be rated for a particular winding current but still require reduced current at standstill or in a confined enclosure.

6. Servo Motors

A hobby servo generally contains a motor, reduction gears, position sensor, and internal controller. The external interface is commonly a repeating pulse command. The pulse width represents a requested position, but the exact pulse range and mechanical angle are manufacturer-dependent; it should not be assumed universally.

Servo supply current can rise sharply during acceleration or stall. The supply should be sized for peak current, with local bulk capacitance near the servo connector. Logic ground and servo ground must be connected in a low-impedance arrangement unless an isolated interface is intentionally used. A microcontroller should not power a medium or large servo from its onboard 5 V regulator unless the regulator and wiring are explicitly rated for the load.

7. Flyback Protection and Transients

Inductors oppose rapid change in current. When a switch opens, the circuit seeks a path that satisfies the inductor-current condition. Without a clamp, voltage may exceed transistor, insulation, or sensor ratings. Protection choices include:

  • Diode: low cost and effective for DC coils; produces slow release.
  • TVS diode: clamps at a selected voltage and gives faster decay.
  • RC snubber: useful for contacts and some switching networks; requires damping design.
  • Zener or diode-zener clamp: limits voltage while allowing faster current decay.
  • Active clamp: controlled semiconductor path for precise energy management.

The protection device must be physically close to the inductive load or switching loop. A diode placed far away may leave a large high-frequency loop that radiates EMI.

8. Current Sensing and Protection

Current sensing supports stall detection, overload protection, torque estimation, and diagnostics. A low-side shunt resistor is simple, but it lifts the load’s ground by a small sense voltage and may disturb measurements. A high-side shunt preserves load-ground integrity but requires a differential current-sense amplifier.

For a shunt resistor:

VSENSE = I RSH

where VSENSE is sense voltage, I is load current, and RSH is shunt resistance. Its power is:

PSH = IRMS2 RSH

A 10 mΩ shunt carrying 5 A produces VSENSE = 5 × 0.010 = 0.050 V, or 50 mV. Its ideal dissipation at constant 5 A is PSH = 52 × 0.010 = 0.25 W. A safety margin is required because transients and ambient temperature increase stress.

Current signals contain PWM ripple and switching spikes. Filtering must be designed so that genuine stall events are detected without making protection dangerously slow. Hardware overcurrent protection is preferable for catastrophic faults; software monitoring is a complementary diagnostic layer.

9. Thermal Design

Power semiconductor temperature rises because of conduction and switching losses. A first-order estimate is:

TJ = TA + PD θJA

where TJ is junction temperature, TA is ambient temperature, PD is dissipated power, and θJA is junction-to-ambient thermal resistance in °C/W. The model assumes steady state and a specified mounting condition.

For a switching transistor, total loss can be approximated as:

Ptotal ≈ Pcond + Psw

Switching loss depends on voltage, current, transition time, and frequency. A simplified estimate for hard switching is:

Psw ≈ 1/2 V I (tr + tf) fs

where V and I are switching voltage and current, tr and tf are rise and fall times, and fs is switching frequency. This excludes gate-drive loss, diode recovery, output-capacitance loss, and overlap details, so it is an engineering estimate rather than a complete loss model.

10. Grounding, Decoupling, and EMI

Motor currents produce voltage drops in conductors and PCB planes. A star or carefully partitioned ground arrangement can prevent motor return current from sharing a sensitive ADC or reset path. The logic supply requires ceramic bypass capacitors close to driver pins. The actuator supply generally requires both local ceramic decoupling and appropriately sized bulk capacitance.

EMI reduction practices include:

  1. Minimize the area of high di/dt loops.
  2. Place flyback and bridge capacitors near the switching devices.
  3. Use short, wide power traces appropriate to current.
  4. Route gate-drive and sensor traces away from motor leads.
  5. Add series gate resistors when ringing requires damping.
  6. Use twisted motor wires or shielded cables where appropriate.
  7. Separate analog sensing from switching nodes and filter at the receiver.
  8. Control PWM edge rate when efficiency permits.

A ground plane is not automatically a solution. Its effectiveness depends on current paths, layer transitions, return continuity, and connector placement.

11. Electrical Safety and Reliability

Actuator systems may contain hazardous voltage, stored energy, moving parts, hot surfaces, and unexpected restart conditions. Design practices include fuses or resettable protection, emergency-stop provisions, guarded mechanisms, mechanically secure wiring, strain relief, suitable insulation, creepage and clearance, and protective earth where required.

A controller should define safe behavior during reset, watchdog timeout, communication loss, brownout, and sensor failure. Pull resistors or driver enable pins should force actuators off during boot. Software must avoid commanding reverse direction before the motor has decelerated when the mechanical system cannot tolerate abrupt reversal.

Compliance depends on the product and jurisdiction. Relevant standards may concern machinery safety, low-voltage equipment, EMC, functional safety, and electrical installations. A university prototype is not automatically exempt from safe laboratory practice.

12. Illustrative Case: Conveyor Diverter

Background

An illustrative small conveyor uses a 24 V brushed DC gearmotor and a solenoid-operated diverter. A 3.3 V microcontroller reads optical sensors and commands forward, reverse, and diversion actions.

Problem

Initial testing caused microcontroller resets when the solenoid released and excessive MOSFET heating during conveyor jams. The motor also radiated noise into the optical sensor input.

Analysis

The solenoid’s inductive energy had no local clamp, so release voltage coupled into the supply and ground wiring. The motor driver was selected using normal running current, although the jam current was nearly the stall current. The sensor cable was routed alongside motor wires, and the motor return shared a narrow logic-ground trace.

Approach and solution

The design was revised to include a low-side MOSFET with a local flyback/TVS network for the solenoid, a protected H-bridge rated above measured stall current, and a shunt-based current monitor. Firmware disabled the bridge when current exceeded a calibrated threshold for a defined time. The motor supply received bulk capacitance near the driver, while sensor returns were routed separately to a common reference point. A watchdog and power-on default disabled all actuators.

Outcome

The resets disappeared, driver temperature remained within the calculated limit during normal operation, and a conveyor jam generated a controlled fault rather than prolonged heating. The solenoid release time increased slightly with the diode component, so a higher-voltage clamp was selected where faster release was necessary.

Learning points

The case demonstrates that actuator control is a system problem. Correct transistor selection alone cannot compensate for inadequate transient suppression, grounding, thermal analysis, firmware fault handling, or mechanical safety.

13. Design and Test Workflow

A professional workflow is:

  1. Specify voltage, normal current, peak current, stall current, motion profile, environment, and safety state.
  2. Select the topology: low-side switch, high-side switch, relay, integrated bridge, discrete bridge, or isolated driver.
  3. Select voltage and current ratings with transient and temperature margins.
  4. Design the clamp, fuse, decoupling, current sensor, and gate-drive network.
  5. Calculate conduction and switching losses.
  6. Review PCB current paths, creepage, clearance, and connectors.
  7. Test first with a current-limited supply and an accessible emergency disconnect.
  8. Measure gate voltage, drain voltage, current, temperature, and supply disturbance with suitable probes.
  9. Test no-load, nominal-load, acceleration, reversal, stall, brownout, reset, and communication-loss conditions.
  10. Document limits, calibration values, fault behavior, and maintenance requirements.

Contemporary Developments

Modern actuator modules increasingly integrate current regulation, position feedback, diagnostics, regenerative braking, and networked control. Silicon-carbide and gallium-nitride devices can reduce switching loss in high-frequency power converters, although their fast edges increase layout and EMI demands. Edge controllers and industrial networks can coordinate distributed drives, but network dependence introduces timing, cybersecurity, and fail-safe design considerations. AI may assist predictive maintenance by identifying unusual current or vibration signatures, but a learned model should not replace hardware overcurrent protection or deterministic safety functions.

Chapter Summary

Actuators require a power interface because microcontroller pins cannot safely supply motor or coil energy. Relays and solenoids are inductive loads and require a deliberate flyback path. MOSFET low-side switches are simple and efficient, while high-side switches provide different grounding and isolation advantages. Brushed DC motors are commonly controlled by PWM and H-bridges; direction control requires interlocking to prevent shoot-through. Stepper drivers regulate winding current and require acceleration control, while servo systems require adequate peak-current supplies and manufacturer-specific command timing.

Current sensing enables protection and diagnostics. Thermal design must include conduction and switching losses rather than relying only on nominal current ratings. Grounding, decoupling, cable routing, and transient suppression strongly affect EMI and controller reliability. Safe systems define behavior during faults, reset, stall, overload, and loss of communication. Effective actuator engineering combines electrical, mechanical, thermal, software, and safety analysis.

Key Terms

Actuator: Device that converts electrical energy into physical motion or action.

Back EMF: Voltage generated by a motor’s motion that opposes applied voltage.

Brushed DC motor: Motor using brushes and a commutator to switch armature current.

Coast: Motor state in which drive switches are off and current is allowed to decay.

Dead time: Intentional delay preventing simultaneous conduction in one bridge leg.

Flyback diode: Diode providing a current path when an inductive load is switched off.

H-bridge: Four-switch circuit capable of reversing voltage across a motor.

High-side switch: Switch connected between the positive supply and the load.

Low-side switch: Switch connected between the load and ground or return.

Microstepping: Stepper control method that divides a full step using regulated phase currents.

PWM: Pulse-width modulation used to control average applied voltage or power.

Regenerative energy: Energy returned from a decelerating motor to the electrical supply.

Shunt resistor: Precisely valued resistor used to measure current through its voltage drop.

Solenoid: Electromagnetic actuator producing linear motion.

Stall current: Motor current when the rotor is stationary under applied voltage.

Shoot-through: Undesired simultaneous conduction of opposing switches in one bridge leg.

TVS diode: Transient-voltage suppressor used to clamp short-duration overvoltage.

Thermal resistance: Temperature rise per unit dissipated power, commonly expressed in °C/W.

Review Questions

Short Answer Questions

  1. Why must an inductive coil have a flyback or clamping path?
  2. Distinguish a low-side switch from a high-side switch.
  3. What is the purpose of dead time in an H-bridge?
  4. Why can motor stall current greatly exceed running current?
  5. State two causes of EMI in actuator systems and one mitigation for each.

Long Answer Questions

  1. Explain the operation of a MOSFET relay-coil driver, including gate biasing, flyback protection, and thermal considerations.
  2. Describe the operating states of an H-bridge and explain how shoot-through is prevented.
  3. Compare brushed DC, stepper, and servo motors in terms of control method, feedback, current demand, and applications.
  4. Develop a practical current-sensing and overcurrent-protection strategy for a 24 V motor controller.
  5. Explain how PCB layout, grounding, decoupling, and cable routing influence actuator reliability and EMI.

Analytical / Application Questions

  1. A 12 V motor has a measured stall current of 8 A but a normal current of 1.8 A. How should these values influence MOSFET, fuse, connector, current-sensor, and thermal design?
  2. A stepper motor has 200 full steps per revolution and is commanded at 4,000 pulses per second with 8× microstepping. Determine the ideal speed in revolutions per minute and discuss two reasons the actual speed may differ.
  3. An actuator causes a microcontroller reset whenever it turns off. Propose a structured diagnostic procedure covering oscilloscope measurements, grounding, decoupling, flyback suppression, and firmware behavior.

Multiple Choice Questions with Answers

Question 1

What is the primary purpose of a flyback diode across a DC relay coil?

A. To increase the coil’s resistance

B. To provide a path for inductive current when switching off

C. To reverse the relay contact polarity

D. To regulate the microcontroller clock

Correct Answer: B. To provide a path for inductive current when switching off

Question 2

Which H-bridge condition creates shoot-through?

A. All four switches are off

B. Opposite diagonal switches are on

C. Both switches in the same bridge leg are on

D. The motor is disconnected

Correct Answer: C. Both switches in the same bridge leg are on

Question 3

For an ideal PWM motor drive, a duty ratio of 0.25 applied to a 20 V supply gives an approximate average voltage of:

A. 5 V

B. 10 V

C. 15 V

D. 80 V

Correct Answer: A. 5 V

Question 4

A 20 mΩ shunt carries 4 A. What is its ideal power dissipation?

A. 0.032 W

B. 0.08 W

C. 0.16 W

D. 0.32 W

Correct Answer: D. 0.32 W

Question 5

Which motor condition usually produces the highest current in a brushed DC motor?

A. Free running at rated speed

B. Stall at applied voltage

C. Disconnected winding

D. Coasting with no supply

Correct Answer: B. Stall at applied voltage

Question 6

What does dead time in a half-bridge primarily prevent?

A. Loss of encoder counts

B. Excessive mechanical friction

C. Simultaneous conduction of upper and lower switches

D. Reduction of motor torque at low speed

Correct Answer: C. Simultaneous conduction of upper and lower switches

Question 7

Which approach generally produces the slowest decay of current in a DC coil?

A. Simple flyback diode clamp

B. High-voltage TVS clamp

C. Active current regulator

D. Diode-zener clamp with higher clamp voltage

Correct Answer: A. Simple flyback diode clamp

Question 8

A stepper motor is most likely to lose synchronism when:

A. The supply is disconnected

B. The commanded acceleration or load exceeds available torque

C. The driver regulates winding current

D. The motor is operated below its maximum speed

Correct Answer: B. The commanded acceleration or load exceeds available torque

Question 9

If a MOSFET dissipates 2 W and has junction-to-ambient thermal resistance of 30 °C/W, the estimated junction rise is:

A. 15 °C

B. 30 °C

C. 60 °C

D. 90 °C

Correct Answer: C. 60 °C

Question 10

Which practice most directly reduces high-frequency EMI from a switching actuator driver?

A. Making the high-current loop physically larger

B. Placing the clamp and decoupling capacitor close to the switching loop

C. Routing sensor wires parallel to motor wires

D. Removing all supply capacitors

Correct Answer: B. Placing the clamp and decoupling capacitor close to the switching loop

Microcontrollers and Interfacing
Chapter 9 of 14