Introduction

Biodiesel is a renewable biofuel made from natural plant and animal fat waste that is environmentally safe, biodegradable, and non-toxic. In addition to reducing fossil fuel consumption, it reduces carbon dioxide emissions (Outili et al. 2020; Ranjan et al. 2016). Biodiesel can also be used in diesel engines as a substitute fuel or an additive to conventional diesel oil. Energy and fuel assume a vital part, particularly in transportation. Transportation sector’s typical energy use increases by 1.1% annually, accounting for 63% of the total increase in the absolute world fluid fuel usage from 2021 to 2040 (Abdala et al. 2020). Utilizing biodiesel is a realistic way to address environmental and energy issues. Food-grade and non-food-grade oils, such as waste cooking oil, animal fat, or vegetable fat, are transesterified to produce fatty acid esters similar to diesel fuel (Sharma et al. 2019).

Identifying a suitable feedstock is the primary step in biodiesel synthesis. Unique physical characteristics specific to feedstock affect biodiesel’s purity and quality. The feedstock should satisfy two requirements: (i) minimal production expense and (ii) the large-scale availability (Singh et al. 2020). Various feedstocks are used to produce biodiesel. The biodiesel produced from feedstocks is divided into four generations: coconut, soybean, sunflower, and other edible oils form the first generation of feedstock (Andreo-Martínez et al. 2020). Karanja, mahua, jatropha, used cooking oil (UCO), non-edible oils, etc., are the second-generation feedstock (Thakkar et al. 2019). The third feedstock generation includes animal fats and microalgae (Nigam and Singh 2011). Combining genetically modified feedstock with genomically prepared microorganisms and bacteria is the fourth-generation feedstock used in biodiesel production (Shokravi et al. 2019). Edible oils, used as a feedstock in the first generation of biodiesel, have implications on food security. Second-generation biodiesel eliminates the use of first-generation feedstock for biodiesel production because the feedstock used is second-generation (Bojaraj et al. 2021).

Karanja (Pongamia Pinnata) is a medium-sized tree that grows quickly. It is a significant, minor oil-seed tree that is not edible, with an oil content of 28 to 34%. The plant’s seeds are considered a possible biodiesel source, although they contain high poly-unsaturated fatty acids (Thakur et al. 2021; Naveen et al. 2021). In India, the National Oilseeds and Vegetable Oil Development Board estimates that Karanja has an oil production potential of 55,000 tons per year (Sharma and Sachan 2019); only 6% of this amount is currently being used. Traditionally, Karanja oil is used in soap production, leather tanning, illumination, and medicine (Kumar et al. 2021; Thiruvengadaravi et al. 2012). Karanja oil has higher free fatty acid content, making it a major challenge in biodiesel production. At the same time, it has a significant content of saturated and monounsaturated acids, which is an ideal component for fuel’s cold flow and stability properties (Mohod et al. 2017).

Mechanical stirring (MS) takes a longer time to produce biodiesel, and a higher percentage of the process parameters and activation energies are needed (Tan et al. 2017) (refer to Table 1). Process intensification techniques, like hydrodynamic cavitation (HC), ultrasonication (US), microwave irradiation (MW), and their combination (US/MW), are usually used for biodiesel production (Thakkar et al. 2022). Among these techniques, the ultrasonication method is the best as it involves the bubble’s production, growth, and implosive dissolution, produced due to pressure difference in the reaction mixture, at a micron. This improves the mixing of phases with better heat and mass transfer rates (Hussain and Janajreh 2018). Bubbles are produced due to continual growth and recompression in a fluid medium. During US irradiation, biodiesel is produced by bubble cavitation at the phase boundary between methanol and triglyceride (Pascoal et al. 2020; Ponnappan et al. 2021). Following the above cycle, a few bubbles remain stable, while others are subjected to brutal breakup after reaching a certain bubble size. The uneven breakup of cavitation bubbles that rise under a frequency range of 20–40 kHz transmits enormous energy. The mass exchange between the alcohol and oil phases rises close to the interfacial region in such emulsions (Mathew et al. 2021; Zore et al. 2021).

Table 1 Literature survey on biodiesel produced from Karanja oil using conventional, ultrasound, and microwave techniques

The alkali-catalyzed transesterification reactions provide a faster rate, approximately 4000 times faster than the rate caused by the same amount of acid catalyst. Transesterification reactions use alkaline catalysts such as NaOH, KOH, and sodium methoxide. Sodium ethoxide, potassium methoxide, sodium isopropoxide, sodium butoxide, and carbonates, among others, are alkaline catalysts (Muthukumaran et al. 2020). CH3ONa or CH3OK is better and more effective than NaOH and KOH biodiesel output. As a result, CH3ONa and CH3OK are ideal because they can distinguish between CH3O and Na+ and CH3O and K+, respectively. Furthermore, during the transesterification reaction, catalysts do not produce water. As a result, alkaline catalysts are widely used in producing biodiesel (Zeng et al. 2017).

Response surface methodology (RSM), artificial neural networks (ANNs), and extreme learning machines (ELMs) were used by researchers for process optimization, although RSM was most commonly used. An approach known as response surface methodology (RSM) can help plan experiments, analyze results, and evaluate the effects of the elements (Oza et al. 2021). This method includes the widely used optimization techniques of Box-Behnken design (BBD), central composite design (CCD), and full factorial design (FFD). The analysis of variance (ANOVA) is frequently used when using RSM methods to develop a mathematical model (Betiku et al. 2016). Ultrasound is an efficient and effective process intensification technology for biodiesel production; it requires less energy and processing time and gives higher yields.

Table 1 summarizes the literature survey on biodiesel produced from Karanja oil using conventional, ultrasound, and microwave techniques. Many researchers have used conventional techniques to produce biodiesel from Karanja oil. Only a few studies have shown the simultaneous application of statistical techniques to optimize the process variables for better biodiesel yield using ultrasound technique. The objective of the present research work is to optimize the process parameters of a two-step (esterification and transesterification) process for biodiesel production from a high free fatty acid (FFA) containing Karanja oil (Pongamia pinnata oil), using the ultrasound (US) process intensification (PI) technique. Limited literature is available for this process. Catalyst loading (w/w%), molar ratio of MeOH to oil, and reaction temperature were investigated as parameters for optimizing the reaction condition using the RSM techniques of Box-Behnken design (BBD) and central composite design (CCD). These optimization methods require fewer experimental runs than other methods to maximize the biodiesel yield. The study outcomes will help the process designer select the optimal energy and economic optimization method utilizing statistical indicators that provide insights.

Materials and methods

Raw materials

Karanja oil was obtained from a certified oil supplier in Ahmedabad, Gujarat. Potassium methoxide (99% purity grade), H2SO4 (A.R. grade, 99% pure), and methyl alcohol (A.R. grade, 99% pure) were purchased from M/s Fisher Scientific, India.

DOE

Table 2 shows the levels and ranges used for the experiments of the independent variables that determine the process. In order to reduce the FFA value of Karanja oil in the esterification process, a three-level, two-factor central composite design (CCD) was used (refer to Table 2 (a)).

Table 2 Details of the independent variables and the level ranges used for esterification and transesterification experiments

Karanja biodiesel yield was optimized in the transesterification process using a three-level, three-factor Box-Behnken design (BBD) (refer to Table 2 (b)). Esterification and transesterification reactions were conducted with thirteen and fifteen experiments, respectively. In the esterification reaction, the process parameters were catalyst loading (B, w/w%) and reaction time (C, min). However, MeOH:oil molar ratio of 6:1 was kept constant (Sharma et al. 2020). During the transesterification reaction, the process parameters of the molar ratio of MeOH and oil (A), catalyst loading (B, w/w%), and reaction time (C, min.) were taken as independent variables for optimization. Both reactions were carried out at a fixed process temperature of 60 °C for all the runs.

Characterization of raw oil and biodiesel

A gas chromatography-flame ionization detector (GC-FID) was used to characterize the fatty acid profile of Karanja oil and biodiesel. Gas chromatography with a flame ionization detector (GC-FID; Agilent Technologies, 5975C) was used to analyze all biodiesel and oil samples. An indigenously developed temperature program was used for the analysis of the samples. Initially, a column temperature of 40 °C was maintained for 2 min, then increased to 120 °C at 10 °C/min and further up to 260 °C at a rate of 5 °C/min, where each was held for 5 min. Pure nitrogen gas was used as carrier gas. The injection was performed with a split ratio 50:1, and the sample size was 1 μl. Karl Fischer titrator was used to determine the moisture content. The acid value and FFA content were determined using an auto titrator.

The various physicochemical characteristics of the biodiesel were measured using the following equipment. A bomb calorimeter was used to determine the calorific value (ASTM D4868 technique). According to ASTM D93, a closed cup Pensky-Martens was used to determine the flash point. Using a Brookfield viscometer (ASTM D445), kinematic viscosity (at 40 °C) was measured. Using cloud point and pour point equipment, the cloud point and pour point measurements were obtained (ASTM D2500 technique). Density was measured using a digital density meter (ASTM D792 technique).

Ultrasound-assisted esterification and transesterification process

Figure 1 shows the setup for the esterification and transesterification process. An ultrasound reactor with a water bath for a constant temperature was used. A programmed sonicator setup using model VCX 500 from M/s Sonic Vibracell, USA, was used in biodiesel production (Sharma et al. 2021). The sonicator has a fixed frequency of 20 kHz and can vary power up to 500 W (amplitude range of 20–100%); 40% of the maximum amplitude was used during the experiment run.

Fig. 1
figure 1

Schematic of ultrasound reactor process for esterification and transesterification of Karanja oil

A three-necked borosil reactor with a capacity of 250 ml was used as the reaction vessel. Both reactions (refer to Eqs. 1 and 2) were carried out following design of experiment (DOE) runs. Reaction scheme (1) was followed in the esterification process during the reaction scheme (2) for the transesterification process.

$$R-\mathrm{COOH }+{\mathrm{CH}}_{3}\mathrm{OH }\rightleftharpoons R-{\mathrm{COOCH}}_{3}+{\mathrm{H}}_{2}\mathrm{O}$$
(1)
$$\mathrm{Triglyceride}+3\mathrm{MeOH}\rightleftharpoons3\;\mathrm{Mixture}\;\mathrm{of}\;\mathrm{fatty}\;\mathrm{esters}+\mathrm{Glycerol}$$
(2)

After the esterification reaction, the top layer contained oil, and the bottom layer esters with a trace of unconverted oil and water. In contrast, after the transesterification reaction, the two layers separated. The bottom layer had thick brown-colored glycerol, and the top layer was a mixture of fatty acids with a trace of unreacted oil. The two layers were separated in both reactions using a separating funnel. In post-treatment, the product was washed three times with DI water to remove the catalyst and other impurities. The moisture content in the samples was completely removed before being used in esterification and transesterification, after which the sample was dried to eliminate water traces and to obtain the pure products of oil and biodiesel in both reactions. The percentage FFA conversion and biodiesel yield were determined using Eqs. (3) and (4) (Berwal and Dahiya 2014).

$$\mathrm{FFA\;Conversion\%}=\frac{\mathrm{Initial\;FFA\;Value}-\mathrm{Current\;FFA\;Value}}{\mathrm{Initial\;FFA\;Value}}\times 100$$
(3)
$$\mathrm{Yield}=\frac{\left(A2-A1\right)\times \left(C\times V\right)\times 100}{(A1\times M)}$$
(4)

where A2 is the total peak area of methyl esters; A1 is the peak area of N- heptane; C is the concentration in mg/ml of n-heptane; V is the volume of n-heptane in ml; M is the mass of the sample in mg.

RSM

RSM is used to model and analyze systems where the system’s response is affected by several factors, and RSM aims to optimize this response. RSM is applied in industries where several input factors affect performance measures, product quality, or process aspects (Elango et al. 2019). The method finds a balanced correlation between the input and the output variables and determines the optimal conditions for operating experimental runs. The parameters of the biodiesel manufacturing process are frequently optimized using the DOE and response surface methodology (RSM) (Thakkar et al. 2022). The DOE method obtains maximum intense data from limited comprehensive, organized investigations by simultaneously moving all the cycle factors. RSM is a different group of numerical and quantitative factors used to construct an experimental model that connects the result with important process variables (Sharma et al. 2019).

The experimental yield data were subjected to regression analysis to determine the biodiesel yield’s response to the quadratic polynomial equation’s (Eq. 5) Y function given by: (Nookaraju and Sohail 2020)

$$Y={\beta }_{0}+{\sum }_{i=1}^{n}{\beta }_{i}{x}_{i}+{\sum }_{i=1}^{n}{\beta }_{ii}{{x}_{i}}^{2}+{\sum }_{i=1}^{n}{\sum }_{j=1}^{i-1}{\beta }_{ij}{x}_{i}{x}_{j}+{\varepsilon }_{i}$$
(5)

where Y is the forecasted response value, βi and βij are regression coefficients obtained and can represent the linear, second-order, and interaction effect of x1, x2, and x3 …, while n is the number of factors, and ε is the random error.

CCD is a factorial or fractional design with middle points supplemented by a group of axial points that can help measure curvature. When factor values vary from the given range or obtain optimum values outside the boundary range, this type of design is used (Oza et al. 2021). The formula N = 2n + 2n + m, where n stands for the number of independent variables and m the number of center points, is used to calculate the number of experiments (N) for the development of CCD (Outili et al. 2020). As shown in Table 3, CCD has 13 experimental runs for three levels and two factors when these n and m values are 2 and 3, respectively.

Table 3 CCD design table for esterification of Karanja oil and FFA conversion obtained via experimental and model prediction

BBD generally has lesser design points than CCD. Therefore, the BBD method is less expensive to run with the same number of parameters. BBD can also seem practical if knowing the process’s safe working environment and giving parameter values are not at their high levels simultaneously. When needed, if any two-factor values are not to be high or low simultaneously, this type of design is used (Sharma et al. 2020). The formula N = 2n (n − 1) + m, where n is the number of independent variables and m is the number of center points, is used to calculate the number of experiments (N) for the development of BBD (Sundaramahalingam et al. 2021). Table 4 shows BBD has 15 experimental runs for three levels and two factors when these n and m values are 3 and 3, respectively.

Table 4 BBD design table for transesterification of Karanja oil along with experimental and model predicted biodiesel yield

For the esterification, experimental FFA conversion data from CCD (13 experimental runs) was taken as input using the Minitab® 20.3 software to assess the FFA conversion, and transesterification experimental yield data from BBD (15 experimental runs) was taken as input using design-expert® software (version 11, stat-Ease Inc., USA) to assess the optimal biodiesel yield. ANOVA was performed on the experiment yield values to determine the second-order polynomial model’s coefficient. Results of ANOVA show a connection between the variations brought on by experimental values and support the applicability of the predicted model. This is confirmed by examining the effects of tests like the “lack of fit” test, the Fischer test, the sum of square roots (S.S), the mean square (M.S), and the p-value (LOF). The quadratic polynomial model produced is also assessed for correctness as the model evolves using the coefficient of determination (R2). F-test determines the significance of the model coefficients (Gupta et al. 2021).

Results and discussion

Raw oil characterization and biodiesel composition

Karanja oil’s FFA value and moisture content were found to be 21.39 mg KOH/g and 10.2%, respectively. The fatty acid composition of Karanja oil was determined by gas chromatograph-Flam ionization detector (GC-FID). As per GC analysis, the main chemical constituents were monounsaturated oleic acid (C18:1), saturated palmitic acid (C16:0), and poly-unsaturated linoleic acid (C18:2). The complete fatty acid profile of the oil consists of 52.7% of oleic acid, 12.4% of palmitic acid, 7.2% of stearic acid, 17.8% of linoleic acid, 2.2% of linolenic acid, 1.7% of arachidic acid, 4.3% of behenic acid, and 1.7% of other fatty acids.

The identification of FAME in a sample was performed by comparing the authentic standard retention times. In Fig. 2, the oleic acid (18:1) peak was obtained at the standard retention time of 28.889. Similarly, palmitic acid (16:0), steric acid (18:0), linolenic acid (18:2), linolenic acid (18:3), arachidic acid (20:0), and behenic acid (22:0) peaks were observed at the standard time of 24.317, 28.514, 29.770, 31.000, 32.462, and 32.757, respectively. Yield for biodiesel was obtained by using Eq. 4.

Fig. 2
figure 2

GC-FID chromatogram of the biodiesel produced from Karanja oil

RSM statistical analysis

Design expert program (edition 11; Stat-Ease, Inc., USA) optimized the statistical process parameters to maximize FFA conversion and biodiesel yield, following the procedures described in “RSM.” Analyzing FFA conversion and biodiesel yield by regression and analysis of variance (ANOVA) were conducted using the most appropriate linear or quadratic models. A second-order quadratic regression model was found to be the best fit for both the RSM methods.

Esterification reaction analysis

Table 3 shows the experiment runs with experimental FFA conversion and predicted FFA conversion with the help of the design expert software (edition 11; Stat-Ease, Inc., USA). The target of this process is to optimize the FFA conversion.

$${Y}_{\mathrm{CCD}}=66.26-0.1553\mathrm{ B}+7.28\mathrm{ C}-0.00181\mathrm{ B}\times \mathrm{B}-9.98\mathrm{ C}\times \mathrm{C}+0.5467\mathrm{B}\times \mathrm{C}$$
(6)

The maximum FFA conversion% is 80.52%, and the predicted FFA conversion% is also 80.97%. ANOVA and regression findings of the esterification process determine the best linear or quadratic model for the best FFA conversion. According to the ANOVA table (refer to Table 5), the CCD model has an F-value of 87.21 and a p-value of less than 0.05, indicating it to be a significant model. The coefficient of determination (R2) with a greater value indicates that the produced model best fits the expected model data. R2 for the CCD model is 98.42%. It also calculated the term-adjusted coefficient of determination (Adj. R2) (Sharma et al. 2021). The value is 97.29%, which shows that the model is applicable with the best fitting (Sundaramahalingam et al. 2021). The adequate precision is found to be 30.523, which is greater than 4. Also, the above ANOVA table (Table 5) shows that the model terms A, B, B × B, and A × B are significant.

Table 5 ANOVA table for the CCD of the esterification process of Karanja oil

Effect of different parameters

Figure 3 shows the CCD model’s experimental and predicted FFA yield data. A 45° straight line and a regular distribution of the FFA yield data are shown in Fig. 3a. Given that the predicted yield values were consistently near to the experimental response, it was determined that the produced regression model provided the best fit between the process components and FFA yield (Thakkar et al. 2021). The distribution of all the data points along the reference line suggests that the response accurately represents. In Fig. 3b graph, all the data points are scattered randomly along the reference line. This indicates that the regression model shows the biodiesel production method to be significant.

Fig. 3
figure 3

a Comparison between the predicted vs. experimental yield within ± 5% deviation limit. b Normal percentage probability versus residuals plot

Figure 4a shows the Pareto chart, the sequence of the model terms of CCD. The relationship between the model terms and the response of the biodiesel production and the sequence in which each model term impacts biodiesel yield are determined using the Pareto chart. It is observed that an increase in the reaction time decreases the FFA conversion in the esterification process (Thakkar et al. 2022). Figure 4b shows the contour plot for the CCD model. It shows the plot of FFA conversion affected by time and catalyst loading. The color code shows the range of FFA conversion values; the dark color shows the higher conversion value, and the lighter color shows the lesser conversion range. It is observed that an increase in catalyst loading reduces the reaction time for FFA conversion (Aziz and Aziz 2018).

Fig. 4
figure 4

a Pareto charts for the standardization effects of the process variables of CCD. b Contour plot of FFA yield vs. catalyst loading and time

Optimal condition

The optimal response condition for the control parameters was determined using the RSM mathematical optimization techniques while accounting for the model’s common error (StdErr). The operating process condition was optimized using second-order polynomial equations (Eq. 6), using mathematical RSM optimization of CCD techniques. Based on this analysis, the Minitab software gives the optimized condition for the esterification reaction using the ultrasound P.I. technique, a reaction time of 32.82 min, and a catalyst loading of 1.14 wt%. This gives an FFA conversion of 82.94%, with a desirable value of 0.953. The run is performed using this condition. Esterification reaction performed with a similar optimal condition (i.e., molar ratio: 6:1, (specify the catalyst) catalyst loading: 1.14 wt%; reaction time: 32.8 min) using the mechanical stirrer (MS) showed an FFA conversion of 46.10%. Thiruvengadaravi et al. have studied the two-step biodiesel production from Karanja oil using mechanical stirring (Thiruvengadaravi et al. 2012). Thriruvengadaravi et al. have reported a reduction in FFA conversion of up to 70% using a mechanical stirrer (MS), a molar ratio of 9:1, and a reaction time of 0.5 h. While in the current study that uses the ultrasound system, an 83% reduction in the FFA conversion was achieved with a reaction time of 32.82 min and a molar ratio of 6:1. The results show the superiority of the US process in overcoming the reaction barrier and enhancing the reaction rate.

Transesterification analysis

Table 4 shows the experiments with experimental biodiesel yield and the predicted biodiesel yield with the help of the design expert software (edition 11; Stat-Ease, Inc., USA). The target of this process is to optimize the biodiesel yield.

