The sun is the major source of energy on Earth and sunlight can be converted directly into electrical energy using…