Introduction

Environmental pollution is probably the most transcendental problem facing engineers and scientists around the world due to only 2.5% of the available water is suitable for human consumption. The textile industry is one of the largest water consumers in the world; on average, it consumes two million liters of water per tonne of finished product and up to 16% of this water is consumed in the dyeing processes (Kant 2012). Fiber and textiles manufacturing is one of the most important activities in Colombia. In 2016, it represented 8.8% of the Gross Domestic Product (GDP) for the manufacturing industry and 11.2% of the national GDP (Superintendencia de sociedades 2017). The effluents of this industry are highly pollutant and represent a real risk for water resources, mainly because about 30% of the dye used in the dyeing stage remains in the effluents and it is discharged into pipelines (Manu 2007).

The world consumption of indigo dyes reaches approximately 33 million kg annually, and its growth is continuous (Qu et al. 2014). Indigo carmine (IC), also called indigotindisulfonate, indigota or acid blue 74, stands out as one of the most used vat dyes in the textile industry, specifically in the dyeing of fibers such as denim, wool, polyester, and silk. It is characterized by the presence of two sulfonate groups (NaSO3), which provide a negative surface charge to the molecule (Secula et al. 2011). The molecular weight is 466.36 g mol−1, it is generally presented as an odorless dark purple or blue powder, and it is soluble in water (approximately 1 g in 100 mL at 25 °C) (Fig. 1). Despite its various applications in the industry, it is highly toxic and can cause serious repercussions on human health.

Fig. 1
figure 1

Molecular structure of indigo carmine (Donneys-Victoria et al. 2018)

There are several alternatives to treat effluents with high content of dyes, from physical and biological processes to chemical and electrochemical treatments. Traditional coagulation, for instance, is attractive to the industry due to its simple design and low operating cost; however, it involves the addition of flocculants to reduce settling times. Also, the agitation used in the coagulation equipment creates shear forces that in some cases prevent proper coagulation (Shammas et al. 2010). Adsorbents such as activated carbon have been used for physicochemical treatments. Hu et al. (2016) treated solutions with an initial concentration of 500 mg L−1 of IC, reaching removals of 459.5 mg of IC per gram of activated carbon; however, the equipment volume, its operation complexity, and particularly the high cost of the regeneration of adsorbent limit this option.

The use of bacteria and enzymes as biological treatments has had little success. The low biodegradability of the dyes, the long residence times, and the dependence of the initial dye concentration on the enzymatic activity have been its main limitations (Kandelbauer et al. 2004). In addition, in the photocatalysis field, the photo-fenton process, for example, may produce dangerous by-products in the oxidation reaction. Also, when the fluid has a dark color, UV light does not reach the fluid bulk, resulting in low dye removals (Barrios-Ziolo et al. 2015; Brillas et al. 2010).

Electrochemical oxidation technologies such as electroxidation with boron-doped diamond and bioelectrochemical systems with microbial fuel cells (MFCs) and intensified by micro-electrolysis have been used for decolorization of dye waste water recently (Liang et al. 2018; Shi et al. 2018). Otherwise, electrocoagulation (EC) is another alternative in the electrochemical processes. EC has shown to achieve removals between 70 and 100% in the dye content, chemical oxygen demand (COD), and biological oxygen demand (BOD) by varying operating parameters such as pH, initial concentration of the pollutant, current density, and temperature (Elnenay et al. 2017). Electrocoagulation is based on the production of metal ions as a result of applying electric current, either continuous or alternating, to an electrolytic cell. Metal oxides and hydroxides are formed from the sacrificial anode release ions and promote the destabilization of colloids, the formation of larger solid agglomerates by aggregation, and the separation of solids by decantation or flotation (Vong and Garey 2014). Moreover, it is known that floc size is an important parameter of floc morphology and is relevant to the effectiveness of coagulation-flocculation processes in a water treatment train (Lee and Gagnon 2016a, b; Ren et al. 2017). Research regarding the characteristics of flocs produced from EC is limited; nevertheless, there are a number of papers that compared chemical coagulation (CC) and EC for iron and aluminum electrodes (Lee and Gagnon 2016a, b; Oliveira et al. 2010).

