Tricky Circuit

Pulse width and average current

Dim a light by switching quickly

PWM means Pulse Width Modulation: changing the fraction of each cycle spent on. This fraction is duty cycle. LED means Light Emitting Diode, a light-producing semiconductor diode. Frequency in hertz (Hz) counts cycles per second.

Open interactive experiment

EXPERIMENT BENCH

Change the circuit settings, predict the readings, then check a challenge. These are learning models, with the assumptions explained in each lesson.

Sign in to save progress. Guest progress stays on this device.

Open laboratory in a full window

Why it works

Ideal 5 V pulses, LED drop 2 V, fixed resistor. Switching edges, visual response and thermal effects are omitted; brightness is not calibrated.

Peak current = (5 − 2)/R. Average current = peak × duty/100. More frequency means shorter cycles, not more average current at fixed duty. The peak formula describes an on pulse. At 0% duty there is no on pulse and the displayed peak is zero.

Difficulty
  1. Build · Build it

    Power on with 330 Ω, 50% duty and 100 Hz. Compare peak and average current.

    Need a hint?

    330 Ω; 50%; 100 Hz

  2. Explore · Change one thing

    Obtain 2–3 mA average, at most 20 mA peak, and a frequency of at least 100 Hz.

    Need a hint?

    330 Ω; 25%; 100 Hz → 2.27 mA

  3. Solve it · Solve the challenge

    Obtain 8–10 mA average, at most 20 mA peak, and a frequency of at least 200 Hz.

    Need a hint?

    200 Ω; 60%; 200 Hz → 9 mA

Extra reading and circuit recipes

Dim a light by switching quickly

A useful pattern

At 25% duty, the current is on for one quarter of each cycle; its peak is unchanged.

Beyond this model

A real driver must tolerate the pulse current. Fast switching does not automatically make an excessive peak safe.

A useful trap to avoid

PWM does not remove the need for an LED current-limiting resistor.

Duty stays at 50%; frequency doubles. Average current…

  1. doubles
  2. halves
  3. stays unchanged
Read more

The same fraction of time is on. Only the length of each cycle changes.

Arduino

Temu affiliate offers

Find your next electronics project

Explore these do-it-yourself project kits. Check the selected option, included parts and instructions on each offer.

Tricky Circuit may earn a commission if you buy through these Temu affiliate links. These are product ideas; they have not been bench-tested by Tricky Circuit and are not verified lesson parts lists.

Supplier photo of an assembled infinity mirror light cube illuminated on a dark background.

Supplier product photo

Build an infinity light cube

Listing specifies 5-volt direct current. Soldering required; battery and glue not included.

View kit on Temu

Supplier photo of a breadboard, jumper wires and assorted electronic components in a plastic storage case.

Supplier product photo

Try breadboard experiments

Breadboard, wires and assorted parts. Arduino controller board not included.

View kit on Temu

Supplier photo of an assembled blue surface-mount soldering practice board with a circular ring of small lights.

Supplier product photo

Solder a chasing-light board

Surface-mount soldering practice. Battery and battery holder not included.

View kit on Temu