
Solar panels or photovoltaic cells convert sunlight directly into electricity. They are made from semiconductors, silicone is the most commonly used. When sunlight strikes a semiconductor it is absorbed, and an electron is knocked free. This happens naturally but the electron is not captured. PV cells direct that free electron to a wire that directs the electron to where it can be used.
The solar panels voltage, in combination with the current determines the amount of power in watts that can be produced. An atom of silicone is arranged in 3 layers and contains 14 electrons. The first two layers are completely full of electrons with 5 each, while the outer layer has only 4 electrons. Silicone will always try to fill that outer layer, so it shares the electrons with the inner layers forming a crystalline structure.
Solar panels use a slightly modified silicone with impurities. Other elements with more electrons are introduced into the silicone. This allows for extra, un-bonded electrons to move freely. When photons strike the surface they knock some of the un-bonded electrons free from their nucleus. These are called free carriers and these are where the current comes from.