What Is a Diode?
A diode is the simplest sort of semiconductor device. Broadly speaking, a semiconductor is a material with a varying ability to conduct electrical current. Most semiconductors are made of a poor conductor that has had impurities (atoms of another material) added to it. The process of adding impurities is called doping.
In the case of LEDs, the conductor material is typically aluminum-gallium-arsenide (AlGaAs). In pure aluminum-gallium-arsenide, all of the atoms bond perfectly with their neighbors, leaving no free electrons (negatively charged particles) to conduct electric current. In doped material, additional atoms change the balance, either adding free electrons or creating holes where electrons can go. Either of these alterations make the material more conductive.
A semiconductor with extra electrons is called N-type material, since it has extra negatively charged particles. In N-type material, free electrons move from a negatively charged area to a positively charged area.
A semiconductor with extra holes is called P-type material, since it effectively has extra positively charged particles. Electrons can jump from hole to hole, moving from a negatively charged area to a positively charged area. As a result, the holes themselves appear to move from a positively charged area to a negatively charged area.
A diode consists of a section of N-type material bonded to a section of P-type material, with electrodes on each end. This arrangement conducts electricity in only one direction. When no voltage is applied to the diode, electrons from the N-type material fill holes from the P-type material along the junction between the layers, forming a depletion zone. In a depletion zone, the semiconductor material is returned to its original insulating state – all of the holes are filled, so there are no free electrons or empty spaces for electrons, and electricity can't flow.
To get rid of the depletion zone, you have to get electrons moving from the N-type area to the P-type area and holes moving in the reverse direction. To do this, you connect the N-type side of the diode to the negative end of a circuit and the P-type side to the positive end. The free electrons in the N-type material are repelled by the negative electrode and drawn to the positive electrode. The holes in the P-type material move the other way. When the voltage difference between the electrodes is high enough, the electrons in the depletion zone are boosted out of their holes and begin moving freely again. The depletion zone disappears, and charge moves across the diode.
If you try to run current the other way, with the P-type side connected to the negative end of the circuit and the N-type side connected to the positive end, current will not flow. The negative electrons in the N-type material are attracted to the positive electrode. The positive holes in the P-type material are attracted to the negative electrode. No current flows across the junction because the holes and the electrons are each moving in the wrong direction. The depletion zone increases. (See How Semiconductors Work for more information on the entire process.)
The interaction between electrons and holes in this setup has an interesting side effect – it generates light!