Magnesium (Mg) is one of the most abundant non-toxic metals in the earth’s crust and a chemically active material which is highly susceptible to corrosion; therefore, it is presented along with its alloys, as a great alternative to be used as sacrificial anode in EC. Although aluminum (Al) and iron (Fe) sacrificial anodes are generally more common, magnesium has a high recycling potential, and reports of its use as the anode material for the removal of dyes by electrocoagulation are scarce.

Aluminum and zinc as secondary materials added to magnesium AZ alloys provide toughness and hardness. This characteristics make alloys suitable for aerospace and automotive applications because low weight and greenhouse gas emissions are required (Pardo et al. 2008); the alloy AZ31 (composition by weight: 95.56% magnesium, 3.0% aluminum, 1.0% zinc, 0.043% manganese, 0.01% of silicon, copper < 0.01%, nickel < 0.001% and 0.003% of iron) is one of the most used nowadays (Fekry and Tammam 2011). The literature reports the following anodic and cathodic reactions for Mg and Al anodes.

$$ 2\ {\mathrm{H}}_2\mathrm{O}+2{e}^{-}\kern0.5em \to \kern0.5em {H}_{2\ (g)}\uparrow +2\ \mathrm{O}{\mathrm{H}}^{-}\ \left(\mathrm{cathode}\right) $$
(1)

When magnesium is used as an anode:

$$ \mathrm{Mg}\kern0.5em \to \kern0.5em {{\mathrm{Mg}}^{2+}}_{(aq)}+2\ {e}^{-} $$
(2)
$$ {{\mathrm{Mg}}^{2+}}_{(aq)}+\kern0.5em 2\ {H}_2O\kern0.5em \to \kern0.5em \mathrm{Mg}{(OH)}_2\downarrow +2\ {H^{+}}_{(aq)} $$
(3)

When AZ31 is used, reactions 4 and 5 also taken place at the anode:

$$ \mathrm{Al}\kern0.5em \to \kern0.5em {{\mathrm{Al}}^{3+}}_{(aq)}+3\ {e}^{-} $$
(4)
$$ {{\mathrm{Al}}^{3+}}_{(aq)}+\kern0.5em 3\ {\mathrm{H}}_2\mathrm{O}\kern0.5em \to \kern0.5em \mathrm{Al}{\left(\mathrm{OH}\right)}_3\downarrow +3\ {{\mathrm{H}}^{+}}_{(aq)} $$
(5)

The negative differential effect of magnesium and its alloys is characterized by strong hydrogen evolution on the surface of the anode during polarization through Reactions 6 and 7 (Thomas et al. 2015).

$$ \mathrm{Mg}\kern0.5em \to \kern0.5em {\mathrm{Mg}}^{+}+{e}^{-} $$
(6)
$$ 2\ {\mathrm{Mg}}^{+}+2\ {\mathrm{H}}_2\mathrm{O}\kern0.5em \to \kern0.5em 2\ {\mathrm{Mg}}^{2+}+2\ \mathrm{O}{\mathrm{H}}^{-}+{\mathrm{H}}_{2\ (g)} $$
(7)

Passivation of the sacrificial anode is one of the disadvantages of the EC process. It has been shown that by reversing the polarity of the electrodes, passivation is prevented; this technique has produced an increase of up to 20% in the discoloration of wastewater (Pi et al. 2014).

The main aim of this investigation was to evaluate the performance of high purity Mg electrodes and AZ31 alloy as sacrificial anodes in the electrocoagulation process with polarity change (PC) of synthetic indigo carmine solution (IC). The effects of temperature, current density, agitation speed, and the initial concentration of IC on the dye removal and non-purgeable organic carbon (NPOC) removal were assessed. Also, this paper compares the structure of EC flocs from magnesium electrocoagulation with and without polarity change, analyzing differences in zeta potential, floc average area, perimeter, and fractal dimension.

Experimental

Initially, a preliminary design focused on evaluating the performance of the electrode material was proposed, followed by a main design, focused on determining the best working conditions. Finally, a preliminary technical-economic evaluation for the best performing tests was carried out.

