>>N-Type and P-Type Semiconductor
When a silicon crystal doped by the fifth element, for example arsen, these arsen atoms will occupy the space between the silicon atoms. This lead in the enhance of free electrons on that compound. These free electrons come from the excess electrons that are owned by arsen against the surrounding atoms which are silicon atoms. Then this type of semiconductor called as n-type semiconductor.
On the contrary, when the silicon crystal doped by the third element, such as boron, the lack of boron valence electrons compared with surrounding atoms result in the emergence of holes which has a positive charge. This semiconductor then called as p-type semiconductor.

The energy diagrams of each type semiconductor are shown by this figure below.

Let’s pay an attention to that figure. From this figure we show that the fermi energy level located close to the valence band for p-type semiconductor and located near the conduction band for the n-type semiconductor.
When p-type and n-type semiconductor connected, the excess holes in the p-type and electrons in the n-type will result in the occurrence of diffusion currents. This type of currents flows from p-type to n-type for holes and oppositely for electrons. The existence of this diffusion current will result in the emergence of the empty area around the p-type and n-type boundaries. This region also known as the depletion region.
On the p-type side around the depletion area, electrons seem to accumulate while holes seem to accumulate on the n-type side. This accumulation charge come from the movement of electron and hole in the boundary edge according to the diffusion currents. The occurrence of the accumulation charge at opposite edge will contribute to the emergence of electric field in the depletion region. This electric field will produce drift current which has an opposite direction with the diffusion current. Because of this field, the electron minority carrier in the p-type move to the n-type region and vice versa with hole. In the equilibrium stage both current has a same value but opposite. So, in the equilibrium stage we will not see any currents flow in the p-n junction semiconductor.
However, when this p-n junction illuminated the number of minority electrons in the p-type and holes in the n-type will increase. This will cause the drift current greater. At a particular temperature and intensity this drift current is able to overcome the diffusion currents. In overall, currents appear on this junction which is the drift current. So, when illuminated, solar cell will produce electricity which is the drift current.

Thank you. You have give new spirit for me to be more again to write.