How solar panels work
Solar cells are made of silicon semiconductors, very similar to those used in transistors and electronic chips. A solar cell has two layers of silicon. The lower layer is silicon doped with boron atoms: boron atoms have one less electron than silicon, and so there is a shortage of electrons in this layer. The upper layer is doped with phosphorus atoms, which have one more electron than silicon.
Layers of silicon doped in this way exhibit what is called the photovoltaic effect. A photon of light hitting the top layer can knock one of the spare phosphorus electrons across the junction into the lower layer. The lower layer has therefore become negatively charged with respect to the upper layer, and so there is a potential difference (or voltage) across the two layers. Attach a couple of wires, and, say, a light bulb, between the two layers, and bingo! The electron can flow through the wires back to the top layer where it came from, and light the light bulb in the process.
The more light hitting the cell, the more electrons get knocked across, and the more power the cell can produce - although in practice even the best cells are barely 20% efficient, so only one in five of the photons is actually doing any work.
A single cell can only create a small voltage difference, and so to get a useful voltage from the panel it is usual to connect a number of cells in series.