Introduction

Increasing world population affecting the energy demand and requires more energy every other year. This energy demand pushes the human to find different energy recourses such as solar energy or conversion of bio-waste to a biofuel. The researchers have been trying to develop an efficient way to produce biofuels as alternative fuel (Srirangsan et al. 2009). An alternate fuel needs several criteria such as sustainability, biodegradability, non-toxicity, low sulfur compounds and low carbon monoxide production and aromatic-free emission profile. The biodiesel or fatty acid methyl esters (FAME) provide the most of these criteria and it is environmentally beneficial in terms of recycling of the fat and oil wastes (Karmee and Chadha 2005).

Biodiesel is simply a liquid fuel derived from vegetable oils and fats by the transesterification reaction of triglycerides with alcohols such as methanol and ethanol in the presence of a homogenous base catalyst like NaOH or KOH to yield fatty acid alkyl esters and glycerol (Jaruwat et al. 2010). The long and branched chain triglyceride molecules are transformed to monoesters and glycerin (Ma and Hanna 1999). The production of biodiesel also requires the methyl esters produced by transesterification. A fuel can be classified as biodiesel if the standard specifications are fulfilled. Thus, a purification process has to be done before it is used as biodiesel. In purification step, there are two basic methods as wet and dry washing. Wet washing is more traditional and widely used for removing excess contaminants and leftover production chemicals from biodiesel. The impurities are generally free glycerol, soap, methanol, free fatty acids (FFA), catalyst, water, and glycerides, which have an impact on the performance and durability of the diesel engine (Ngamlerdpokin et al. 2011). Type of impurity might cause different problems in the engine. If the impurities are glycerides and soap, they cause the formation of high carbon residues, which can clog the injector of engines. If the impurity is glycerol, it increases the aldehyde and acrolein emissions (Berrios and Skelton 2008). The washing process with pure hot water at 50 °C results in approximately 99.0% purity of biodiesel but, the process will yield a lot of wastewater (Ngamlerdpokin et al. 2011). Although wet washing process fulfills the requirements, because of high biodiesel waste, it brings the extra cost for biodiesel production.

Biodiesel wastewater is harmful to the environment, and it has to be cleaned before discharging into the sewage systems. For each liter biodiesel production, approximately 0.2–3 L of biodiesel wastewater will be produced, and that needs to be cleaned carefully. Therefore, biodiesel production also requires a robust method to purify the water from contaminants (Berrios and Skelton 2008).

In literature, it is possible to find different treatment techniques for biodiesel wastewater including physical, chemical, physicochemical, electrochemical, microbiological process (Suehara et al. 2005; Kato et al. 2005; Chavalparit and Ongwandee 2009; Pitakpoolsil and Hunsom 2014) and anaerobic digestion (Nishiro and Nakashimada 2007; Siles et al. 2010) and integrated treatment processes. All these methods are very efficient and economical for the biodiesel wastewater cleaning, but they produce a large amount of low-density sludge (Suehara et al. 2005). The biodiesel wastewaters can also be used as a source of carbon for the oil-degrading yeast to produce hydrogen and ethanol (Nishiro and Nakashimada 2007) or as a carbon source for bioreactors treating acid mine drainage (Zamzow et al. 2007).

Electrocoagulation process is one of the successfully applied processes to treat a variety of industrial wastewater. Electrocoagulation process produces a floc of metallic hydroxides within the effluent to be cleaned. After the formation of coagulants in the aqueous phase, soluble or colloidal pollutants are adsorbed on coagulants and later removed by sedimentation (Veljković et al. 2014). In the electrocoagulation process, there are several factors including pH, electric current density and the application time that affect the process efficiency. The optimization of those parameters will provide better performance for cleaning the biodiesel wastewaters.

Ngamlerdpokin and friends have used six iron electrodes connected in monopolar configuration in EC unit. The optimum conditions were identified as pH 7.4, current density = 12.42 mA/cm2 and electrolysis time = 4 h for the 99.6% COD removal. Chavalparit and Ongwandee have used an aluminum anode and a graphite cathode in the monopolar batch reactor. They have determined the optimum parameters as pH 6, applied voltage = 20 V and electrolysis time = 25 min. The calculated COD removal using those parameters was around 55%. Despite a high COD removal with the monopolar reactor, the current density was high and electrolysis time was too long. COD removal efficiency was reduced using aluminum and graphite electrodes.

