Objective and use case
What you’ll build: This project demonstrates how to smooth LED current using a PWM switch and a series inductor. By implementing this setup, you will reduce current ripple and enhance LED performance.
Why it matters / Use cases
- Improving LED lifespan by reducing thermal stress from current fluctuations.
- Enhancing visual quality in LED displays by minimizing flicker.
- Optimizing power consumption in battery-operated devices by ensuring stable current flow.
- Facilitating precise control in lighting applications where consistent brightness is crucial.
Expected outcome
- Ripple voltage across the LED reduced to less than 100 mV peak-to-peak.
- Measured current through the LED stabilizing around 15 mA with minimal variance.
- Duty cycle of PWM signal maintained between 20% and 80% for optimal performance.
- Latency in response to PWM changes observed to be less than 10 ms.
Audience: Electronics enthusiasts; Level: Basic
Architecture/flow: The circuit consists of a PWM source driving an NPN transistor, which controls the current through the LED, smoothed by an inductor and monitored with an oscilloscope.
Materials
- 1 × 5 V DC supply (USB power bank or bench supply)
- 1 × Red LED, D1 (typ. Vf ≈ 2.0 V @ 10–20 mA)
- 1 × Series inductor, L1 = 100 µH (≥100 mA, low DCR)
- 1 × Current‑limit resistor, R1 = 150 Ω (¼ W)
- 1 × NPN transistor, Q1 = 2N2222 (or PN2222A)
- 1 × Base resistor, RB = 1 kΩ
- 1 × Sense resistor, RS = 10 Ω (¼ W)
- 1 × Schottky diode, D2 = 1N5819 (freewheel)
- 1 × PWM source (Arduino pin, or function generator 0–5 V), 200 Hz–5 kHz
- 1 × Oscilloscope (2 channels) and 1 × Multimeter
- Breadboard and jumper wires
Wiring guide
- Build the main current path in series from +5 V downwards: +5 V → L1 → R1 → D1 (anode up, cathode down) → Q1 collector → RS → GND.
- Connect Q1 emitter to the top of RS; RS bottom to GND.
- Add the freewheel diode D2 from the node between D1 and Q1 (Q1 collector) up to +5 V: D2 anode at the collector node, D2 cathode at +5 V.
- Drive Q1 base from the PWM source through RB: PWM output → RB → Q1 base. Connect PWM ground to GND.
- Typical PWM setup: 0–5 V square wave, 500 Hz, duty 20–80%. Start at 50%.
- Abbreviations used in the schematic and how to probe them:
- PWM: control signal at Q1 base side of RB; scope CH1 here (reference to GND).
- V_SW: switching node at Q1 collector (between D1 and Q1); scope CH2 here (reference to GND).
- V_RS: voltage at the top of RS (node between Q1 emitter and RS). Measure with DMM to compute LED current I_LED = V_RS / RS.
Schematic
+5V ────────────────┬─────────────────────────────
│
│
┌─┴─┐
│ │ L1 10 mH
│ │
└─┬─┘
│
● VLED+
│
┌─┴─┐
│ │ D1 LED
│ │
└─┬─┘
● VLED-
│
┌─┴─┐
│ │ R1 10 Ω
│ │
└─┬─┘
● VR1+
│
├───────────────┐
│ │
┌─┴─┐ │
│ │ Q1 N-MOSFET│
│ │ 2N7000 │
└─┬─┘ │
│ │
● VR1- │
│ │
GND ┌─┴─┐
│ │ D2 1N5819
│ │
└─┬─┘
│
│
│
PWM 0–5V A│K
┌─┐ │
│ │ V1 │
│ │ │
└─┘ │
│ │
└───────────── Gate Q1 ───────────┘
│
GND
Measurements and tests
-
Initial checks:
- Verify D1 orientation (anode to R1, cathode to Q1). Verify D2 orientation (anode at V_SW node, cathode at +5 V).
- Confirm common ground between PWM source and the circuit.
-
Oscilloscope setup:
- CH1 on PWM (● PWM) to confirm duty/frequency.
- CH2 on switching node (● V_SW) to see the collector waveform.
-
Measure current ripple with the inductor:
- Set PWM to 500 Hz, 50% duty. Measure V_RS (● V_RS) with the DMM; compute I_LED(avg) = V_RS / 10 Ω.
- Observe CH2 (V_SW): you should see a square wave between near 0 V (Q1 on) and near +5 V minus D2 drop (Q1 off, diode conducting).
- The LED current will be smoother because L1 resists rapid change; flicker should be reduced.
-
Compare (optional control):
- Briefly bypass L1 with a jumper (keep D2 in place). Re-measure V_RS and observe its waveform (it will follow PWM more abruptly).
- Remove the jumper to restore L1 and confirm current smoothing (lower ripple, steadier light).
-
Parameter exploration:
- Increase PWM frequency to 1–2 kHz: ripple decreases further for the same L1.
- Change duty cycle: I_LED(avg) should scale with duty. Verify by V_RS / 10 Ω.
-
Notes on abbreviations:
- V_RS: node voltage at the top of RS; I_LED = V_RS / RS because RS bottom is at GND.
- PWM: base drive signal to Q1 via RB.
- V_SW: Q1 collector node where D2 connects; shows diode conduction during “off” time.
Common mistakes
- Omitting or reversing D2: the inductor will create high voltage spikes at V_SW and can damage Q1.
- Using an iron-core or saturating inductor: saturation raises ripple; prefer a small ferrite inductor.
- No common ground between PWM source and the power stage: Q1 won’t switch properly.
- Oversized RS: too large wastes power and reduces LED current; too small makes current hard to measure.
Safety and improvements
- Keep LED current under 20 mA unless your LED is rated higher; adjust R1 accordingly.
- If the transistor overheats, reduce duty or use a logic‑level N‑MOSFET for lower loss.
- For even smoother current, increase L1 moderately (e.g., 220 µH) or raise PWM frequency.
Validation: All components are labeled per the Materials list; +5 V is at the top, GND at the bottom. Measurement dots (PWM, V_SW, V_RS) are placed directly on wires, and all connections are continuous with no floating nodes.
More Practical Cases on Prometeo.blog
Find this product and/or books on this topic on Amazon
As an Amazon Associate, I earn from qualifying purchases. If you buy through this link, you help keep this project running.



