Skip to content
Create an account

PWM Pins and Duty Cycle Cheat Sheet

Pulse width modulation is covered in several of our lessons. This page collects the documented pin list, the write range and the duty-cycle relationship.

At a glance

PWM values and where they come from

These are the values our Arduino workshop and electronics workshop actually use.

ItemDocumented value or ruleMeaning
analogWrite range0 to 2550 is fully off and 255 is fully on
PWM pins on UnoPins marked ~3, ~5, ~6, ~9, ~10, ~11An unmarked pin does not respond to analogWrite as expected
Brightness mappingDivide a 0-1023 analog reading by 4Maps the analog value into the 0-255 PWM range
Duty cycleD = ton / TRatio of on-time to the full period
PeriodT = 1 / fLinks period and frequency
Average outputUout = D x supply voltageExample in our material: 24 V at 35% gives 8.4 V
Motor driverPWM on the enable pin sets average voltageIN1 HIGH / IN2 LOW drives one direction; reversing the pair reverses the motor
Servo supplySeparate power line with common GNDAvoid drawing high current from the board 5 V pin

How to use this reference

PWM switches a digital pin on and off very quickly so the average voltage changes. Our LED guide uses this to dim a lamp without changing the series resistor.

Choose one of the marked Uno pins. Our lesson names ~3, ~5, ~6, ~9, ~10 and ~11; on other pins analogWrite will not behave as expected.

Write a value between 0 and 255. In the brightness example an analog reading of 0-1023 is divided by four and sent to pin 9.

To reason about power, use the duty-cycle relations from the electronics workshop: D = ton / T, T = 1 / f, and average output equals D multiplied by the supply voltage.

For motors and servos, keep the load supply separate from the board supply and join the grounds. Our L298N lesson uses the enable pin for speed.

Do not confuse peak and average: our material gives 24 V at 35% duty as 8.4 V average, not 24 V.

This source set does not publish a per-pin PWM frequency table, so no frequency figures are listed. The period and duty-cycle formulas above are the relations our lessons teach.
PWM LED dimmingThe full brightness-control project.DC motor speed controlApply PWM to a motor driver in a guided build.Arduino PWM brightnessAnother documented PWM walkthrough.

Keep the reference close. Create a free account to save your place, open the simulators and follow the full electronics guides.

Topic tracking

Frequently asked questions

What does analogWrite(255) mean?

Fully on. In our Arduino lesson 0 is fully off and 255 is fully on.

Which Uno pins are marked for PWM?

Our lesson lists ~3, ~5, ~6, ~9, ~10 and ~11. The tilde mark identifies them.

How is average voltage found?

Multiply the supply voltage by the duty cycle D. Our example uses 24 V and 35%, which gives 8.4 V.

Why does my LED not dim on every pin?

Our guide states that analogWrite on an unmarked pin does not work as expected; use a marked PWM pin.

Interactive circuit guide

Run the simulation, follow the build steps one by one and try it in our real app.

Real screenshot of our circuit simulator Stopped
Open in our app →

Step-by-step build