This work focuses on the enhancement of electrochemical process for cleaning biodiesel wastewater before discharging them to the receiving environment. The studies have been done at laboratory scale at ambient temperatures by a combination of protonation based chemical recovery of biodiesel followed by electrocoagulation treatment. In electrocoagulation process, iron and aluminum electrodes were used to optimize three quantitative variables including pH, conductivity, electric current and electrolysis time.

Materials and methods

Characteristics of the biodiesel wastewater

The wastewater was obtained from Faculty of Environmental Engineering Laboratory at Sakarya University (Turkey). The raw biodiesel wastewater contains a high concentration of COD (305,500–403,540 mg/L), TOC (54,000-110,000 mg/L), Grease and Oil (217,294–25,252 mg/L) and BOD (210,400 mg/L). The ratio of BOD5/COD averaged 0.69–0.52. The composition of the wastewater is shown in Table 1.

Table 1 Characteristics of biodiesel wastewater

Experimental device

The experimental setup is shown in Fig. 1. The EC unit consisted of an electrochemical reactor, a D.C. power supply and iron or aluminum electrodes. The total effective electrode area was 288 cm2, and the spacing between the electrodes was 7.5 mm. The spacing between the electrodes was set to 0.75 mm to adjust the minimum current density. In the electrochemical reactor, four electrodes with dimensions of 6 × 12 × 0.15 cm were connected in a bipolar fashion. The monopolar electrodes requires long run times and does not provide high removal efficiencies, therefore, the bipolar electrode configuration was preferred in this study. A D.C. power source was used to supply the 30.5 V and 5 A power. A magnetic stirrer was used to maintain the biodiesel wastewater mixing during the electrocoagulation process to accelerate the formation of flocs. Before the each run, the two-step cleaning procedure was applied to the electrodes. In the first step, the electrodes were washed with detergent to remove surface grease and other organic sticky impurities and in the second step; electrodes were dipped into the freshly prepared 35% HCl solution for 3 min. COD and TOC analysis were performed using the SM 5220 D and 5310 B methods, respectively, given by American Public Health Association (APHA) (Standard methods for examination of water and wastewater) (American Public Health Association (APHA) 2017).

Fig. 1
figure 1

Schematic diagram of experimental setup (1: electrocoagulation cell, 2: dc power supply, 3; bipolar electrodes, 4: magnetic stirrer)

After electrocoagulation, residual iron ions have disruptive effect on COD value. Therefore, at the end of the each run, the solution was centrifuged and analyzed for TOC and COD. The raw biodiesel wastewater does not contain iron ions so COD and TOC measured without centrifugation. The TOC content of the biodiesel wastewater was measured with a HACH Model TOC/TN instrument (HACH Company, USA). The solution pH was adjusted using NaOH and H2SO4. The conductivity was provided by addition of NaCl in each solution.

Reactions at the EC electrodes

Electrocoagulation process requires metal electrodes mostly iron or aluminum electrodes. During the electrocoagulation, \({\text{Fe}}^{ 3+ }_{{({\text{aq}})}}\) or \({\text{Al}}^{ 3+ }_{{({\text{aq}})}}\) ions produced and those ions immediately undergo further reactions to produce the corresponding hydroxide and/or polyhyrodroxides. Hydroxides may be produced by the dissolution of mild steel and OH ions produced at the cathode. By mixing the solution, matrices (dyes and cations) can be removed by adsorption and (Şengil et al. 2009; Mollah et al. 2001). The mechanism of the production of metal hydroxides in iron anodes is given below;

