Solar energy comes from the sun, but the energy the sun emits comes from nuclear fusion on a massive scale. Specifically, it is the fusion of two hydrogen atoms into a single atom of helium.
The fusion of two atoms into a single larger atom produces energy because a small amount of mass is lost during the conversion from two atoms to one. According to Einstein's formula, energy produced from this reaction is equivalent to the mass lost times the speed of light squared.
The reaction occurs within the sun's core, where the sheer gravitational pressure squeezes hydrogen gas so tightly that the atoms are forced to collide with one another and fuse. The energy produced by the reactions produces 1,300 watts per square meter. Some of this energy is deflected by the atmosphere, but each square meter on Earth receives 4.2 kilowatts per day.
Solar collectors work because they contain a material that produces a spark when it is hit by sunlight. The first solar cells used selenium, but modern ones are based on silicon with impurities added to improve conductivity. An average solar cell has a top layer of silicon that is positively charged because it contains boron and a bottom layer that is negatively charged because it contains phosphorus. The flow of charge between the layers produces electricity that can be stored in a rechargeable battery for general use.
A power inverter may be used to change the DC electricity in the battery into AC, as AC is commonly used for electrical wiring indoors.