IC solution was prepared by dissolving indigo carmine (Sigma-Aldrich, 85% dye content) and 1800 mg L−1 of sodium chloride (Sigma-Aldrich, reagent grade) in purified water obtained by drinking water distillation, previously filtered (0.45 μm) and subjected to adsorption with activated carbon, in a Water Pro PS Labconco equipment. The properties of the purified water were 1 mg L−1 of non-purgeable organic carbon, electric conductivity of 17.95 μs cm−1, and pH of 7.83.

To measure the pH and electrical conductivity (mS cm−1), a standardized (at 25 °C) multiparameter sensor mark Thermo Scientific Orion Star A329 was used. For the determination of NPOC (mg L−1), the samples were filtered using a 0.45-μm filter and analyzed by the TOC-VCPH equipment, based on a calibration curve prepared with potassium phthalate (C8H5KO4).

To determine the indigo carmine concentration, a UV-Vis analysis was performed to find the wavelength at which the maximum absorbance was obtained. Afterwards, the calibration curve was built in a Jasco UV V-730 Visible Spectrophotometer equipment at 612 nm. Also, atomic absorption in a Thermo Scientific ICE 3000 Spectrometer was used to determine the total magnesium concentration of the samples. The pH was first adjusted at pH < 2 with 35% nitric acid (HNO3), then the samples were digested softly with hydrochloric acid (HCl); afterwards, lanthanum heptahydrate chloride (LaCl3 × 7 H2O) was added in order to eliminate interferences by ionization and measurements with air flame acetylene at a wavelength of 253 nm were made.

In order to elucidate the coagulation mechanism involved in the magnesium electrocoagulation process, zeta potential measurements after settling of the AZ31 samples at different electric charges (C L-1) were carried out using a Zeta-Meter 4.0 m from Zeta-Meter Inc. (Virginia, USA). Between 20 and 25 readings were taken in order to achieve standard deviations of less than 6%. In any case, the minimum number of data required to obtain the average value was 15.

Experimental assembly

A 1000-mL beaker was used as an electrolytic cell with 900 mL of initial solution volume. AZ31 alloy, high purity magnesium (99.5% w/w), and AISI 304 stainless steel were used as electrodes. These plates, with an effective area of 76.5 cm2, 71.5 cm2, and 76.5 cm2, respectively, were suspended and clamped together using polyethylene belts, guaranteeing an interelectrode distance of 0.5 cm. For heating and stirring, a Thermo Scientific brand plate model SP131635Q was used, with a 3 cm long and 0.5 cm in diameter magnetic stirrer, and a Brisco thermometer. The electrodes were connected to a direct current power source BK Precision DC Regulated Power Supply model 1665 with a maximum amperage of 5 A, in a monopolar arrangement using two different configurations. For the first configuration, the same material, AZ31 or Mg, was used for both electrodes, connected to a polarity inverter followed by the power source. For the second configuration, a stainless steel cathode and AZ31 anode were directly connected to the power source.

Before each experimental test, the electrodes were manually polished with sandpaper gauge 100, 200, 400, 600, and 1200, respectively. Subsequently, they were immersed in 10% v/v hydrochloric acid for 5 min, washed thoroughly with distilled water, and dried at ambient conditions. The initial pH of the indigo carmine solutions was adjusted between 6.5 and 7 with 0.05 M sodium hydroxide and 0.05 M sulfuric acid.

Experimental design

EC tests were carried out using the assembly shown in Fig. 2. Firstly, the initial concentration of indigo carmine was 100 mg L−1, the agitation speed was 840 rpm, and operating time was 4 h. The polarity of the cell was reversed periodically in intervals of 7.5 min, equivalent to 8 cycles h−1, as established by Rajic et al. (2013). The effect of current density (20 and 50 A m−2,) and temperature (24 and 50 °C), on the performance of both anodic materials, was evaluated with a factorial design 22 replicated once. For each test, 8 samples were taken distributed every 15, 30, or 45 min, so a volume correction was made for the calculation of the specific electric charge supplied. All the samples were analyzed for indigo carmine concentration, and just some of them were analyzed for NPOC. In addition, the cell voltage, pH, temperature, and electrical conductivity were continuously monitored.

Fig. 2
figure 2