$${\rm{Anode:}}{\text{ Fe}}_{{({\text{k}})}} + {\text{ 6H}}_{ 2} {\text{O}}_{{({\text{s}})}} \to {\text{ Fe}}\left( {{\text{H}}_{ 2} {\text{O}}} \right)_{ 4} \left( {\text{OH}} \right)_{{ 2({\text{aq}})}} + {\text{ 2H}}^{ + }_{{({\text{aq}})}} + {\text{ 2e}}^{ - } ,$$
(1)
$${\text{Fe}}\left( {{\text{H}}_{ 2} {\text{O}}} \right)_{ 4} \left( {\text{OH}} \right)_{{ 2({\text{aq}})}} \to {\text{ Fe}}\left( {{\text{H}}_{ 2} {\text{O}}} \right)_{ 4} \left( {\text{OH}} \right)_{{ 2({\text{k}})}} ,$$
(2)
$${\rm{Cathode:}}{\text{ 2H}}^{ + }_{{({\text{aq}})}} + {\text{ 2e}}^{ - } \to {\text{H}}_{{ 2({\text{g}})}} ,$$
(3)
$${\text{Total: Fe}}_{{({\text{k}})}} + {\text{ 6H}}_{ 2} {\text{O}}_{{({\text{s}})}} \to {\text{Fe}}\left( {{\text{H}}_{ 2} {\text{O}}} \right)_{ 4} \left( {\text{OH}} \right)_{{ 2({\text{k}})}} + {\text{H}}_{{ 2({\text{g}})}} .$$
(4)

Results and discussion

Effect of the conductivity

In an electrochemical process, conductivity plays a major role in the production of metal hydroxide and the conductivity of the solution was increased by the addition of NaCl. Increase in the conductivity changes the current efficiency, cell voltage and consumption of energy in electrolytic cells.

Figure 2 shows the effect of NaCl concentration on the COD and TOC removal efficiency by using both iron and aluminum electrodes. As expected, current density and conductivity increased with increasing salt concentration. In general, when the solution ionic strength is increased at constant cell voltage, the current density increases. On the other hand, the cell voltage will decrease by an increase in wastewater conductivity at a constant current density. Thus, as the ionic strength of the solution increases, a specific current density needs to be provided by applying a specific voltage to the system for an efficient electrocoagulation process (Mollah et al. 2001; Mollah et al. 2004).

Fig. 2
figure 2

The effect of NaCl concentration on the COD and TOC removal by Fe and Al electrode (i = 1.6129 mA/cm2; t = 1 min; Co,COD = 399,800 mg/L; Co,TOC = 98,120 mg/L; T = 298 K; agitation speed = 120 rpm; pH 4)

Figure 2 shows that a significant improvement was observed for the removal of COD and TOC when the supporting electrolyte concentration greater than 1 g/L. In the case of the gradual increase of supporting electrolyte from 1.0 to 10.0 g/L, the COD and TOC removal efficiency of the Fe electrode increased from 91.40 to 95.47% and 91.79–94.82%, respectively. The COD and TOC removal efficiency for the Al electrode increased slightly from 89.69 to 94.60% and 89.56 to 93.95%, respectively. The obtained results show that high removal efficiencies at low cell voltages could be obtained by adjusting the NaCl concentration to 1 g/L. Thus, throughout this study, the same NaCl concentration (1 g/L) was used.

Effect of initial pH

In an electrocoagulation process, pH of the solution plays an important role. Oxidation kinetics of Fe2+ to Fe3+ is strongly affected by the pH and the surface charge of coagulating particles (Song et al. 2007).

Figures 3a and b show the effect of the initial pH on the removal of COD and TOC for Fe and Al electrodes. For both electrodes, the similar trends were observed for the removal of COD and TOC. The best results were obtained at pH 6 and a current density of 0.3226 mA/cm2 after 1 min electrolysis time. The removal efficiency of COD and TOC with the Fe electrode was 91.74 and 91.79%, respectively. On the other hand, the removal efficiency of COD and TOC was obtained as 90.94 and 91.98%, respectively, with the Al electrode.

Fig. 3
figure 3

The effect of pH on the COD and TOC removal efficiency by Fe (a) and Al (b) electrode (i = 0.3226 mA/cm2; Co,COD = 399,800 mg/L; Co,TOC = 98,120 mg/L; t = 1 min; NaCl = 1 g/L; T = 298 K; agitation speed = 120 rpm)

