Here is what
How do Photocells Work?!
That is a very good question, Photocell consists of two special pieces of silicon joined together.
Pure silicon is naturally charged but if small amount of an impurity such as phosphorus is added, there are more free electron which make this a better conductor than pure silicon.
This is known as n-type(negative) silicon.
If a different impurity, such as boron, is added there is an absence of free electron. The absence of an electron is known as a hole and the silicon is known as p-type silicon.
When these two types of silicon are placed together it is called a p-n junction. An electric field is created between the two layers.
Sunlight is made up of a tiny packets of energy called photons. When photons are absorbed the energy causes electron to become free. They move to the negative layer and leave the junction to flow in an external circuit.