The maximum experimental yield is 98.24%, and the predicted yield is also 98.24%. The transesterification process’s regression and analysis of variance (ANOVA) give the best biodiesel yield by selecting the best possible linear or quadratic model. The BBD model’s F-value was observed at 116.07, and the corresponding p-value was less than 0.05, which denotes that the results are significant, as shown by the ANOVA table (Table 6).

Table 6 ANOVA table for BBD of the transesterification process

The regression equation for BBD:

$${\mathrm{Yield}}_{\mathrm{BBD}}= -199.6+69.64A-10.51B+4.298C-19.21\mathrm{B}\times B-0.05376C\times C-4.961A\times A-0.6780B\times C+8.180B\times A-0.1862C\times A$$
(7)

The coefficient of determination (R2) with a greater value indicates that the produced model best fits the expected model data. For the BBD model, R2 is 99.52%. Also, a term-adjusted determining coefficient (Adj. R2) was obtained. The value of 98.67% indicates that the model is important with the best fitting. The adequate precision is 30.67, which is greater than 4. Also, according to the results, the above ANOVA table (Table 6) shows that the model terms A × B, A × C, B × C, A2, B2, and C2 show significance.

Effects of different parameters

BBD model’s experimental and predicated biodiesel yield data are distributed in Fig. 5a. Figure 5a shows a normal distribution of the biodiesel yield data along a 45° straight line. Given that the predicted yield values were consistently near to the actual response, it was determined that the produced regression model had the best fit between the process components and the FFA yield (Sharma et al. 2020). All the data points in the model have distributions near the reference line, which indicate a strong match with the response. The normal% probability versus externally studentized residual plot is shown in Fig. 5b. This figure’s data points are dispersed randomly along the reference line. It normally means that the regression model shows the biodiesel production technique to be satisfactory.

Fig. 5
figure 5

a Comparison between the predicted versus the experimental Karanja-biodiesel yields within ± 5% deviation limit. b Normal percentage probability versus residuals plot

Figure 6a shows the perturbation plot for the process variables of BBD. It helps to evaluate the effects of the huge number of components at a particular point in the arrangement space. The factor with a greater incline slope than the previous indicates that it substantially impacts biodiesel yield. The fact that the component has a steeper slope than the other implies a considerable impact on biodiesel yield. The plot’s slope is high, a highly affected process parameter (Sharma et al. 2020). In that plot, the molar ratio (A) is highly affected by the process for high biodiesel yield. The second highly affected parameter is catalyst loading (C), followed by reaction time (B) which is less effective. Between the lower level (− 1) and the intermediate level (0), the process parameter A has the most perturbation influence (with a steep slope), followed by process variables C and B. US-assisted transesterification process using CH3OK catalyst condition helps to reduce mass transfer barrier and expedite the chemical reaction between the non-miscible reactants. Response graphs of externally studentized residuals against the predicted yield for the BBD model are shown in Fig. 6b. All data points are dispersed randomly along the reference line in this graphic picture. It normally means that the regression model demonstrates that the biodiesel production technique is accurate.

Fig. 6
figure 6

a Perturbation plots showing the process parameters affecting the biodiesel yield % with actual factors at the middle level; b response plot of externally studentized residuals versus predicted biodiesel yield

Figure 7 shows the plots of the 3D surface, indicating the effect of the two factors on biodiesel yield. The yield profile’s elliptical shape depicts the interaction between the process parameters. The remaining profiles all degrade uniformly in the direction of the outside. The red color portion shows a higher yield (≥ 95%) in the range of the parameters, the blue color shows a lower yield (≤ 80%) in that range of parameters, and the middle area in yellow shows a moderate yield (80 to 95%) in the range of that parameters. In plot 7 (a), the reaction time is a constant condition (20 min), giving a higher yield above 90% in the 6.2:1 to 8.4 molar ratio range and 0.8 to 1.2 wt% of catalyst loading. The remaining zone, exclusive of these ranges, shows that the yield profiles decrease gradually in magnitude towards the outward direction. A high amount of catalyst loading is not beneficial as it produces soap in the reaction and creates difficulty in separation (Krishnamurthy et al. 2020). In plot 7 (b), with a molar ratio in the range of 6.6:1 to 7.8:1 and a reaction time of 15 to 25 min, there is a higher biodiesel yield above 85% at the constant condition of catalyst loading (1 wt%). The yield decreases above this range, with an increase in molar ratio and reaction time. A higher molar proportion is not beneficial as glycerol dissolves with biodiesel and creates difficulty in separation. A molar ratio below 6.6:1 and a reaction time of 15 min lead to an incomplete transesterification reaction (Kodgire et al. 2022). In plot 7 (c), the molar ratio is a constant condition (7.5:1) at which a higher yield above 90%, a reaction time of 20 to 30 min, and a catalyst loading of 0.6 to 1.3 wt% is obtained. The yield decreases above this range, with an increase in reaction time and catalyst loading. A high amount of catalyst loading is not beneficial as it produces soap in the reaction and creates difficulty in separation.

