Solar panels harness the photoelectric effect to produce electricity from sunlight. Thousands of photovoltaic cells, often made from silicon, are connected together in solar panels. The silicon allows electrons to move freely through the panels and produce a current when struck by photons from sunlight. This direct current is then converted to alternating current electricity. While solar panels provide a renewable source of energy from the sun, they do not work at night without sunlight. However, solar batteries can store excess energy from the panels to provide power when needed.