Understanding PWM: Duty Cycle and Frequency Explained

Written by

in

To control an Arduino motor speed, you use Pulse Width Modulation (PWM) via the analogWrite(pin, value) function. This method simulates varying voltages by rapidly switching a digital pin ON and OFF. How PWM Works

Instead of putting out a steady analog voltage (like 2.5V), an Arduino delivers either 0V or 5V. By changing the ratio of time the signal is “HIGH” (ON) versus “LOW” (OFF) within a tiny fraction of a second, it alters the overall average power sent to the motor. This ratio is called the Duty Cycle:

0% Duty Cycle (analogWrite(0)): The signal is always OFF (0V). The motor stops.

50% Duty Cycle (analogWrite(127)): The signal is ON half the time. The motor runs at roughly half speed.

100% Duty Cycle (analogWrite(255)): The signal is always ON (5V). The motor runs at full speed. Core Requirements Motor Speed and Direction Control PWM

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *