1 Introduction

Due to the increase in industrialization and population, the need for energy sources is increasing day by day. There is huge pressure on energy production which leads to overexploitation of nonrenewable resources over the past century [1]. Petroleum, natural gas, and coal are the basic source of energy. Combustion of these sources causes green gas emission (25%) and nitric oxide emission (36.48%) [2]. Rapid depletion of fossil fuels and alarming climatic changes demands new and environment-friendly energy resources [3, 4]. A large quantity of fossil fuels is used up as motor fuel in transportation (30.5%), households (26.1%), and industry (25.8%) [5]. Finding an alternative energy source to replace fossil fuels is a hunting task for society. In recent years, biofuel production has played an important role to increase employment or development in rural areas which are also linked to lower import of oil and reduced environmental issues [6]. Table 1 shows the global production of biofuel all over the world.

Table 1 Global biodiesel production by different countries

In the past, there were many sources to produce energy, but they are depleting day by day, leading to a competition between food and fuel production. The world population is predicted to increase from 7 to 9.2 billion by 2050, and more than 850 million people are undernourished [17]. Biodiesel is mostly produced using rapeseed, palm oil, sunflower, and soybean (Table 2). These crops require land and fresh water to grow which leads to a reduction of land or water resources. In the world, about 331 million hectares of land, which is 6.5% of the world’s total land area, suffer from salinity, which is continuously increasing at a rate of 1.0–1.5 million ha/year [27]. Only 0.01% of the water on the earth comprises fresh water; 2.3% is covered by lakes, rivers, and reservoirs. Freshwater wetland comprises approximately 5.4–6.8% of the global land surface area [28].

Table 2 Biodiesel production from biomass of conventional species

Photosynthetic organisms such as microalgae have been suggested to be more competent for biofuel production [3]. Microalgae can be harvested multiple times over a year and have the adaptability to grow in water with different levels of nutrients and a wide range of light and temperature (−2–50°C) [29]. Biomass is doubled every 24 h, and the growth rate is much faster than trees. Microalgae have high efficiency for photosynthesis and fix CO2 from the air which reduces green gas emissions providing CO2-free biodiesel. It contains a high amount of lipids which needs to be further transesterified into biodiesel [30]. Algal biofuel differs from petrodiesel as it has no sulfur content, the flashpoint is significantly higher, and it has more aggressive solvent properties [31]. It also has superior lubricating power which can increase the lifetime of fuel injecting equipment and has reduced particulate matter up to 47% [32].

The major challenge of algal biofuel production has been the high cost of oil extraction from the microalgae and subsequent conversion into biodiesel. However, there are many extraction methods which require longer extraction times and a high quantity of solvents, resulting in high cost and energy demands [33]. The rigid cell wall structure of algal cells hinders oil release from the cells. Thus, to extract oils from algae, mechanical crushing seems to be an ineffective approach [34]. Microwave-assisted in situ transesterification has been suggested to be a substitute approach to address the aforementioned problems. Microwaves penetrate the cell wall structure and generate heat which leads to localized high temperature [35] and pressure gradients which help in cell wall degradation which then produces good quality extracts with better target compound recovery [36, 37]. Hence, a process with simultaneous extraction and transesterification (in situ transesterification) from algae is advisable to develop [38]. Mostly homogeneous base catalysts are used to transesterify oil into biodiesel such as potassium hydroxide which catalyzes the transesterification process, resulting in faster reactions as compared to acid catalysts [39]. The biodiesel yield is enhanced as the catalyst concentration increases, but after certain concentration levels are reached, yield begins to decrease which may be due to the formation of soap and improper mixing. There are three basic steps of in situ transesterification process. In the first step of base-catalyzed microwave in situ transesterification, alkoxide ions attack the carbonyl group of triglyceride molecules to form a tetrahedral intermediate. In the second step, the tetrahedral intermediate reacts with alcohol which produces the alkoxide ion. In the last step, the tetrahedral intermediate rearranges, resulting in an ester and a diglyceride [40]. The diglyceride is further transesterified to form a methyl ester and monoglyceride, which then is further converted to another methyl ester and glycerol. Microwave enhances the transesterification reaction by a thermal effect [41]. Methanol evaporates due to the strong microwave interaction of the material. The microwave interaction with triglycerides and methanol increases a dipolar polarization phenomenon and causes large reductions of activation energy which depends on the medium and reaction mechanisms [42]. Methanol is a strong microwave absorption material. The attached OH group behaves as it was anchored to an immobile raft [43]. The more localized rotations dominate the microwave spectrum and lead to localized superheating which helps with a faster reaction time [44].

