This is how electricity is obtained from a solar cell:
Electric current is the movement of free charged particles, the so-called charge carriers. When sunlight impacts the solar cell, positive and negative charge carriers are released there. The solar cell is made conductive by semiconductors such as crystalline silicon. To ensure that the charge carriers are conducted properly, the silicon is doped with foreign atoms such as boron and phosphor. One then speaks of p- and n-type silicon. In the transition between the two silicon layers is the boundary layer, where an electric field with a positive and negative pole is produced. Upon exposure to the sun, electrons are then separated from the atoms and move in the direction of the positive pole. On the front and back of the cell, the electrons are carried away via metal contact layers and made to flow through a conductor. Electric current flows.