Components · #6 of 52

Diodes + LEDs

Polarity, Forward Voltage, Current Limiting, and Clamp Paths

A single red through-hole LED on a white background.
An LED looks like a tiny lamp, but electrically it is still a diode. Direction and current decide whether it glows or dies. · Evan-Amos, Public domain

You plug a red LED into the breadboard. One leg is longer, one side of the plastic body is flattened, and the part seems harmless enough that it invites a mistake: connect it straight across a supply and see what happens.

For a few milliseconds it may look like success. Then the color changes, the light fades, or the chip inside opens forever. The LED was not asking for voltage. It was asking for a controlled current path.

A diode is a directional part. It lets current move easily one way and resists it the other way. That one idea shows up in more places than a beginner expects: indicator LEDs, reverse-polarity protection, rectifiers, signal clamps, ESD protectors and the flyback diode across a relay coil.

By the end, you can

  1. Read diode and LED polarity from the package and symbol
  2. Explain forward bias, reverse bias and forward voltage in physical terms
  3. Size an LED current-limiting resistor with $R = (V_{supply} - V_F) / I$
  4. Predict why LED current changes sharply with small voltage or temperature changes
  5. Recognize rectifier, clamp, Zener and flyback diode jobs
  6. Choose when a diode belongs across an inductive load

The one-way part

A plain silicon diode has two terminals: anode and cathode. Conventional current flows from anode to cathode when the diode is forward biased. Reverse the voltage and the diode blocks, at least until its reverse rating is exceeded.

That behavior is not a mechanical check valve. Inside the semiconductor, a PN junction creates a depletion region: a small zone short of mobile charge carriers. Forward bias shrinks that region and lets carriers cross. Reverse bias widens it and blocks ordinary current. Once you understand that the junction is a threshold-like barrier, the practical rules start to make sense.

A diagram of a supply, current-limiting resistor and LED in series.
The LED does not set a safe current by itself. The resistor drops whatever voltage is left and turns that leftover voltage into a controlled current. · TooFoo original

The symbol points in the direction of easy conventional current. The vertical bar is the cathode. On many through-hole diodes the cathode is also marked by a painted band. On many through-hole LEDs the cathode is the shorter leg and the package often has a flat edge on that side. Surface-mount parts use dots, chamfers, bars or package-specific marks, so the datasheet wins when the package is unfamiliar.

A green through-hole LED photographed close up.
Package clues help: LEDs often use leg length, a flat side or an internal lead-frame shape to identify polarity. None of those replaces the datasheet for odd packages. · Mister rf, CC BY-SA 4.0

Forward voltage is a price, not a supply setting

A forward-biased diode does not behave like a resistor. If you increase the voltage across it slightly, the current can change a lot. For a small silicon signal diode, a useful mental landmark is about 0.6 V to 0.8 V at ordinary currents. For LEDs the forward voltage depends strongly on color and chemistry: red is often around 1.8 V to 2.2 V, blue and white often around 2.8 V to 3.4 V.

Those numbers are not commands. They are operating points on a curve.

A plotted diode forward-current curve showing a steep knee and a temperature shift.
A diode's current rises steeply after the knee. Temperature shifts the curve, which is why a circuit that is safe cold may run more current when hot. · TooFoo original

Read a datasheet forward voltage table carefully. It usually says something like: V_F = 2.0 V typical at I_F = 20 mA. The current condition is part of the statement. At a different current, the forward voltage is different. At a different temperature, it is different again.

LEDs need current limiting

An LED turns carrier recombination into photons. The color comes from the semiconductor bandgap, so color and forward voltage are connected. That physics is why a red LED and a blue LED do not drop the same voltage at the same current.

A 5050 surface-mount RGB LED package.
An RGB LED package hides several LED junctions in one case. Each color has its own forward voltage and current path. · Mister rf, CC BY-SA 4.0

The simple indicator circuit is a supply, a resistor and the LED in series. Choose a target current first. For a status LED in modern electronics, 2 mA to 8 mA is often enough indoors. The old 20 mA rule came from dimmer LEDs and wastes battery on many new parts.

The resistor value is:

R=VsupplyVFIR = \frac{V_{supply} - V_F}{I}

For a 3.3 V rail, a red LED with a 2.1 V forward voltage and a 6 mA target:

R=3.32.10.006=200 ΩR = \frac{3.3 - 2.1}{0.006} = 200\ \Omega

Pick a nearby standard value such as 220 ohms. The actual current is then:

