system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: how do solar panels work?
gpt
Firstly electricity is simply the flow of electrons. Electrons are all negatively charged and particles with the same charge repel each other like when you out the wrong ends of magnets together. Therefore electrons will always flow from an area with high concentration to an area with low concentration.

All electrical power sources work by creating what's called a potential difference between two poles. That is a difference in the concentration of electrons, so that if you connect a wire between the two poles electrons will flow through it to even it out.

Solar panels work by something called the photovoltaic effect. Basically, light consists of packets of energy called photons. When photons hit atoms they can "excite" the electrons. You can think of it as the photons knocking the electrons out of their orbit, usually into a higher orbit, but sometimes they can completely dislodge an electron from it's atom. That's called ionization.

The next part simplifies a lot: A solar panel consists of two layers, one that absorbs sunlight and one that stores the electrons. The photons dislodge the electrons in the first layer so that they jump over in the second layer. It is designed so that the electrons can't jump back the way they came from so the concentration of electrons increase in the second layer.

Now, as you probably have guessed, if you connect a wire between the two layers, the electrons will want to flow through it.