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.
- 8 documented PWM facts
- Six marked Uno pins
- 0-255 write range explained
- Worked 24 V / 35% example
PWM values and where they come from
These are the values our Arduino workshop and electronics workshop actually use.
| Item | Documented value or rule | Meaning |
|---|---|---|
| analogWrite range | 0 to 255 | 0 is fully off and 255 is fully on |
| PWM pins on Uno | Pins marked ~3, ~5, ~6, ~9, ~10, ~11 | An unmarked pin does not respond to analogWrite as expected |
| Brightness mapping | Divide a 0-1023 analog reading by 4 | Maps the analog value into the 0-255 PWM range |
| Duty cycle | D = ton / T | Ratio of on-time to the full period |
| Period | T = 1 / f | Links period and frequency |
| Average output | Uout = D x supply voltage | Example in our material: 24 V at 35% gives 8.4 V |
| Motor driver | PWM on the enable pin sets average voltage | IN1 HIGH / IN2 LOW drives one direction; reversing the pair reverses the motor |
| Servo supply | Separate power line with common GND | Avoid 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.
Related DersTeders pages
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 trackingFrequently 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.
Stopped
Step-by-step build