Experimental assembly. 1—thermometer, 2—EC cell, 3—power source, 4—polarity exchanger, 5—stirring and heating plate

During the second stage, only AZ31 alloy was used as anodic material. Initial concentration of indigo and current density were evaluated using factorial design 22 with replication. The levels evaluated were 100 and 300 mg L−1 and 50 and 80 A m−2, respectively. Agitation speed at 450 rpm to ensure a turbulent regime, the specific electric charge supply (3161 C L−1) and the temperature (24 °C) were set as parameters. Eight samples were taken for each of the experimental tests at different values of electric charge. All the samples were analyzed for indigo carmine concentration; some of them were analyzed in terms of NPOC and zeta potential, and total magnesium concentration was measured only for final samples. The polarity of the cell was reversed like in the previous stage, and the cell voltage, pH, temperature, and electrical conductivity were continuously monitored.

Current densities were selected through a potentiostatic polarization analysis performed for AZ31 in a 1800 mg L−1 NaCl solution; it was evidenced that current densities greater than 50 A m−2 cause an increase in the working electrode voltage, therefore a high electrical consumption. Besides, at these conditions, working electrode potential is as low as − 1.4 V vs NHE (data not shown).

A final test was carried out twice without polarity change for the AZ31 alloy. The operating parameters were set at 24 °C, 100 mg L−1 as initial dye concentration, 450 rpm for the stirring speed, 50 A m−2 as current density, and 3161 C L−1 for the specific electric charge supplied. Measurements made for the main experimental design were made again in the same conditions.

It is important to note that the concentrations of dye and NaCl resemble the concentrations used in photocatalysis studies or iron electrocoagulation studies (Secula et al. 2011) and those reported for industrial effluents (García-Morales et al. 2013).

The summary of all the experimental tests and their operating conditions is available in Table 1.

Table 1 Experimental tests

Analytical procedures

For the corresponding points, indigo carmine removal and non-purgeable organic carbon removal were calculated from Eqs. 8 and 9, respectively.

$$ {X}_{\mathrm{i}}=\left(\frac{{\left[\mathrm{IC}\right]}_i}{{\left[\mathrm{IC}\right]}_o}\right)x100 $$
(8)
$$ {Y}_i=\left(\frac{{\left[\mathrm{NPOC}\right]}_i}{{\left[\mathrm{NPOC}\right]}_o}\right)x100 $$
(9)

where [IC]i is the concentration of dye in a specific time i, [IC]o the concentration of dye before treatment, [NPOC]i the non-purgeable organic carbon content in time i, and [NPOC]o the non-purgeable organic carbon content before EC. The theoretical amount of coagulant (magnesium), dosed to the medium, was calculated from Faraday’s law, Eq. 10.

$$ W=\frac{I\cdotp t\cdotp M}{n\cdotp F} $$
(10)

where W is the amount of coagulant (g), I is the current intensity (A), t is the time (s), n is the number of electrons involved in the reaction (2 electrons), F is Faraday’s constant (C mol−1), and M is Magnesium’s molecular weight (g mol−1). In this respect, Secula et al. (2012) calculated the operational electrical cost of an electrocoagulation cell according to Eqs. 11, 12, and 13.

$$ \mathrm{EOC}=\mathrm{UED}\cdotp \mathrm{EEP}+\mathrm{UEM}\cdotp \mathrm{EMP} $$
(11)
$$ \mathrm{UED}=\frac{I\cdotp {\int}_o^t Udt}{1000\cdotp V\cdotp {\left[ IC\right]}_o\cdotp \left(\raisebox{1ex}{${Y}_i$}\!\left/ \!\raisebox{-1ex}{$100$}\right.\right)} $$
(12)
$$ \mathrm{UEMD}=\frac{I\cdotp t\cdotp M}{n\cdotp F\cdotp {\left[ IC\right]}_o\cdotp \left(\raisebox{1ex}{${Y}_i$}\!\left/ \!\raisebox{-1ex}{$100$}\right.\right)} $$
(13)