Although the pH of the solution was adjusted at the beginning of electrolysis, during the electrolysis, the pH of the solution was gradually changed. The same situation was observed for Fe electrode. As shown in Fig. 3a, b, while the initial pH was 6, the ending pH of the solution was 6.89. In the comparison of pH values for Fe and Al electrodes, the pH change is not that high for Al electrode than Fe electrode. While initial pH was 6, the ending pH was measured as 7.11. For Fe electrode, the maximum amount of Fe(H2O)4(OH)2(s) and Fe2O3(H2O)6(s) flocculation was observed at pH 7 and also maximum COD removal was attained. When Al electrode was used, the electrocoagulation process produced the different type species, depending on the solution pH. The major products of aluminum hydrolysis are Al(OH) +2 and Al(OH)2+ between pH 5 and 6. In a wider range of pH, from 5.2 to 8.8, the dominant species is Al(OH)3. At high pH values, Al(OH)3 dissolves in water and forms the hydroxo-complexes as [Al(OH) n ]↼n−3).

Effect of the current density

Coagulant and bubble production rates change the flocks’ growth (Mollah et al. 2001), and they are affected by the current density of the system. Figure 4 shows the effect of the current density on the removal efficiency of COD and TOC for Fe and Al electrodes at 1 min operating time and at pH 6. When the applied current density of the Fe and Al electrode increased from 0.3226 to 1.9355 mA/cm2, the removal efficiency of COD and TOC increased slightly from 91.74 to 92.55%, 91.79–92.25% for Fe electrode and from 90.94 to 92.22%, 91.98–92.20% for Al electrode, respectively. Figure 4 shows that the removal efficiency of Fe electrode is higher than Al electrode.

Fig. 4
figure 4

The effect of current density on the COD and TOC removal by Fe and Al electrode (pH 6; Co,COD = 399,800 mg/L; Co,TOC = 98,120 mg/L; t = 1 min; NaCl = 1 g/L; T = 298 K; agitation speed = 120 rpm)

Effect of electrolysis time

Figure 5 shows the relationship between the removal efficiency of COD and TOC and the electrolysis time for both electrodes. Time is an important parameter for the formation of sufficient amount of ions from the electrodes. The higher metal ion formation will provide the higher hydroxyl ion formation and this will bring higher COD and TOC removal. As shown in Fig. 5, the electrolysis time does not have a linear correlation with the removal efficiency. The major part of the pollutants was removed during the first 0.5 min of electrolysis, and further electro-generation of coagulant flocs did not have a positive effect on the removal efficiency. As shown in Fig. 5, the best electrolysis time for the removal of COD and TOC from biodiesel wastewater was 1 min. Figure 5 shows the effects of electrolysis time on the removal efficiency of COD and TOC for Fe and Al electrodes at the current density of 0.3226 mA/cm2 and pH of 6. The electrocoagulation time is another important parameter for COD and TOC removal. When the operation time was increased from 0.5 to 5 min, the removal efficiency of COD and TOC increased from 60.33 to 92.73%, 60.40 to 92.94%, respectively. In case of Al electrode, the removal efficiency of COD and TOC increased from 59.72 to 91.32% and from 59.80 to 92.24%, respectively. As shown in Fig. 5, the removal efficiency of the Fe electrode was greater than that of the Al electrode.

Fig. 5
figure 5

The effect of electrolysis time on the COD and TOC removal by Fe and Al electrode removal efficiency (i = 0.3226 mA/cm2; Co,COD = 399,800 mg/L; Co,TOC = 98,120 mg/L; NaCl = 1 g/L; pH 6; T = 298 K; agitation speed = 120 rpm)

Energy consumption

Operation cost is the main concern in electrocoagulation process and the maximum amount of removal at the lowest amount of cost should be achieved. The amount of electrical energy consumed (kWh) (kg COD)−1 and (kWh) (kg TOC)−1 during the removal of 1 kg of COD and TOC from biodiesel wastewater by EC at a constant applied current was calculated as a function of time according to the following equation:

$${\text{EEC}} = \frac{{\int {UI\;{\text{d}}t} }}{{(C_{\text{o,CODorTOC}} - C_{\text{t,CODorTOC}} ).V.3.6}} = \frac{{I\int {U\;{\text{d}}t} }}{{(C_{\text{o,CODorTOC}} - C_{\text{t,CODorTOC}} )\;V.3.6}}$$

where U, is the applied voltage (V), I is the current (A), t is the electrolysis time (min), Co,COD or TOC (mg/L) is the initial concentrations of COD and TOC, Ct,COD or TOC (mg/L) is the COD and TOC concentrations at time t and V (L) is the volume of treated wastewater.

