How does PWM control LED brightness or motor speed?

 Let’s dive into how PWM (Pulse Width Modulation) actually makes an LED look dimmer or a motor run slower — even though the voltage is always “full ON” or “full OFF.”




 Principle of PWM

  • PWM rapidly switches voltage ON and OFF at a fixed frequency.

  • The duty cycle (%) controls the ratio of ON-time to OFF-time in each cycle.

  • The load (LED, motor, etc.) responds to the average power delivered, not the instantaneous ON/OFF states.

 So, instead of lowering voltage directly, PWM delivers “packets of full power” and lets the load integrate them.


 LED Brightness Control

  • Human eyes cannot perceive fast flickering above ~100 Hz → instead, they see the average light output.

  • Example:

    • 10% duty cycle → LED is ON only 10% of the time → appears dim.

    • 50% duty cycle → LED is ON half the time → medium brightness.

    • 90% duty cycle → LED almost always ON → near full brightness.

 Advantage: LED always gets correct forward voltage → no color shift (unlike analog dimming by lowering current).




 Motor Speed Control (DC motors)

  • A brushed DC motor’s speed depends on average voltage/current supplied.

  • PWM applies bursts of full supply voltage, and the motor’s rotational inertia smooths the pulses into steady motion.

  • Example:

    • 25% duty cycle at 12 V → motor “feels” like ~3 V average → runs slower.

    • 75% duty cycle at 12 V → motor “feels” like ~9 V average → runs faster.

 Advantage: High efficiency, less heating, and strong torque (motor still gets full-voltage pulses).


 Why not just lower voltage with a resistor?

  • Inefficient: Resistors waste energy as heat.

  • Unstable: LED brightness shifts with supply changes, motor torque drops badly.

  • PWM is efficient: Switch is either fully ON (low loss) or fully OFF (no loss).


 Quick Visual (conceptual)

  • 100% duty cycle: ─────────────── (always ON → full brightness/speed)

  • 50% duty cycle: ▓▓▓░░░▓▓▓░░░ (half ON, half OFF → medium)

  • 10% duty cycle: ▓░░░░░░░░░ (short ON bursts → dim/slow)


Summary:

  • For LEDs → PWM controls perceived brightness by changing ON-time.

  • For motors → PWM controls average voltage/current, hence speed, while keeping torque strong.

评论

此博客中的热门博文

Detailed Explanation of STM32 HAL Library Clock System

How to remove write protection of STM32 chip?

How do you set up ADC (Analog-to-Digital Converter) in STM32?