Vol.:(0123456789) 1 3 International Journal of Environmental Science and Technology https://doi.org/10.1007/s13762-023-05110-5 ORIGINAL PAPER Solar panel energy production forecasting by machine learning methods and contribution of lifespan to sustainability H. Yılmaz 1  · M. Şahin 2 Received: 23 November 2022 / Revised: 19 June 2023 / Accepted: 13 July 2023 © The Author(s) under exclusive licence to Iranian Society of Environmentalists (IRSEN) and Science and Research Branch, Islamic Azad University 2023 Abstract The struggle to protect the atmosphere and the environment is increasing rapidly around the world. More work is needed to make energy production from renewable energy sources sustainable. The integration of energy with machine learning provides numerous advantages. In this study, the solar energy system, which is one of the main renewable energy sources, is considered. Support Vector Machine (SVM), K-nearest neighbor, Random Forest, Artifcial Neural networks, Naive Bayes, Logistic Regression, Decision Tree, Gradient Boosting, Adaptive Boosting, and Stochastic Gradient Descent are used to forecast energy production. Forecast experiments are conducted in a region with high solar radiation and high temperature. Thus, there is an opportunity to examine overheated solar panels as well. A small-scale but adequate weather station is installed right next to the solar panel. Inputs such as temperature, pressure, humidity, and solar radiation obtained from the atmosphere with sensors are used. Obtained data are processed utilizing an Arduino microcontroller, data are recorded with C# software, and machine learning training is performed using Python programming. According to the results, the best per- formance is provided by SVM. This study provides guidance on whether solar energy systems investments are appropriate in the relevant region. Keywords Machine learning · Solar panels · Sustainable energy · Energy forecasting Introduction The development of technology, industrial growth, and the search for new energy sources in countries are among the most important issues in the world order. Today, fossil fuels which are the primary energy source are used for electric power generation (Rahman and Wahid 2021). While energy is produced by burning fossil fuels the resulting heat and harmful gases are released to nature. This situation reveals problems such as global warming, sea level rise, and the greenhouse efect. Although human begins are the living species that consume fossil fuels, they are the most afected by the damages. As soon as a baby is born, it is exposed to the harms of fossil fuels (Perera and Nadeau 2022). The environmental disadvantages of fossil fuels are high and have a limited lifespan. The increasing demand for energy leads to the need to use more fossil fuels. In addition, the recovery of fossil fuels after their use takes many years (Mete et al. 2020; Williams 1994). Fossil fuels which are the product of the infrastructure formed hundreds of years ago can only be used today. Although it is known that the most appropriate energy management that saves nature, the increasing number of populations, technology addiction, and the rapid change of modern lifestyle increase consumption even more. In addition, the cost of fuel worldwide and the increase and decrease in the prices of certain products from time-to-time cause changes in the costs of obtaining energy. Minimizing the costs of obtaining energy and preventing global warming should be implemented without losing time. There are alternative sources that will replace fossil fuels which used instead. In this context, countries have consciously started to turn to alternative energy sources. In the majority of countries production from renewable energy sources is still insufcient to meet energy needs. By expand- ing alternative energy sources and making them sustainable Editorial responsibility: Shahid Hussain. * M. Şahin mhmt_shn@hotmail.com 1 Department of Energy Systems Engineering, Iskenderun Technical University, 31200 Iskenderun, Turkey 2 Department of Industrial Engineering, Iskenderun Technical University, 31200 Iskenderun, Turkey