My base understanding of the solar cell is as follows: Light hits metal in solar cell and emits electron via photoelectric effect. There is n-type silicon which has an overall negative charge due to excess electrons. There is also p-type silicon which has an overall positive charge due to a deficiency of electrons. A voltage is produced by this, but in order to keep current flowing the electrons being emitted via the photoelectric effect supply the n-type silicon with electrons to keep current flowing. My understanding is that an element such as Phosphorous can be added to silicon to produce excess electrons due to it's five valence electrons and silicon's four. Whereas an n-type semiconductor and that an element such as Boron can be used to produce a deficiency in electrons as Boron only has three valence electrons. Could somebody please check my understanding and correct me where I am incorrect?