A p-n junction is the boundary created when an intrinsic semiconductor is doped exclusively with acceptors in one section of its volume and exclusively with donors in the other half. It appears like a p-type and an n-type semiconductor joined together.
Electrons diffuse from the n-type region to the p-type region due to the higher concentration of electrons at the n-type region.
Equivalently, holes diffuse from the p-type region to the n-type region due to the higher concentration of holes at the p-type region.
The holes and electrons (positive and negative charges) meet and neutralise each other. This depletes the region (called the depletion region) of mobile charge carriers.
This neutralisation causes the originally uncharged atoms in the depletion region to become charged (due to the excess of positive/negative charges gained from diffusion).
A layer of fixed positive ions develops in the n-type section of the depletion region as electrons diffuse into the p-type section.
This is because the electrons become unbound from the atoms in the n-type region as they diffuse, leaving behind positive ions.
Similarly, a layer of fixed negative ions develops in the p-type region as holes diffuse into the n-type section. This is because the holes become unbound from the atoms in the p-type region as they diffuse, leaving behind negative ions.
An electric field is generated between the positive and negative ions, from the n-type to the p-type region.
This electric field is called the junction field and it has an associated junction potential. This field acts against the diffusion, eventually stopping it.
Semiconductors containing p-n junctions are used in the creation of semiconductor diodes (a type of electrical component that allows current to flow in only one direction).
Recall that diodes are used (among other things) in rectifiers to convert an alternating current to a direct current.
When a diode is connected in forward bias, the p-type side of the junction is connected to the positive terminal of a battery and the n-type side is connected to the negative terminal of the battery.
The p-type side of the diode has a surplus of holes (positive charges). These cannot move to the n-side of the diode because of negative ions close to the p-n junction.
The battery applies an electric field that extends from the p-type region to the n-type region. This opposes the junction field of the semiconductor.
Holes in the p-type region and the electrons in the n-type region are therefore pushed towards the junction.
The depletion region becomes narrower as the holes and electrons diffuse across the boundary, neutralising the fixed ions in either side of the region.
Once the external potential difference across the junction becomes high enough, the depletion region disappears and the majority charge carriers become free to flow across the junction, conducting electricity.
This potential difference is known as the diode voltage.
When a diode is connected in reverse bias, the p-type side of the junction is connected to the negative terminal of a battery and the n-type side is connected to the positive terminal of the battery.
The electric field applied by the battery points in the same direction as the junction field, extending from the n-type region to the p-type region.
This reinforces the junction field of the semiconductor. This pushes the holes in the p-type region and the electrons in the n-type region further away from the junction.
The depletion region becomes wider because the holes and electrons move away from the boundary, creating more fixed ions in either side of the region.
The majority charge carriers are unable to flow across the boundary. Only a small current flows, made up of the minority charge carriers of each region.
A semiconductor diode can therefore be used rectifier as a sizable current flows through in forward bias but negligible current flows through in reverse bias.