The pn Junction

When p-type and n-type are joined, holes and electrons spread across the boundary into each other and vanish where they meet. What is left is the fixed impurity ions, in a layer that holds almost no carriers. This is the depletion layer.

Those ions are negative on the p side and positive on the n side, so a potential difference builds across the layer that pushes carriers back. That potential difference is what stops the two sides mixing any further.

A forward voltage, positive on the p side, works against that potential difference. The higher the voltage, the narrower the layer becomes, and past roughly 0.6 V current starts to flow. Reverse the voltage and the layer widens instead, so almost no current flows. Conducting in one direction only is what makes this a diode.

The scenes