Solar Panels or PV arrays are PhotoVoltaic cells grouped on a module. These PV cells produce energy by interacting with sunlight. So in order to understand how solar panels work we should first understand the basic facts about sunlight.
Sunlight is the energy released by the fusion process that takes place in the core of the sun. Anyone taking a sunbath could confirm that it is perceived as a combination of light and heat. The basic particles or units of this energy are called photons.
So we have these tiny energy packets called photons being emitted by the Sun. How are they converted into electricity by Solar Cells? An electrical current is the flow of electric charge from one point to another. Solar cells are made of semiconductor materials, mainly - and almost exclusively- crystal silicon.
This fancy-name material can be found in most electronic devices and it is what makes possible for energy to flow through computer chips. Due to its particular molecular structure, current can be carried either by the flow of electrons or by the flow of positively-charged "holes" in the electron structure of the material. We will explain this last point further below.
Pure crystal silicon is almost neutrally charged, so it would not function well to produce electricity. So other elements must be added to achieve a negative or positive charge, this process is called doping.
So there are two types of silicon that work together in transferring sunlight into power. The first is N Type (negative) silicon, which has been added with phosphorus and has much more electrons for photons to "break loose". The second is P Type (positive) silicon, which contains boron thus having free openings, or holes. Putting it simple: N type silicon has charge to give and P type silicon needs charge. The junction area has a thin slice of p-type silicon (wafer) that has been diffused with a n-type dopant (phosporus), or the other way around. One might think: if the two types of silicon are put toghether they would become balanced - neutral- again, but this does not hapeen due to the electric field that is generated on the junction. The electric field acts as a diode, making harder for charges to go from the N side to the P side and eventually balancing this diffusion. Also, it promotes charge flow in a particular sense.
At last, in terms of the electric process, the cell needs to be connected to an external load. Metal contacts are placed both on the n-type and p-type sides of the solar cell, and electrodes (electrical conductor used to make contact with nonmetallic parts) are connected to an external load. Thus negative charges travel to a wire, power the load and continue until reaching a p-type metal contact where it combines with a positive charges. Let's recapitulate:
After all this there is an electrical current generated by the flow of charges and electrical voltage caused by the electrical field. There is power to sustain an electronic device.
However, the power a single solar cell produces is very little. Solar cells are combined within solar panels which in turn can be wired up in series in order to give off the required levels of power.