Solar cells, also called photovoltaic cells are made up of semiconductors, materials that have conductivity between that of an insulator and conductor. In essence a solar cell is a junction of two dissimilar semiconducting materials, known as p type and n type semiconductors. Both of these can be made from crystalline silicon.
Since silicon on its own does not conduct electricity other atoms are added to silicon’s structure. This process of adding other atoms called impurities to silicon structure is called doping. Pure silicon has a diamond like structure called silicon lattice. Its four valence bond electrons allow it to perfectly bond to four of it’s silicon neighbors. However this silicon lattice is essentially an insulator as there are no free electrons for any charge movement, and is therefore not a semiconductor. This crystalline structure can be turned into a semiconductor when doped.
If we are doping pure silicon with phosphorous atoms which has five valence bond electrons, it’ll cause extra electrons which are free to move around throughout the structure. Electrons are subatomic particles with a negative electric charge, silicon doped in this way is known as n type semiconductors.
If we are doping pure silicon with boron which has three valence bond electrons, it’ll cause lack of election. This lack or missing of electron is known as holes. Since the absence of of a negative charged particle, silicon doped in this way is known as p type semiconductor.
When we put together p type and n type semiconductors p-n junction is formed. When a pn junction is formed some of the electrons from the n region which have reached the conduction band are free to diffuse across the junction and combine with holes. Filling the hole makes a negative ion and leaves behind a positive ion on the n side.
This diffusion of electrons from n region to p region a charge separation as shown, which results in an electric field. The diffusion of electrons continues until the strength of electric field become sufficient to stop further diffusion of electrons from the n side. This creates an area around the junction called the depletion region. The depletion region is the heart of s solar cell. You can see that the n type material is kept thin to allow the light to pass through the pn junction and reach the depletion region.
When sunlight strikes a solar cell electrons in the silcon are ejected, which results in the formation of holes. If this happens in the depletion zone, the electric field will move the electrons to the n type layer and holes to the p type layer.
If we connect a load between two layers electrons will travel from the p type layer to the n type layer by crossing the depletion region, then go through the external load by creating a flow of current.