A light-emitting diode (LED) is a PN junction made from a direct-bandgap semiconductor that emits light when forward biased. It is an ordinary Diode in every electrical respect except that the energy released when carriers recombine comes out as photons instead of as heat.

Why it emits light

In Forward bias the junction’s barrier is lowered and a large current flows: electrons are injected into the p-side and holes into the n-side, and near the junction they recombine — an electron drops from the conduction band into an empty valence-band state (a hole) and the two annihilate. That drop releases an energy roughly equal to the Bandgap . In a direct-bandgap material that energy is released as a single photon of energy

is Planck’s constant, and the photon’s frequency and wavelength, the speed of light, the material’s bandgap energy. In an indirect-gap material like silicon the energy mostly turns into lattice vibrations (heat) instead, which is why LEDs are not made from silicon — see Direct and indirect bandgap.

Colour is set by the bandgap

Rearranging gives : a larger bandgap means a higher-energy, shorter-wavelength photon. So the material’s Bandgap directly fixes the colour. Wide-gap materials (GaN and its alloys) emit blue and ultraviolet; narrower-gap materials (GaAs and its alloys) emit red and infrared. White LEDs are typically a blue LED plus a phosphor that down-converts some blue to yellow.

Higher forward voltage than a silicon diode

Because the forward drop of a diode is tied to its bandgap, and LED materials have larger bandgaps than silicon, an LED’s forward voltage is higher than the ~0.7 V of a silicon diode: roughly 1.8 V for a red LED and about 3.2 V for a blue or white one. In a circuit you still treat it with the Constant-voltage-drop model — just with the appropriate higher — and you must include a series current-limiting resistor exactly as for any forward-biased diode, since the LED’s curve is just as steeply exponential.

Photodiodes generate current under illumination; LEDs emit photons when forward-biased.

The LED’s exact opposite is the Photodiode: same junction, run in reverse, absorbing photons to make current instead of consuming current to make photons.