Actuators & Control · Study deck

PWM Control: Signals and Duty-Cycle Behaviour

PWM switches power on and off in short pulses.

Motor Max is your guide for this deck.

control
Motor Max, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: PWM Resolution: The number of discrete duty cycle steps; ESP32 LEDC peripheral: 1-16 bit configurable; Arduino Uno: 8-bit (256 steps); higher resolution provides finer control but requires more timer bits.
  • Explain: The right setting is not just a number from 0 to 255; it is a duty, frequency, ramp, and feedback choice that keeps motion, brightness, heat, or position under control.
  • Explain: PWM is the controller's way to ask for less or more effort, but the physical result depends on frequency, duty cycle, driver losses, motor inertia, and the load.
iotclass.org

Major section

Start With the Story

A changing command number is not enough; the reviewer needs the drive timing, supply condition, and measured fan result.

  • An actuator is a device that turns an electrical command into physical action.
  • A microcontroller is a small computer built to read inputs and control outputs.
  • Modulation means changing a signal over time to carry a setting.
iotclass.org

Major section

Start With the Story (continued)

This runway does not prove motor life or make one switching rate safe for every load.

  • The deeper sections cover waveform timing, driver stages, resolution, filtering, load limits, and measurement.
  • PWM is the controller's way to ask for less or more effort, but the physical result depends on frequency, duty cycle, driver losses, motor inertia, and the load.
  • The right setting is not just a number from 0 to 255; it is a duty, frequency, ramp, and feedback choice that keeps motion, brightness, heat, or position under control.
iotclass.org

Major section

In 60 Seconds

It enables precise control of motor speed, LED brightness, and servo position using simple digital microcontroller pins without analog hardware.

  • Pulse Width Modulation (PWM) is a digital technique that simulates analog control by rapidly switching power on and off at a specific duty cycle.
iotclass.org

Major section

Key Concepts

Duty Cycle: The percentage of one PWM period during which the signal is HIGH; 0% = always off, 100% = always on; controls LED brightness, motor speed, heater temperature, and servo position (within a specific pulse width range).

  • PWM Resolution: The number of discrete duty cycle steps; ESP32 LEDC peripheral: 1-16 bit configurable; Arduino Uno: 8-bit (256 steps); higher resolution provides finer control but requires more timer bits.
iotclass.org

Major section

How It Works: PWM Creates "Fake" Analog Voltage

You can't push continuously (analog), but you can push in pulses (digital).

  • Example: 50% duty cycle = ON for 0.5 ms, OFF for 0.5 ms, repeat at 1kHz = motor sees ~2.5V average from a 5V supply.

By varying ON time, PWM sets a chosen average voltage between zero and the supply; the output remains pulses unless the load or a filter smooths it.

iotclass.org

Major section

Putting Numbers to It

At 5kHz PWM with 50% duty cycle, each period is T=1/5000=200T = 1/5000 = 200T=1/5000=200 μs.

  • The signal is HIGH for ton=0.5×200=100t_{on} = 0.5 \times 200 = 100ton​=0.5×200=100 μs and LOW for 100 μs.

This is why PWM "fakes" analog -- the actuator's inertia performs the averaging.

iotclass.org

Major section

Try It: PWM Motor Speed Control

Reverse the H-bridge only after the shaft response is understood, and finally sweep frequency to distinguish audible whine from excessive switching loss.

  • The useful result is a bounded operating region, not one attractive speed reading.

Begin with zero load and a moderate switching frequency, raise duty cycle while watching average voltage and speed, then add inertia and load to expose current demand.

iotclass.org

Major section

Why Duty Cycle Matters for IoT

Energy Efficiency: LED at 50% duty cycle uses approximately 50% power, extending battery life.

  • No Analog Hardware: Digital MCUs can control analog-like behavior without DAC chips.
  • Key insight: The actuator "sees" the average voltage, smoothed by its physical response time.

Numbers to remember

50%LED power

Why it matters

Thermal Management: Lower duty cycles reduce heat in motors and drivers.

iotclass.org

Major section

Worked Example: Smart Greenhouse Ventilation Fan

A greenhouse uses a 12V DC fan (rated 0.5A at full speed) controlled by an ESP32 via a MOSFET driver.

  • Choosing 20 kHz pushes the hum above hearing range, making the fan appear to run silently at any speed.

A greenhouse uses a 12V DC fan (rated 0.5A at full speed) controlled by an ESP32 via a MOSFET driver. The system adjusts fan speed based on temperature.

iotclass.org

Deck summary

Key takeaways

A changing command number is not enough; the reviewer needs the drive timing, supply condition, and measured fan result.

  • This runway does not prove motor life or make one switching rate safe for every load.
  • It enables precise control of motor speed, LED brightness, and servo position using simple digital microcontroller pins without analog hardware.
  • Duty Cycle: The percentage of one PWM period during which the signal is HIGH; 0% = always off, 100% = always on; controls LED brightness, motor speed, heater temperature, and servo position (within a specific pulse width range).
  • You can't push continuously (analog), but you can push in pulses (digital).
iotclass.org

Retrieval practice

Recall check 1 of 4

Motor Max says: answer from memory, then check your reasoning.

Q1An ideal motor drive applies 12V across the motor during each PWM on interval and 0V during each off interval, at 75% duty and 5kHz. What is the time-average terminal voltage?

A9V - calculated as 12V × 0.75 = 9V average
B12V - the supply voltage doesn't change
C3V - 75% of the 4V difference between 0 and 12V
D15V - the motor sees higher voltage due to frequency
Show answer

Answer: A For the stated ideal terminal waveform, 75% at 12V and 25% at 0V gives a time-average voltage of 9V.

iotclass.org

Retrieval practice

Recall check 2 of 4

Motor Max says: answer from memory, then check your reasoning.

Q2A fan hums at its PWM rate. What trade-off should guide a frequency change?

AMeasure noise and driver switching loss at the new rate.
BRaise frequency as high as possible without measurement.
CLower frequency until the hum is louder.
DChange duty alone and ignore frequency.
Show answer

Answer: A Higher rates may quiet hum while increasing switch loss.

iotclass.org

Retrieval practice

Recall check 3 of 4

Motor Max says: answer from memory, then check your reasoning.

Q3An ESP32 drives a motor and an LED with different PWM needs. What setup is sound?

ASet each output's frequency and resolution before writing its duty value.
BUse one fixed frequency and resolution for motor and LED without review.
CWrite duty before attaching outputs, because channel setup is unnecessary for the duty command to take effect.
DConnect both loads directly to GPIO to avoid configuring PWM channels.
Show answer

Answer: A The PWM setup must fit each load before its command is sent.

iotclass.org

Retrieval practice

Recall check 4 of 4

Motor Max says: answer from memory, then check your reasoning.

Q4A hobby servo holds the wrong angle although its frame rate is accepted. Which setting most directly changes the target angle?

ARaise frame rate alone, because frame timing sets the servo's target angle.
BChange motor supply voltage alone, because voltage sets the servo's commanded angle.
CChange another pin's LED duty cycle to set the servo angle.
DSet command pulse width within the servo's supported angle range.
Show answer

Answer: D The servo interprets the width of its control pulse as the position command.

iotclass.org

Print reference

Answers

Answer key.

  1. A · For the stated ideal terminal waveform, 75% at 12V and 25% at 0V gives a time-average voltage of 9V.
  2. A · Higher rates may quiet hum while increasing switch loss.
  3. A · The PWM setup must fit each load before its command is sent.
  4. D · The servo interprets the width of its control pulse as the position command.
iotclass.org