I=3.32.12205.5 mAI = \frac{3.3 - 2.1}{220} \approx 5.5\ \text{mA}
resistor: 220 ohm current: 5.9 mA resistor power: 7.7 mW verdict: comfortable indicator

Try these moves:

  1. Keep the supply at 3.3 V and move the LED forward voltage from red-like to blue-like.
  2. Ask for 20 mA, then notice how much smaller the resistor becomes.
  3. Raise the supply to 12 V. The same LED now needs a resistor that burns much more power.

A 3.3 V rail drives a red LED with about 2.0 V forward voltage. You want roughly 10 mA. Which resistor is closest?

Diodes route energy

LED indicators are the friendly first use. The deeper use is routing energy where you want it to go. A bridge rectifier steers AC so the load sees one polarity. A Zener diode or TVS diode clamps a node when it rises above a chosen voltage. A flyback diode gives an inductor a safe path when a switch opens.

A packaged bridge rectifier.
A bridge rectifier packages four diodes so either half-cycle of an AC input produces the same output polarity. · Mercado Viagens, CC BY 2.0

Rectifiers are about polarity. Clamps are about voltage limits. Flyback diodes are about current continuity.

A small Zener diode component.
Zener and TVS diodes are used deliberately in reverse breakdown. Their job is to clamp voltage, not to glow. · Medvedev, CC BY-SA 3.0

An inductor stores energy in a magnetic field. A relay coil, solenoid and motor winding are inductors. When current is flowing through an inductor, it cannot stop instantly. If you open the switch, the inductor will raise the voltage as high as needed to keep the current moving. That can punch through a transistor, reset a microcontroller or arc a switch contact.

A relay coil with a flyback diode showing the current path after the switch opens.
The flyback diode is reverse-biased during normal operation. When the switch opens, it becomes the safe loop for the coil current. · TooFoo original
A relay-coil driver circuit diagram with a clamp diode.
Relay and solenoid drivers almost always need a deliberate turn-off path. The clamp protects the switch, but it also changes how fast the coil releases. · Retired electrician, CC0

Diode families

Different diode jobs use different constructions:

A map of diode families and their primary jobs.
The same one-way-junction idea branches into several practical families. Choose the family for the job, not only for the package shape. · TooFoo original

Why does a relay coil driver often place a diode across the coil?

Why LED brightness is better controlled by current than voltage

Light output is roughly tied to forward current over the useful range. Voltage is a poor control knob because the diode curve is steep and temperature-sensitive. A small voltage error can create a large current error. That is why simple indicators use a resistor, serious LED lighting uses a current regulator, and PWM dimming usually changes the time-averaged current rather than trying to dial the LED voltage directly.

Practice 1 warm-up

A 5 V board needs a red status LED. The LED forward voltage is about 2.0 V at your chosen brightness, and you want 5 mA. Choose a resistor and estimate its power.

Show worked solution

R=(52)/0.005=600 ΩR = (5 - 2) / 0.005 = 600\ \Omega. A nearby 620 ohm resistor gives about 3/620=4.83 / 620 = 4.8 mA. Resistor power is I2R0.00482×620=0.014I^2R \approx 0.0048^2 \times 620 = 0.014 W, so a common 0.125 W or 0.25 W resistor is comfortable.

Practice 2 core

You switch a small 12 V solenoid with a MOSFET. It works once, then the MOSFET dies when the firmware turns the solenoid off. What did the schematic probably miss?

Show worked solution

The solenoid is an inductor. When the MOSFET opens, the coil current needs a path. Add a flyback clamp across the solenoid, oriented so it is reverse-biased while the solenoid is powered and forward-biased when the switch opens. For fast release, consider a higher voltage clamp instead of only a plain diode.

Key takeaways

  • A diode is directional: anode-to-cathode current is easy only when the junction is forward biased.
  • Forward voltage is an operating point on a curve, not a safe voltage source setting.
  • LED brightness is controlled by current. A resistor or current driver sets that current.
  • Rectifiers steer polarity; Zeners and TVS diodes clamp voltage; flyback diodes route inductive current.
  • A protection diode can change timing, especially relay and solenoid release time.

Diodes teach the first serious electronics habit: do not only ask what the part does when the circuit is calm. Ask where the energy goes during the transient. The LED's extra energy becomes heat in a resistor. The relay coil's stored energy needs a clamp. The next lesson gives that current path a controllable switch.

full glossary →