Response surface methodology (RSM) is a tool to optimize an extraction process and identify interrelationships between variables by developing an experimental design. Response surface methodologies can be achieved through a number of methods to design experimental procedures such as central composite design (CCD) [45]. The central composite design allows a range of parameters and different factors. It can assess a single variable and many variables in combination with the particle response. Central composite design can reduce the duration of experimental runs as compared to other full factorial methods [46, 47]. On the other hand, the traditional transesterification process is time and energy consuming. Microwave irradiation methods provide eco-friendly, fast, energy-efficient, and cheap techniques that can improve oil extraction and biodiesel quality [48].

In the current study, a microwave irradiation method is proposed to improve simultaneous algal oil extraction and transesterification processes. A response surface methodology is introduced to optimize the effect of the catalyst concentration and reaction time. It is anticipated that this work will inspire further developments and applications of algal biomass for biofuel production at an industrial scale.

2 Materials and methods

2.1 Algae collection, cultivation, and harvesting

Algae samples were collected from Jillani Park and Jallo Park Lahore, Pakistan. Microscopic identification reveals Oedogonium sp., Ulothrix sp., Cladophora sp., and Spirogyra sp. on the basis of their sizes and forms (Fig. 1). The size and form of algae are very important for morphological identification. Table 3 lists the morphological characteristics of algal samples. These four strains were selected on the basis of relative abundance, high lipid content, growth rate, their adaptation to environmental conditions, and high biomass productivity. The blue-green medium was used to culture algal species. Algal biomass was harvested by centrifugation at 3000 rpm for 5 min. The algal pellet was oven-dried at 40°C for 2 h.

Fig. 1
figure 1

Microscopic images of a Oedogonium sp., b Ulothrix sp., c Spirogyra sp., and d Cladophora sp.

Table 3 Morphological characteristics of studied algal samples

2.2 In situ transesterification of algae biomass into biodiesel

Two grams of algae powder was used, and 15-ml methanol and the catalyst potassium hydrochloride were added. The mixture was subjected to a domestic microwave oven (Haier HGN-36100EGS) irradiation with 400W power under a variety of conditions: reaction times of 3 to 9 min and catalyst concentrations in the range of 0.5 to 3.5 wt.% of dry biomass (Fig. 2). Hexane was added after the reaction was completed, and the solution was then centrifuged at 3200 rpm for 5 min. The upper layer was removed. The volume of biodiesel yield (%) was calculated using Eq. (1).

$$ \mathrm{Biodiesel}\ \mathrm{yield}\ \left(\%\right)=\mathrm{Volume}\ \mathrm{of}\ \mathrm{product}/\mathrm{Volume}\ \mathrm{of}\ \mathrm{feed}\times 100 $$
(1)
Fig. 2
figure 2

In situ transesterification using microwave. a Algae sample with methanol and catalyst. b Domestic microwave oven. c Mixture in microwave. d Centrifuge

2.3 Response surface optimization design of microwave-assisted transesterification

In the present work, response surface methodology with the central composite design of response surface methodology (Design-Expert Version 11) was employed to optimize conditions for biodiesel production from algae biomass. The experimental design consisted of catalyst concentration and heating time as design variables in microwave-assisted transesterification while considering biodiesel yield as a response variable. Tables 3, 4, 5, 6, 7, and 8 depict the experimental design of microwave-assisted biodiesel production from Oedogonium sp., Ulothrix sp., Cladophora sp., and Spirogyra sp. with 13 different conditions. The effect of independent factors on the dependent factors was analyzed by a quadratic equation:

