⚡ Spark Academy53 lessons

Build the PWM Dimmer

A 555, a potentiometer and two steering diodes: smooth 0–100% LED brightness from a knob, at a frequency your eye can't see.

lesson 1 of 1 in this unit

Builds on: 3.3 The 555 Timer4.1 Build the Blinker5.3 Impedance & RC Filters7.3 Memory & Counters

The idea: dim by blinking fast

How do you make an LED half as bright? A resistor wastes power as heat, and LEDs dim unevenly with current. The modern answer is sneakier: blink it faster than the eye can see and control the ratio. On 30% of the time → 30% brightness, with the switch (a transistor) either fully on or fully off, wasting almost nothing — the same cutoff/saturation efficiency argument from Lessons 1.4 and 3.2. This is pulse-width modulation: fixed frequency, adjustable duty cycle. Your capstone blinker at 14 Hz (the flicker-fusion experiment) was already teetering on this idea; now we push it to 1.4 kHz and add a knob.

perceived brightness ≈ duty cycle = t_high / TPWM drives LED strips, motor speed, servo position, heaters, Class-D audio, and every `analogWrite()`

The circuit: your blinker, upgraded

Start from the astable you already understand (Lesson 3.3) and change the timing network. The output pin itself now charges and discharges the capacitor through the two halves of a potentiometer, with two small diodes steering the traffic: charging current flows through the upper half (Ra) via D1, discharging current returns through the lower half (Rb) via D2.

t_high = 0.693·R_a·C · t_low = 0.693·R_b·CRa + Rb is always the full 100 kΩ → T and f stay fixed (~1.4 kHz); only the ratio moves. (Exact with a rail-to-rail CMOS 555 — a classic NE555's output doesn’t quite reach the rail, skewing duty upward a little. It still works.)

Turn the knob and you slide the wiper: more Ra, less Rb — longer highs, shorter lows, same total. Duty from ~5% to ~95%, frequency rock steady. Every lesson is on stage: RC timing (2.3), the divider-as-knob (2.2), diode steering (3.1), the 555’s thresholds (3.3), and duty cycle as digital-analog bridge (Unit 7 meets Unit 5 — a low-pass filter on this output would literally turn duty into a DC voltage).

55584+9 V1 ⏚pins 2+6C 10 nFD1 (band ↓)D2 (band ↓)100 kΩ potwiper → pin 3470 ΩLEDcharge path (Ra)discharge path (Rb)
The output itself charges and discharges the capacitor through the two halves of the pot, steered by D1 and D2. Turning the knob trades charge-time for discharge-time — duty changes, frequency doesn’t.

Shopping list (beyond the blinker kit)

PartSpecQty≈ Cost
Potentiometer100 kΩ linear, breadboard-friendly legs1$1.50
Signal diodes1N4148 (glass body, black band = cathode)2$0.20
Capacitor10 nF ceramic — marked “103”; no polarity1$0.20
Reused from the blinker: breadboard, 555, 470 Ω, LED, 9 V battery + clip, jumpers. Optional: a TLC555/LMC555 (CMOS 555, ~$1) makes the duty and frequency match the math exactly; for the motor experiment: 2N2222 transistor, small DC motor, 1N4007 diode, 1 kΩ.

The wiring, precisely

Strip the old timing parts (R1, R2, big capacitor) off your blinker but keep the 555, its power wiring and the LED branch. Then:

#FromToWith
1555 pin 8 + pin 4+ railjumpers (unchanged from blinker)
2555 pin 1− railjumper (unchanged)
3pin 2pin 6jumper (unchanged)
4pin 2− railC 10 nF ceramic (“103”) — either way round
5Potentiometerthree separate columnsall 3 legs in their own strip
6pot middle leg (wiper)pin 3jumper
7pot outer leg Apin 6D1 — band toward the 555
8pot outer leg Bpin 6D2 — band toward the pot
9pin 3LED anode via 470 Ω, cathode to − railunchanged from blinker
The two classic mistakes here

① Diode bands: D1 and D2 must point opposite ways relative to pin 6 — one band toward the chip, one toward the pot. Same direction = no oscillation. ② The wiper is the middle leg. Wire an outer leg to pin 3 by mistake and the knob does nothing.

Power up

The LED lights immediately — at 1.4 kHz it looks perfectly steady. Turn the knob: brightness glides smoothly from near-dark to full. There is no flicker to see, but there is one to hear about: wave the board (or your eyes) quickly and you’ll catch a dotted-line trail — your own flicker-fusion experiment at 1.4 kHz.

If it misbehaves

SymptomLikely causeFix
LED stuck at full brightnessA diode reversed, or oscillation deadCheck the two bands point opposite ways relative to pin 6
Knob does nothingWrong pot leg on pin 3The middle leg is the wiper
Visible flickerWrong capacitor (µF instead of nF)Use the ceramic “103”; your 10 µF blinker cap makes ~1.4 Hz!
Dead entirelyPower pinsRe-check pins 8 & 4 to +, pin 1 to − (blinker rules apply)

Experiments

  • Slow-motion PWM: swap C back to 10 µF — the dimmer becomes a blinker whose knob adjusts on/off ratio at ~1.4 Hz. PWM and blinking are the same circuit at different speeds.
  • Drive a motor: pin 3 → 1 kΩ → 2N2222 base, motor from + rail to collector, flyback diode across the motor (Lesson 2.4 — the coil will kick!). The knob is now a speed control.
  • PWM → analog: feed pin 3 through your Lesson 5.3 low-pass filter (10 kΩ + 1 µF, fc ≈ 16 Hz) and measure the output with a multimeter: a steady DC voltage that follows the knob. You’ve built a digital-to-analog converter.

Where you stand

You’ve now completed the core and advanced courses: from a balloon rubbing on hair to a knob-controlled switching power stage — the exact technique inside EV motor drives and phone-screen dimming. And the mountains this course kept pointing at are now on the map: the expert course starts next — resonance and radio, power electronics, and finally a microcontroller that puts your PWM under software control.

⚡ Lab — Digital Twin — the Knob Before the Build

The exact dimmer you’re about to wire, knob included.

  • Sweep the knob: duty slides 5–95% while frequency pins near 1.4 kHz.
  • Compare “the LED itself” (slowed strobe) with “what your eye sees”.
  • Note t_high + t_low never changes — the pot is a fixed total, split two ways.
50% ↑
Why frequency barely moves
Ra + Rb is always the whole pot: turning the knob trades high-time for low-time
Predict before you build
knob at 25% → LED near quarter brightness; sweep it and the change is smooth (a bipolar NE555 skews the numbers slightly — see the note above)

Build checklist — 0 / 12