The solar cell is a p-n junction diode which uses photovoltaic effect for the conversion of light energy into electrical energy. When the light falls on the p-n junction, the light photons enter the junction through a p-type layer which is very thin. The number of electron-hole pairs are created when light energy enters the junction. The free electrons from the depletion region enter n-type of the junction and holes enter the p-type junction. When the concentration of electrons and holes increase on the n-type and p-type side, the junction behaves like a battery. This is the working principle of a solar cell.