From the basics
Semiconductors are the foundation of electronics. Semiconductors can have atoms placed in them to give the bulk a generally negative or positive charge. Doping, as it is called, is the process of placing these atoms into the material. Phosphorus is the most common n-type dopant and it produces a negative semiconductor. Boron is the most common p-type dopant and it produces a positive semiconductor. Adding phosphorus adds electrons, while adding boron adds holes (positive charge carriers). When placed together, a pn junction is formed.
Holes formed in the p side and electrons in the n side move to each other’s sides and recombine. In other words, the positive and negative charges cancel out, as do the particles themselves (essentially). What forms is a depletion layer (or region), where there is a built-in voltage due to the excess positive charge on the n side and excess negative charge on the p side. This voltage is known as a potential gradient. With a potential gradient comes an electric field which can be used to push charges around or keep them at bay.
Close contact: the pn junction
When p- and n-type semiconductors are in contact, not only is a depletion region formed, but their energy bands interact. These bands tell us how easy it is for charges to move around. Also, they reveal that there is a range of energies in which the carriers cannot exist. This is the bandgap. There is an energy hill that particles need to overcome to move across the junction. Applying a voltage can either steepen this hill (reverse bias) or make it shallower (forward bias). Making it shallow will lower this barrier and make it easier for electrons and holes to move across. Making it steeper will make it much more difficult for charges to move across. In the slopes between the p and n sides, recombination occurs. This is due to the fact that electrons and holes will seek out states of lower potential energy. The electrons will be forced up the slope by the voltage, but will tend to step down into the lower states seen in the valence band.
Current is defined as the amount of charge moving per second. In diodes, there are actually four currents: electron and hole diffusion, and electron and hole drift. Diffusion current occurs when a region with a lot of one particle wants to even out with a region with less. Think of perfume. If perfume is sprayed on one side of the room, it doesn’t take long to smell it on the other. This is because the perfume particles diffuse around the room to even out the concentration. The same exact thing happens with electrons and holes. Holes in the p side naturally diffuse to the n side to try and even out the concentration; electrons from the n side diffuse to the p side to even out the concentration. Diffusion current is independent of charge and is solely dependent on particle concentration gradients.
Drift current is a result of the electric charges of the particles. Holes move with the electric field, while electrons move against it. When an electron-hole pair (EHP) is generated, the built-in electric field pushes holes with it and electrons against it. Depending on how a voltage is applied, the currents could increase or decrease.
To apply a forward bias, the positive side of a source needs to be applied to the cathode (p side) of the diode and the negative side to the anode (n side). This is why a battery will not work when put in backwards: the battery is the voltage source and its anode needs to match up with the anode of the diodes in the device. When a diode is forward biased, the slope between the energies going from the n to the p side shallow. This makes current much easier to flow. On the I-V curve shown, a slight increase in forward bias voltage drastically increases the diode current.
To apply a reverse bias, the positive and negative sides of the source are applied to the opposite sides of the diode. So negative with positive and positive with negative. The depletion region widens so much that essentially no current makes it through. This makes diodes great rectifiers. Alternating current (AC) can destroy many electronic devices unless something turns the AC into direct current (DC). AC voltage flows back and forth. Since the reverse voltage yields essentially zero current through a diode, current is said to only go one way through the diode.
Two interesting things can happen with a sufficient reverse bias voltage: avalanche and Zener breakdown. With a high enough voltage applied, the induced electric field in the junction will be so high that electrons start travelling very quickly. This speed translates to a high enough energy to actually knock electrons out of the bonds between the semiconductor’s atoms. If the freed electron has high enough energy, it will do the same to another electron and the effect will continue. This is called avalanche breakdown. Avalanche breakdown produces a lot of heat and can quickly result in shorting out the diode. Adding a sufficient resistance can keep this current from getting out of control while allowing the device to operate at the breakdown voltage.
Zener breakdown occurs at even higher voltages. The depletion width shrinks sufficiently to induce quantum tunneling. Without getting into the details, the slope between energy bands becomes so steep that electrons (holes, too) just ignore the barrier and pass straight through it as if it weren’t there. Enough particles pass through to yield an appreciable current. Just as with avalanche voltages, a resistor with a sufficient resistance can be applied to allow the diode to work under Zener breakdown voltages.