where U is the cell voltage (V), I is the current density (A); t is time (s), n is the number of electrons involved in the reaction, F is Faraday’s constant (C mol−1), and M is Magnesium’s molecular weight (g mol−1). UED is the energy demand unit (kWh/kg of NPOC removed), V is the volume of treated solution (m3), Yt is the decrease in NPOC (%) at time t, EMU is the demand unit for the electrode material (kg/kg NPOC removed), EOC is the operational cost (USD $/kg NPOC removed), EEP is the price of electric energy (USD $/kW-h) considered as 0.184 USD $/kW-h, and EMP is the cost of electrode material (USD $/kg) estimated as 2.42 USD $/kg for high purity magnesium and 25 USD $/kg for AZ31 from international suppliers as Yangquan Metals & Minerals Imp. & Exp. Co., Ltd., and Hunan High Broad New Material Co., ltd, respectively.

Floc characterization

A camera (Nikon DS-2MBWc) connected to an optical microscope (Nikon Eclipse 90i) was used to capture floc images at a magnification of 20X, being the images grabbing performed in 8 bit, 1600 × 1200 pixels matrix (0.27 μm/px). Samples were collected at the end of the electrocoagulation test at 1800 C L−1 with and without polarity change, using a micropipette and diluted using 2 mL in 10 mL volume. Because flocs tend to be fractal in nature, it was assumed that the structure of any fragmented flocs was representative of the structure of the flocs prior to breakdown (Lee and Gagnon 2016b). Then, using pipets, 10-μL samples were dropped onto glass counting cells and dried at room temperature before image analysis. The counting cell was Zeta scanned, and floc images (from 5 different sites on the cell) were captured to ensure an adequate representation of the floc distribution, according to the procedure derived from literature (Aguilar et al., 2003).

All captured images were processed using an image analysis software named FlocZise, developed by researchers from the Systems Engineering and Computational Sciences Department from Universidad del Valle-Cali, Colombia. The frames were treated as follows: (a) First, the background from the original image was subtracted in order to reduce the effect of lighting change. Then, the image was subjected to binarization, and contours were detected by using Canny algorithm; afterwards, edge particles were removed. At the end, structural analysis and shape descriptors from the OpenCV library were used to find and describe the contours and calculate the area and the perimeter, while other libraries were used for fractal dimension determination.

Floc size is the most important property to describe a floc. As representative sizes the characteristic dimensions of a sphere, rectangle and ellipse which contain the same projection area as the floc, were used. On the other hand, because of their complex and irregular structures, flocs are commonly described using fractal geometry. Fractal aggregation theory provides a means of expressing the degree to which primary particles fill the space within the nominal volume occupied by an aggregate (Chakraborti et al. 2003). In order to calculate fractal dimension, box counting technique was used.

Results and discussion

In this first phase, the incidence of the temperature and the anodic material was evaluated on the dye and NPOC removal.

Temperature

For both anodic materials, at the same current density, there was no significant effect of the temperature on the performance of the electrocoagulation process (Fig. 3). This result can be attributed to an increase in the probability of collisions between the colloids formed, as a result of their kinetic energy, which could favor the formation of large aggregates and decrease the surface area available for adsorption (Zaghouane-Boudiaf et al. 2012). On the other hand, although the increase in temperature favored the anode dissolution, this could negatively affect the performance of electrocoagulation due to the formation of dense flocs that could be deposited on the surface of the electrode, preventing the dosage of metallic cations (Shammas et al. 2010). For this reason, room temperature was used in the remaining tests.

Fig. 3
figure 3

Effect of temperature on a NPOC removal − current density = 50 A m−2. b NPOC removal − current density = 20 A m−2. c Dye removal − current density = 50 A m−2. d Dye removal − density of current = 20 A m−2

At the beginning of the operation, there was a quick decrease in NPOC and dye removal at a current density of 50 A m−2, until 3161 C L−1; after this, equilibrium was reached. The initial behavior can be attributed to a high number of free adsorption sites, as well as the high concentration of dye; however, these spaces begin to decrease due to the repulsion forces that are produced between molecules already adsorbed and those that are still in solution (Zaghouane-Boudiaf et al. 2012).

Ramesh et al. (2014) evaluated the adsorption of IC in magnesium hydroxide at different temperatures; their results showed that the adsorption process is spontaneous and endothermic in the pH range between 6 and 7 and 12–13. Likewise, they showed that the adsorption was maximum at a pH close to neutral, moderate for pH between 9 and 10, and low for a pH range between 12 and 13. However, a similar behavior was not reflected for pH in this electrochemical process because pH values between 10.5 and 11 were reached in the first 15 min of treatment and then stabilized around 11, for the rest of the process. This behavior is related with the delivery of hydroxyl ions to the medium through two reactions, the first one from the chemical reaction at the anode (Eq. 7) and the second one from the electrochemical reaction at the cathode (Eq. 1) (Donneys-Victoria et al. 2018).

Anodic material

It was established that, at 20 A m−2, AZ31 showed a greater NPOC and dye removal, compared with high purity magnesium (Fig. 3a, c), while, at 50 A m−2, a significant difference in the performance achieved by both materials cannot be established (Fig. 3b, d). Besides, the variation of the potential, for both materials at 20 and 50 A m−2, is found in Fig. 4a, b, respectively. The behavior of the cell voltage during the tests showed that the arrangement using high purity Mg was twice the value obtained with the AZ31 alloy. Also, initially, the open circuit potential for AZ31 was lower than the one for Mg, and this tendency prevailed throughout the whole operation. The decrease of NPOC and indigo carmine concentration, and the cell voltage evolution, can be explained by the material corrosion resistance. It is well known that high purity Mg has better resistance to corrosion than its alloys, because of the content of cathodic alloying elements like zinc and aluminum which encourage galvanic corrosion (Singh et al. 2015).

Fig. 4
figure 4

Variation of cell potential for a current density = 20 A m−2 and b current density = 50 A m−2

Furthermore, another explanation is the possible formation of polymeric aluminum species on the surface of the electrodes. Pardo et al. (2008), evaluated the corrosion behavior of high purity Mg and the alloys AZ31, AZ80, and AZ91D in a 3.5% w/w NaCl solution at 25 °C and proved that the main compound responsible for the surface passivating layer is Mg(OH)2; however, for magnesium-aluminum alloys, the layer has a skeletal structure also formed by Al polymer species, whose passivating properties are lower in comparison to the layers formed only by Mg(OH)2 and MgO. The difference in the dissolution of AZ31 and high purity magnesium is supported by the study of Donneys-Victoria et al. (2018), in which the removal of IC was evaluated using EC; it was found that the former dissolved more magnesium than the latter.

Once the viability of working at room temperature using the AZ31 alloy as electrode material was established, the effect of the stirring speed, the current density, and the initial dye concentration was evaluated.

Agitating speed

Figure 5a and b present the NPOC and dye removal, respectively, for 450 and 840 rpm as agitation speed. Although the increase of the rpm allowed a better distribution of the coagulant and guaranteed temperature and pH homogenization into the solution, non-significant effects were observed in the removal of NPOC and dye concentration with the increasing of the stirring speed. In addition, the removal reached did not show an improvement that supports the additional power expenditure by increasing the speed almost twice. Calculated Reynolds number (Re) values for 450 and 840 rpm showed that the flow regime remained turbulent in both cases (Re > 10,000).

Fig. 5
figure 5

Stirring speed effect in a non-purgeable organic carbon (%) removal. b Dye removal (%)

The results showed that once turbulence was reached, increasing the speed of agitation does not ensure an improvement in the removal of NPOC or dye content. Moreover, at high agitation speeds, there is a risk of breaking flocs, causing their removal by physical methods such as flotation or sedimentation to be more difficult (Bayar et al. 2011). Khaled et al. (2015) determined that above 450 rpm, the removal efficiency of cadmium from the EC process using aluminum electrodes was negatively affected. After 60 min of operating time, a 33% increase in stirring speed (from 450 to 600 rpm) reduced the cadmium removed by approximately 18%.

Current density

Decrease in NPOC and dye concentration, for the three current density levels under study for the AZ31 anode, is presented in Fig. 6a and b, respectively. It was established that, although the deviation at 20 A m−2 overlaps the deviation at 50 A m−2, the increase in the current density meant an increase in NPOC removal. However, increasing the current density from 50 to 80 A m−2 did not improve NPOC or dye removal, probably as a result of the formation of passivating films followed by increase in resistance at high current densities. This was demonstrated with potentiostatic polarization analysis performed for AZ31 in a 1800 mg L−1 NaCl solution (data not shown). In addition, Singh et al. (2015) found that high purity magnesium and magnesium-aluminum alloy surfaces were almost intact after 72 h of exposure in a 3.5% w/w NaCl solution due to oxide films formed on electrodes, thereby reducing corrosion significantly.

