The most common way of making p-type or n-type silicon material is to add an element that has an extra electron or is lacking an electron. In silicon, we use a process called "doping."
We'll use silicon as an example because crystalline silicon was the semiconductor material used in the earliest successful PV devices, it's still the most widely used PV material, and, although other PV materials and designs exploit the PV effect in slightly different ways, knowing how the effect works in crystalline silicon gives us a basic understanding of how it works in all devices
As depicted in this simplified diagram above, silicon has 14 electrons. The four electrons that orbit the nucleus in the outermost, or "valence," energy level are given to, accepted from, or shared with other atoms.