$$ \mathrm{Y}={\mathrm{a}}_0+{\mathrm{a}}_1{\mathrm{X}}_1+{\mathrm{a}}_2{\mathrm{X}}_2+{\mathrm{a}}_3{\mathrm{X}}_3+{\mathrm{a}}_{11}{\mathrm{X}}_{21}+{\mathrm{a}}_{22}{\mathrm{X}}_2+{\mathrm{a}}_{12}{\mathrm{X}}_1{\mathrm{X}}_2 $$
(2)

where Y is the response (biodiesel yield), a0 is offset term, a1 and a2 are linear coefficients, a11 and a22 are the squared term coefficients, and a12 and a13 are the interaction coefficients. X1 and X2 were catalyst concentration and heating time factors.

Table 4 Central composite design results of the combined effect of factors of microwave-assisted transesterification in Oedogonium sp.
Table 5 Central composite design results of the combined effect of factors of microwave-assisted transesterification in Ulothrix sp.
Table 6 Central composite design results of the combined effect of factors of microwave-assisted transesterification in Cladophora sp.
Table 7 Central composite design results of the combined effect of factors of microwave-assisted transesterification in Spirogyra sp.
Table 8 Biodiesel production from in situ transesterification using microwave

2.4 Statistical analysis

Analysis of variance (ANOVA) and least significant difference were performed to analyze the data of central composite design.

3 Results and discussions

3.1 Effect of process parameters and optimization

In the present study, the effect of catalyst concentration and heating time in the microwave assistance in situ transesterification was evaluated on biodiesel yield of Oedogonium sp., Ulothrix sp., Cladophora sp., and Spirogyra sp. This included 13 different conditions in each experiment. The influence of factors on biodiesel yield with microwave assistance is shown in Tables 4, 5, 6, and 7. The optimal condition of in situ transesterification was determined to be 1 wt.% catalyst concentration and 3 min with constant methanol concentration, at which 73% of biodiesel was obtained from Oedogonium sp., 88% from Ulothrix sp., 80% from Cladophora sp., and 67% dry weights from Spirogyra sp. There is a significant effect of methanol on the simultaneous extraction and transesterification reaction. Here, methanol acts both as a solvent for algal lipid extraction and a reactant for transesterification of esters. Under microwave irradiation, the solubility of methanol and algal lipids is improved because methanol dipole reorientates under microwave irradiation to destroy the two-tier structure of the interface of methanol and extracted lipids, which make it a good microwave radiation absorption material [56]. A high quantity of methanol reduces the concentration of the catalyst in the reactant mixture and delays the transesterification reaction. As methanol is used in the reaction both as a solvent and a reactant, a low quantity of methanol is not appropriate for the reaction. Hence, sufficient amounts of methanol are required to further drive the transesterification reaction properly [57].

Catalyst concentrations up to 0.5 wt.% show a positive effect on the transesterification reaction. As in situ transesterification is a two-phase reaction, at the start of the reaction, lipid quantity is low in the methanol phase, but as the reaction proceeds, the quantity of lipids in the methanol phase increases, leading to higher transesterification rates with increasing catalyst concentrations. Potassium hydroxide catalyst yields high biodiesel conversion rates because it is more susceptible to microwave irradiation as compared to other solid catalysts [58]. Low concentrations of the catalyst (less than 0.5 wt.%) do not drive the reaction efficiently due to the presence of various organic compounds extracted with lipids such as fatty alcohols, phytols, and sterols. Higher concentrations of catalyst (above 1 wt.%) may interact with other compounds in the reaction mixture producing unwanted byproducts. High basic catalyst concentrations have corrosive nature and the tendency to form soap [59] and thus did not show any positive effect on biodiesel production. The reaction time has significant effects on biodiesel production. Under microwave irradiation, nearby 3–6-min reaction time seems to be suitable for the complete in situ transesterification reaction. Microwaves penetrate the cell walls and cause thermal effects, increase the extractive properties of methanol, and force lipids into the methanol. Reaction times above 6 min overheat the reaction mixture, leading to greater losses of solvent and increasing byproduct formation [60].

