# PN JUNCTION

Connecting a piece of p-type and a piece of n-type together produces what's called a PN junction. If we connect the positive side of a voltage source to the P and the negative side to the N, a current flows through the whole thing. Electrons travel through the N side until they get to the junction, where they fall into holes on the other side and carry on by hopping from hole to hole.
But if we connect the voltage source the other way around, things don't work so smoothly. Unless you use a really high voltage, electrons near the junction on the P side don't have enough energy to climb up out of their holes and into the N side. So all the electrons get sucked out of the N side, and all the holes on the P side get filled up by electrons, and there are no free holes or electrons left to carry current.
So we have something that acts like a one-way valve, passing current in one direction but not another. This is a useful device known as a diode.