Fig. 7
figure 7

Three-dimensional response surface graphs showing the interaction effect on biodiesel yield % as a function of process variables: a molar ratio and catalyst loading (reaction time held constant); b molar ratio and reaction time ( catalyst loading held constant); c reaction time and catalyst loading (molar ration held constant)

Optimal condition

From this analysis, the design expert software gives the optimized condition for transesterification reaction on ultrasound P.I. technique, with a molar ratio of 7.61:1 (methanol: oil), catalyst loading of 0.984 wt%, and a reaction time of 20.6 min. Using these conditions and applying the desirability condition, a maximum yield of 98.16% is obtained, as shown in Fig. 8. Using similar optimal conditions of molar ratio: 7.61:1, catalyst loading: 0.984 wt%; reaction time; 20.6 min, esterification reaction was carried out using a mechanical stirrer (MS) which gave a biodiesel yield of 10%. The mechanical stirrer (MS) obtained a maximum biodiesel yield of 75% with a molar ratio of 7.61:1, catalyst loading of 0.984 wt%, and a reaction time of 135 min. Joshi et al. have carried out a similar study on the transesterification of Karanja oil using a KOH (homogeneous) catalyst and an ultrasound system where they obtained the biodiesel yield of 70% at 90 min of reaction time and 1.5 wt% of KOH catalyst loading (Joshi et al. 2018). While in this study, 98.24% of biodiesel yield was obtained using a catalyst loading and reaction time of 1 wt% and 20 min, respectively. The results indicate that the US process is superior to the MS process, saving time and raw materials.

Fig. 8
figure 8

Optimized condition of BBD for the transesterification reaction of Karanja oil

Physicochemical properties of the Karanja-biodiesel

Below, Table 7 describes the biodiesel properties measured by comparing ASTM standards. The acid value is obtained at 0.4 mg KOH/gm. The calorific value of 39 ± 0.209 MJ/kg closely matches the standard biodiesel value. Kinematic viscosity and density are measured at 3.57 ± 0.05 mm2/s at 40 °C and 880 ± 1.5 kg/m3 at 15 °C, respectively. These numbers fall within the biodiesel’s ASTM standard range. The flash point for biodiesel is 152 ± 2 °C, which is also within the standard range of 100–170 °C. The cloud and pour point values are − 3 ± 1 and − 10.5 ± 2 °C. This shows that the biodiesel produced from Karanja oil can also be used in cold climates. So, all the properties of the biodiesel from Karanja oil are in the range of ASTM standards.

Table 7 Biodiesel properties with ASTM standard comparison

Conclusion

This study shows the optimization of the process parameters (reaction time, molar ratio, and catalyst loading) of a two-step (esterification and transesterification) process for biodiesel production from Karanja oil using an ultrasound (US) technique. Optimizing the two-step ultrasound process has significantly reduced the molar ratio of methanol and oil and reaction time with improved biodiesel yield in the esterification and transesterification processes. The most compelling parameter of the biodiesel yield was the molar ratio established by the BBD method. The optimum conditions observed in the esterification process are 32.8 min of reaction time and 1.14 wt% of catalyst loading with a 75% FFA reduction. The optimal conditions for the transesterification process were a 7.61:1 of molar ratio, 0.98 wt% of catalyst loading, and 20.6 min of reaction time resulting in a 98.2% yield. In both the esterification and transesterification reactions, the PI-based ultrasound technique gave the best FFA and biodiesel yield conversion compared to the mechanical stirrer (MS) technique. The biodiesel’s physicochemical characteristics satisfy ASTM standards and may be blended with petro-diesel.