Conventional transesterification processes use methanol with hexane or ether as solvents and require 24 h for extraction of algal lipids, 3 h for transesterification (shaking), and 16 h for settling or separation. The supercritical methanol process requires high temperature (255°C) and pressure (1200 psi for 25 min) as described in Patil et al. [61]. In addition, Sharmila et al. [62] showed that Chlorella pyrenoidosa provided 84% biodiesel using 4-ml methanol, 0.5 M H2SO4, 120°C reaction temperature, or 180-min reaction time. Firemichael et al. [63] obtained 80% biodiesel from Nannochloropsis using microwave transesterification with 2 wt.% catalyst concentration and 6-min reaction time. Sharmila et al. [64] extracted 8.1% lipids from 10 g of Cladophora vagabunda by using chloroform and methanol as solvents. Firemichael et al. [65] extracted 24% lipids from Cladophora glomerata by the soxhlet technique, while Yuvarani et al. [63] obtained 18% lipids by using chloroform and methanol as solvents. Haq et al. [64] obtained 75% biodiesel from Cladophora with 1:8 oil to methanol ratio at 50°C and 6 h stirring time. In the present study, 80% biodiesel was obtained from Cladophora sp. using our optimized conditions demonstrating that microwave irradiation reduces the total reaction time. Hence, microwave-assisted in situ transesterification is an efficient technique to obtain biodiesel from Oedogonium sp., Ulothrix sp., Cladophora sp., and Spirogyra sp. and then other conventional methods. Table 8 shows the biodiesel production from algae using microwave.

3.2 Analysis of variance (ANOVA)

To analyze the significance, reliability, and fitness of the model, lack of fit and an ANOVA test were applied. Results are shown in Supplementary information tables (S1–S4). All the models show a p value < 0.001 which indicates that all models are highly significant. The model F value in all the models was significant than in the controls. There is only a 0.01% chance in all models that an F value this large could occur due to noise. The lack of fit value was > 0.05 (insignificant) in all models, indicating that the model is reliable and is a good fit for experimental data.

3.3 Equations in terms of coded factors of quadratic models

The RSM suggested a quadratic model that relates biodiesel yield to the independent variables (Eq. 2–5 in Table 9). Biodiesel yield was the response, and A and B were the coded terms of the investigated parameters. A is catalyst concentration and B is heating time. Equations 2–5 can be used to make predictions about the response for each factor by comparing the co-coefficient of factors. The value and sign of each correlation phase coefficient show the increasing and decreasing effects of the response parameters. The upper levels and lower levels of the factors are coded as +1 and −1 correspondingly. These equations can accurately describe the communication between the interactions, factors, and responses.

Table 9 Equations in terms of coded factors of quadratic models

3.4 Validation of models

R2 is the correlation coefficient which indicates if the experimental data fit the model or not. R2 must be at least 0.80. In all the models, R2 was greater than 0.8 (Table 10), indicating good compatibility between the actual and calculated results within the wide range of the experiments. C.V% in all models were less than 10, indicating good fitness of all models to experimental data. In all models, adequate precision was more than 4 which indicates that the model noise ratio is located in the satisfactory range. Thus, all models are valid and can be used to navigate the design space.

Table 10 Fit statistics for response surface quadratic model

3.5 Diagnostic of models

The normal probability plot of the residuals illustrates the adequacy of the models. Figure 3 shows the plots of the residuals versus the predictive values of the response of Oedogonium sp., Ulothrix sp., Cladophora sp., and Spirogyra sp. The residuals should fall close to the diagonal reference line. The deviations from this straight line mean the residuals fleeing from normality. Figure 4 indicates that all models fitted well with the experimental results because residuals from the fitted model are close to the diagonal line and seem to be normally distributed. Studentized residuals and predicted response plots demonstrate the suitability of the model to represent the process. The random scatter of the residuals in Fig. 4 indicates that the suggested models for Oedogonium sp., Ulothrix sp., Cladophora sp., and Spirogyra sp. are an appropriate interpretation of the process and the application of the correct models for experimental data.

Fig. 3
figure 3

Normal probability plot and studentized residual plot of a Oedogonium sp., b Ulothrix sp., c Cladophora sp., and d Spirogyra sp.

Fig. 4
figure 4

Studentized residuals and predicted response plot: a Oedogonium sp. b Ulothrix sp. c Cladophora sp. d Spirogyra sp.