Figure 6a shows the energy consumption during the EC process as a function of the current density. The minimum energy consumptions of the Fe and Al electrodes for COD removal were 0.000066 and 0.000068 kWh kg/COD and observed at a current density of 0.3226 mA/cm2, respectively. Figure 6b shows the minimum energy consumption for Fe and Al electrodes for TOC removal. The TOC removal of Fe and Al electrodes were 0.000266 and 0.000274 kWh kg/TOC, respectively, at the current density of 0.3226 mA/cm2. For both electrodes, the energy consumption was similar at specified current density; however, the COD and TOC removal efficiency of the Al electrode was slightly higher than that of the Fe electrode. The effect of electrolysis time on the COD removal efficiency of biodiesel wastewater was shown in Fig. 6c. When the electrolysis time increased from 0.5 min to 5 min, the energy consumption of the Fe and Al electrode increased significantly from 0.0000048 to 0.000306 kWh kg/COD for Fe electrode and from 0.0000049 to 0.000335 kWh kg/COD for Al electrode, respectively. The effect of electrolysis time on the TOC removal efficiency of biodiesel wastewater was shown in Fig. 6d. As the electrolysis time increased from 0.5 min to 5 min, the energy consumption of the Fe and Al electrode increased significantly from 0.0000196 to 0.001243 kWh kg/TOC for Fe electrode and from 0.00002 to 0.001363 kWh kg/TOC for Al electrode, respectively. The COD and TOC removal efficiencies of the Fe and Al electrode increased from 60.33 to 92.73%, 59.72–91.32% and 60.40–92.94%, 59.80–92.24%, respectively. Thus, the best correlation between the COD removal rate and the amount of energy consumed during the process was observed at 1 min electrolysis time.

Fig. 6
figure 6

Effect of current density (a, b) and electrolysis time (c, d) on the electric energy consumption and COD ad TOC removal efficiency (i = 0.3226 mA/cm2; Co,COD = 399,800 mg; Co,TOC = 98,120 mg/L; t = 1 min; NaCl = 1 g/L; T = 298 K; agitation speed = 120 rpm; blood rate = 1%)

Cost analysis

The cost of EC process is affected by the consumption of electrical energy, electrode materials, and chemical reagents. The operationla cost of EC process of treated effluent was estimated in US$/m3 by considering several parameters including electrical energy, electrode consumption, amount of NaCl and HCl. The present calculated price of electrical energy for 0.1155 kWh/m3 for iron electrode and 0.1225 kWh/m3 for aluminum electrode is US$ 0.12 k/Wh. The electrode consumptions are 0.11 g/L for Fe electrode and 0.11 g/L for AL electrode and the commercial prices of them are US$ 0.76 kg−1 and US$ 4.45 kg−1, respectively. The NaCl and HCl consummations are 1 g/L and 1 L/m3 and their costs are US$ 0.002 kg−1 and US$ 0.2 L−1, respectively.

The operation cost of the EC reactor in US$ for per m3 of treated effluent was also calculated. The cost of Fe and Al electrodes are US$ 0.2843 and US$ 0.7062, respectively. As seen from the results, EC process showed excellent performance for the decontamination of biodiesel wastewaters by providing superior removal efficiency and cost effectiveness.

The operating cost of the EC reactor (OCEC) was also calculated in US$ for per m3 effluent. As a result, for the Fe electrode, OCECs of Fe and Al electrodes are 0.2843 US$ and 0.7062 US$, respectively, for per m3 of raw wastewater. In addition to having a superior efficiency in decontamination of biodiesel wastewater, the EC process showed an excellent economic feasibility for the removal of biodiesel wastewater in case of the Fe and Al electrodes.

Multi regression analysis