Fig. 6
figure 6

Current density effect in a non-purgeable organic carbon removal (%). b Dye removal (%)

Initial concentration of dye

The effect of dye concentration on NPOC and dye removal is presented in Fig. 7a and b. There was a major decrease in NPOC and dye concentration for 100 mg L−1 IC independently of the value of the current density; this is related with ratio of Mg and Al hydroxides with respect to the dye particles, probably due to the adsorption capacity of the flocs formed in the EC being exceeded. These results are consistent with those from Secula et al. (2011) for IC treatment by electrocoagulation with steel electrodes and dye concentration between 25 and 100 mg L−1. It should be noted that the present study covers concentrations that are close to the reality of the textile industry (García-Morales et al. 2013), obtaining important values of NPOC and dye removals.

Fig. 7
figure 7

Initial dye concentration effect at different levels of current density in a non-purgeable organic carbon removal (%). b Dye removal (%)

Effects of polarity change

Once the temperature was set at 24 °C, stirring speed at 450 rpm, current density at 50 A m−2, and AZ31 alloy as the electrode material, the effect of the polarity change in the performance of the EC process was studied, in terms of the dye and NPOC removal (Fig. 8). An increase of approximately 43% in NPOC removal was achieved with polarity change, while there was no significant difference for dye removal, possibly due to the pH dependence in the dye concentration measurement; this parameter was similar in the last points of both tests.

Fig. 8
figure 8

Polarity change effect at room temperature and current density of 50 A m−2, in a non-purgeable organic carbon removal (%). b Dye removal (%)

Passivation layers on the anodic surface occurs due to the formation of metal oxides and hydroxides; consequently, there is an increase in the resistance of the system and therefore an increase in the electrocoagulation operating costs (Garcia-Segura et al. 2017). Changing the polarity of the electrodes allowed the distributing of the oxidation reaction between both electrodes, avoiding the saturation of the surface with oxide and hydroxide layers. This action decreased passivation and favored the electrolysis process. Similar results were obtained by Pi et al. (2014), by using an electrochemical cell with polarity change; in that study, the discoloration of wastewater contaminated with methyl orange was improved 20%.

The electric charge on the surface of particles during the EC process was analyzed by studying the Zeta potential. Table 2 shows for both cases (with and without polarity change) that the colloids tended to neutralize their charge as the electric charge supplied increased. The Mg2+ dissolved from the anode at a pH higher than 10, generates Mg(OH)2, positively charged highly insoluble hydroxide, which promoted the adsorption of dissolved organic matter (Semerjian and Ayoub, 2003) and attracted negative surface-loading substances such as acid dyes. Indigo carmine has a pKa of 12.6; thereby, its structure does not change at lower pH values and it is negatively charged in a wide range of pH (Palma-goyes et al. 2014). Therefore, charge neutralization represents one of the mechanism involved in the process, as has been reported by other studies with magnesium hydroxide (Zhao et al. 2014), but it has also been reported that magnesium hydroxide was used as an adsorbent for the removal of indigo carmine dye from a aqueous solution (Ramesh and Sreenivasa 2015).

Table 2 Zeta potential values for tests with and without polarity change for AZ31

Neutralization was reached close to 1800 C L−1 at the same shear conditions because zeta potential results were close to 10 mV, which is in agreement with NPOC and dye removal results. Zeta potential value indicates that magnesium hydroxide in the aqueous phase is not a primary particle but aggregate, then, separation of solids by decantation predominated, while for lower electric charges, the phenomenon of magnetism and charge attraction predominated (Tan et al. 2011).

Floc size and structure

Figure 9 presents floc images captured after treatment. For both experiments, particles formed flocs of variable shapes and sizes, but more than 95% of the particles showed area values of 45.05 μm2 and 55.44 μm2, and perimeter values of 37.91 μm and 46.96 μm for experiments without and with polarity change respectively. Particularly, a broad range of particle areas were found without polarity change.