The actual values and predicted values in Fig. 5 are very close to zero error line (straight line) which shows the strong correlation between the process parameters and the biodiesel yield (%) to obtain a sustainable model for Oedogonium sp., Ulothrix sp., Cladophora sp., and Spirogyra sp. Outlier t plot demonstrates the deviations of actual values from the predicted values. As a definition of an outlier, a threshold value of 4.56 standard deviations was chosen. Most of the standard residuals should lie between the intervals of ± 4.56. Any observation outside the interval of ± 4.56 renders potential error in the model. Outlier t plot of (a) Oedogonium sp. (b) Ulothrix sp., (c) Cladophora sp., and (d) Spirogyra sp. in Fig. 6 demonstrates that no data point was outside the threshold value of ± 4.56, which means that all fitted models are consistent with the experimental data.

Fig. 5
figure 5

Actual and predicted plots of a Oedogonium sp., b Ulothrix sp., c Cladophora sp., and d Spirogyra sp.

Fig. 6
figure 6

Outlier t plot of a Oedogonium sp., b Ulothrix sp., c Cladophora sp., and d Spirogyra sp.

3.6 Interaction of operating parameters

The effect of the process variable (catalyst concentration and reaction time) on biodiesel yield is represented in Fig. 7. According to Fig. 7, initially, the biodiesel yield increases with increases in catalyst concentration, but after reaching a maximum value, it starts decreasing. This may be because high quantities do not have a great impact on ester formation or it may be the reaction becomes reversible. Contour and three-dimensional plots provide a visualization of the relationship between the response and interaction between operating variables to optimize conditions for microwave-assisted transesterification. Contour and three-dimensional plots demonstrate the best level of each parameter for maximum response. Figures 8 and 9 show two variables at their zero level at a time. The maximum predicted value relies on two variables at a time. Biodiesel yield is found to increase with increased catalyst concentrations, but after reaching a maximum value, it starts to decrease. When the reaction time increases, biodiesel contents also increase to the maximum level but then fall sharply. This trend is the same for all four species.

Fig. 7
figure 7

Effects of process parameters on biodiesel yield (%) of a Oedogonium sp., b Ulothrix sp., c Cladophora sp., and d Spirogyra sp.

Fig. 8
figure 8

Response surface plots of the combined effect of in situ transesterification parameters (catalyst concentration [wt.%] and heating time [min]) in biodiesel yield (%) of a Oedogonium sp., b Ulothrix sp., c Cladophora sp., and d Spirogyra sp.

Fig. 9
figure 9

Contour plots of a Oedogonium sp., b Ulothrix sp., c Cladophora sp., and d Spirogyra sp.

3.7 Comparison of conventional transesterification with microwave-assisted in situ transesterification

Microwave-assisted heated transesterification is an alternative technique in which the electromagnetic radiation of the microwave frequency range produces thermal energy in the sample solvent [66]. The thermal energy prompts the vibration of polar molecules with a rapid increase in temperature and eventually increases the efficiency of the transesterification process [67]. As shown in Fig. 10, microwave heating transesterification has shown to be more effective for adequate amounts of biodiesel yield compared to previous studies [68, 69] on biodiesel production with conventional transesterification process [70, 71].

Fig. 10
figure 10

Comparison of conventional transesterification with microwave-assisted in situ transesterification

4 Conclusions

Microwave-assisted in situ transesterification was carried out to determine optimal reaction parameters. Different experimental conditions were used using response surface methodology with a central composite design. The two independent variables were catalyst concentration (0.5–3.5 wt.%) and reaction time (3–9 min). The maximum biodiesel yield was achieved from Ulothrix sp. (88% DW, dry weight), then Cladophora sp. (80% DW), Oedogonium sp. (73% DW), and Spirogyra sp. (67% DW) under the optimized condition of 1 wt.% catalyst concentration and 3-min reaction time with constant methanol concentration (15 ml). Reaction parameters had a positive effect on biodiesel yield. Thus, microwave-assisted in situ transesterification may eliminate the need for high quantities of costly solvents, longer reaction times, high reaction temperatures, and high pressures. Algae have a great potential for producing commercial fuels. Therefore, our results demonstrate a more efficient and less costly approach for biodiesel production from algae. In order to produce commercial fuels from algae with limited commercial production and high operating and maintenance cost, further analysis of engine performance is required.