p-n layers

Solar cells have several layers. Among them are the n-layer and the p-layer, which are separated by a transition layer, the p-n junction. The layers consist mainly of silicon. In order to use the photovoltaic effect to generate electricity, the n-layer (top) is enriched with phosphorus atoms and thus has an excess of electrons. The p-layer, on the other hand (bottom), is enriched with boron atoms and has an electron deficiency.

When light falls on the solar cell, the excess electrons are released from the n-layer and migrate to the p-layer, generating electrical voltage. The electrons then migrate back into the n-layer.