Fig. 9
figure 9

Examples of floc images captured at room temperature and with a current density of 50 A m−2. a Without polarity change. b With polarity change

Figure 10 shows fractal dimension distribution for both experiments. The two-dimensional fractal dimension (D) was found to range from 1.11 to 1.36, for experiments without polarity change, and from 1.15 to 1.5 for experiments with polarity change. A low D value indicates that an aggregate is open and highly branched, whereas a high value suggests that it is tightly packed (Lee and Gagnon 2016b). Changes in fractal dimension are explained by changes in aggregate growth and changes in aggregate structure. It has been reported that a coagulant dose may affect this process (Chakraborti et al. 2003). In addition, D values were similar to those reported for alum flocs (Chakraborti et al. 2003) and represent typical values at steady state for aggregates produced under turbulent conditions (in the range of 1.1–1.4) (He et al. 2012).

Fig. 10
figure 10

Fractal dimension distribution at room temperature and with a current density of 50 A m−2. a Without polarity change. b With polarity change

Flocs from magnesium hydroxide-reactive dyes in a coagulation system are relatively small comparing with other coagulation processes using aluminum and some of them aggregate together to form more compact ones under higher pH values (Wei et al. 2014). This is consistent with the fractal dimension values obtained by experiments with polarity change and pH values reported in Table 2.

Electrical efficiency

The theoretical electrical efficiency was calculated based on Faraday’s Law, which establishes that the mass of precipitated material is directly proportional to the amount of electricity transferred to the electrode; it is considered that dissolution is performed only and exclusively by electrochemical reactions. For the best working conditions, final Mg concentrations of about 1242 mg L−1 were achieved, reaching an efficiency of 125%. Chemical corrosion mechanisms, due to the attack of oxidizing agents such as a chloride ion, present in the electrolyte, explain why values greater than 100% were reached. At the lowest current density, the total magnesium release from AZ31 electrodes by using polarity change was the third part of the expected theoretical value, while an increase in the temperature release 24% more magnesium into the solution at the same current density. Donneys-Victoria et al. (2018) also reported concentrations between 500 and 600 mg L−1 of dissolved Mg for the same operating time and electric current efficiencies higher than 100% for both materials.

Electricity consumption and operational electric cost

The electric consumption was calculated per amount of pollutant removed, with and without polarity change, by determining the specific electrical consumption for each test point and integrating to apply the Eq. 11. It was found that the total electrical consumption for the process with polarity change, equivalent to 22.1 kWh/kg of COD removed, was higher in comparison to the process without polarity change (14.3 kWh/kg of COD removed), largely due to the interruption of the circuit caused by the reversal cycles of the polarity and then the increase of cell voltage for a few seconds afterwards. Nevertheless, this electrical consumption is lower than the one reported by Secula et al. (2011) using iron electrodes, 10 A m−2, 1.5 g L−1 NaCl and 50 mg L−1 of IC dye.

Conclusions

Performance of electrocoagulation for synthetic indigo carmine removal was studied using high purity magnesium and AZ31 alloy anodes in a monopolar electrolytic cell with and without polarity change. It was demonstrated that polarity change improved by approximately 43% the diminishing of non-purgeable organic carbon by using AZ31 alloy at room temperature, and 50 A m−2 current density. An electric energy consumption close to 22 kWh/kg NPOC removed was established. Inferior performance was achieved using high purity magnesium anodes with polarity change due to possible formation of passivating layers from amorphous complexes of magnesium and magnesium hydroxide on the electrodes surface.

Magnesium flocs from electrocoagulation were more compact and reached major area values when formed from polarity change rather than without polarity change; furthermore, for both experiments according to zeta potential results, neutralization was reached close to 1800 C L−1.

The results of this study allowed to demonstrate the potential use of magnesium and the AZ31 alloy as sacrificial anode in electrocoagulation with polarity change, which encourages the study of the use of magnesium and its alloys in the treatment of wastewater. It is important to notice that compared to other metals used, magnesium is environmentally friendly and can be easily removed from effluents.