The effect of multiple independent variables on the dependent variables was studied in multiple regression. Multiple regression analysis was performed using SPSS 22. While pH, current density, conductivity and time were taken as independent variables, the COD and TOC removal efficiencies were taken as the dependent variables for Fe and Al electrodes. The correlation coefficients (R2) between the independent variables and the dependent variables are given in Table 2. The influence of independent variables on the dependent variables was given as significance levels and coefficients in Table 3. A significance level was chosen as 0.05 (5%). While the calculated statistical relationship between the pH and removal efficiencies does not have any significance, the calculated values for the other independent variables and removal efficiencies show some statistical significance was occurred as statically not significant but other independent variables and removal efficiencies were found statically significant. Depending on the coefficients, the following equations were established between the independent and dependent variables.

Table 2 Multi determination coefficient
Table 3 Coefficient and significant values
$$\begin{aligned} &{\text{COD-Fe}}:{ 89}. 7 5\, + \,0.0 5 3 {\text{ pH}}\, + \,0. 5 5 {\text{ current density}}\, + \,0. 2 40{\text{ conductivity}}\, + \,0.0 1 4 {\text{ time}} \hfill \\& {\text{COD-Al}}:{ 89}. 1 6 1\, + \,0.0 7 3 {\text{ pH}}\, + \,0. 8 1 5 {\text{ current density}}\, + \,0. 1 8 2 {\text{ conductivity}}\, + \,0.00 8 {\text{ time}} \hfill \\& {\text{TOC-Fe}}:{ 9}0. 2 8\, + \,0.0 1 1 {\text{ pH}}\, + \,0. 3 7 {\text{ current density}}\, + \,0. 3 2 5 {\text{ conductivity}}\, + \,0.0 1 2 {\text{ time}} \hfill \\ & {\text{TOC-Al}}:{ 89}. 6 9 8\, + \,0.0 8 7 {\text{ pH}}\, + \,0. 5 7 2 {\text{ current density}}\, + \,0. 20 7 {\text{ conductivity}}\, + \,0.0 1 2 {\text{ time}} \hfill \\ \end{aligned}$$

The actual and calculated values for COD-Fe, COD-Al, TOC-Fe and TOC-Al are shown in Fig. 7a, b for the removal efficiencies of COD and TOC. As shown in the figures, similar trends for removal efficiencies of COD and TOC were observed between the calculated and actual values.

Fig. 7
figure 7

The effect of electrolysis time on the COD and TOC removal for multiple regression analysis (i = 0.3226 mA/cm2; Co,COD = 399,800 mg/L; Co,TOC = 98,120 mg/L1; NaCl = 1 g/L1; pH 6; T = 298 K; agiation speed = 120 rpm)

Conclusions

The reported results showing that one of the main methods for the removal of COD and TOC from biodiesel wastewaters is the electrocoagulation method. The main parameters that affect the electrocoagulation performance were investigated and optimized in this study. Depending on our results, Fe electrode is more effective for the removal of COD and TOC from heavily polluted biodiesel wastewaters. NaCl was used as the supporting electrolyte, and the optimal NaCl concentration was found as 1 g/L. This optimized concentration provides reasonable removal efficiencies and relatively low electrical energy consumption. The results also showed that COD and TOC were effectively removed via electrocoagulation with Fe electrodes at an initial pH of 6 and an initial COD and TOC concentration of 400,000 and 98,000 mg/L, respectively. Furthermore, the maximum COD and TOC removal efficiencies of the Fe electrodes were 91.74 and 91.98%, respectively. At pH 6 and an operating time of 1 min, the optimal current density for COD and TOC removal was observed as 0.3226 mA/cm2.

These results showed that the EC process using an aluminum and iron electrodes with dipolar reactor is very effective to reduce the COD and TOC as low as 91% in biodiesel wastewater. The other studies showed that the monopolar reactor using different electrodes were not very effective for the COD removal because of very long electrolysis time and very high voltage requirement (Ngamlerdpokin et al. 2011; Chavalparit and Ongwandee 2009).

The treatability of biodiesel wastewaters by different methods is given in Table 4. In those studies monopolar configured electrodes were used. COD removal efficiency varies depending on waiting times. The recovery efficiency is high during the long waiting times while the recovery efficiency is low in the short waiting times. The coagulant used in the chemical coagulation process affects removal efficiency. Removal efficiency is low in acidification process. The bipolar fashioned electrocoagulation process results in high COD and TOC removal efficiencies. The current densities and electrolysis times used in this study is more economical when they are compared to other studies.

Table 4 The treatability of biodiesel wastewaters by different methods