Introduction

Nutrients are essential substances that provide nourishment necessary for the maintenance of life and growth, where nitrogen (N) and phosphorus (P) are critical nutrients to the agricultural sector. In the case of P, it has been recently estimated that as early as the 2030s, global demand will exceed supply, due to the fact that demand will continue to increase with a growing world population, but the P fertilizer rate of production will decrease when rock phosphate resources become depleted [1,2,3,4]. All farming manures (slurry, farmyard, and poultry) and wastewaters contain these useful nutrients. For example, agro-industrial wastewaters usually contain high levels of nutrients like N, P, and it is estimated that 50–80% of these nutrients are disposed as waste and not recovered [5]. Concentrations of P in wastewater effluents can vary from 8.5 ppm (e.g., landfill leachate) to 740 ppm (e.g., fresh urine) [6, 7]. Further, loss of P and N through agricultural land intensification has led to a series of water quality problems on a global scale due to nutrient runoff [1,2,3]. Therefore, the recycling of P and N from wastewater effluents has become a dominant global objective [8,9,10]. It is crucial to develop efficient processes that are capable of significant reduction of water pollution from agricultural farms and extraction of vital added-value nutrients. Such processes would enable agriculturally intensive countries to implement cost restructuring and address ever-increasing discharge of contaminants in waterways. Efficient extraction of nutrients from wastewater effluents could also provide cost savings in commercial fertilizers and reduce environmental impact.

There are several methods for nutrient extraction such as crystallization [11, 12], gas-permeable membranes [13, 14], liquid–gas stripping [15, 16], and electrodialysis [17, 18]. The recovery of nutrients in a concentrated form such as in the inorganic precipitate struvite is seen as a desirable process because it would allow eventual agricultural reuse. Struvite, also known as magnesium ammonium phosphate hexahydrate (MgNH4PO4*6H2O), or MAP, is a white, orthorhombic, poorly soluble crystal and is considered an economically viable product, a slow-release fertilizer, in agriculture [19, 20]. The crystallization of struvite depends upon supersaturation, the presence of impurities in solution, pH, and temperature. The general reaction may be expressed as follows:

$${\mathrm{Mg}}^{2+}+{\mathrm{NH}}_{4}^{+}+{{\mathrm{H}}_{n}\mathrm{PO}}_{4}^{n-3}+6{\mathrm{H}}_{2}\mathrm{O }\to \mathrm{ MgN}{\mathrm{H}}_{4}{\mathrm{PO}}_{4}*6{\mathrm{H}}_{2}\mathrm{O}\downarrow + {n\mathrm{H}}^{+}$$
(1)

where n = 0, 1, or 2 and is based upon the solution pH [21,22,23]. The primary method to obtain struvite is by chemical precipitation, where extra chemicals (i.e., various magnesium salts and base) are added into the water to supply Mg and adjust the pH [24,25,26,27,28].

Over the years, researchers have shown that it is possible to recover phosphorus as struvite from synthetic agricultural water (ammonium dihydrogen phosphate-NH4H2PO4) by using electrocoagulation [23, 29,30,31,32,33], electrochemical precipitation, or electroless precipitation [36, 46] with either a pure magnesium (Mg) or a Mg alloy as the anode and a 316 stainless steel (SS) as the cathode placed in a bench-scale electrochemical reactor. However, the overall electrochemical struvite production is complicated, involving multiple reactions that occur simultaneously at the electrode surface. Although the electrocatalysis of Mg and its alloys has been studied extensively over the years, some disagreement still exists in elucidating the reaction mechanisms [42, 43]. According to Song and Atrens [40], the formation of Mg2+ occurs in a two-step process at the anode. First, the Mg is oxidized into unstable intermediate monovalent Mg+ ions; next, the Mg+ species are further oxidized to Mg2+ ions in solution, generating molecular hydrogen (H2), while forming an insulating layer (struvite), in turn reducing the available anode surface area. At the same time on the cathode, hydroxide ions (OH) and H2 are produced through the oxygen reduction (ORR) and hydrogen evolution (HER) reactions, respectively. The formation of the insulating layer has a negative impact on the Mg dissolution, the phosphorus removal efficiency, and the generation of molecular hydrogen.

The objective of this work was to investigate the electrochemical mechanism of struvite formation in synthetic wastewater and its effects on the anode performance, by studying the electrochemistry of ammonium dihydrogen phosphate on two different types of sacrificial anode compositions: pure Mg and AZ31 magnesium alloy (Al 3 wt%, Zn 1 wt%, balance Mg), using the cyclic voltammetry (CV), linear sweep voltammetry (LSV), and electrochemical impedance spectroscopy (EIS) methods. The structure, morphology, and composition of the obtained precipitates were analysed by X-ray diffraction (XRD), X-ray photoelectron spectroscopy (XPS), and scanning electron microscopy (SEM), while the ionic species in the test solution was determined with ion chromatography (IC).

Materials and Methods

Materials

The aqueous solutions containing the ammonium dihydrogen phosphate (NH4H2PO4) from Sigma-Aldrich were prepared by using Milli-Q water (18.2 MΩ, Millipore, Bedford, MA, USA). The magnesium (99.9% pure, diameter 5 mm) and the magnesium AZ31 alloy discs (Al 3 wt%, Zn 1 wt%, balanced Mg, diameter 5 mm) were all purchased from Goodfellow (USA). Aqueous solutions pH values were determined before and after the experiments by using a digital pH metre (Orion Star A111, Thermo Scientific).

Instrumentation

Prior to experiments, the pure Mg and Mg AZ31 alloy disc electrodes were mechanically polished by using an abrasive paper (Norton Abrasives, USA), purchased at a local hardware store. In all cases, after polishing, the electrodes were thoroughly washed with Milli-Q water. Electrochemical experiments were carried out at room temperature (RT) in a conventional three-electrode cell with a water jacket (Pine Research, USA) connected to a G3000-30111 potentiostat/galvanostat (Gamry Instruments Inc., USA) equipped with Gamry Framework data acquisition software (version 7.8.1). The pure Mg and the Mg AZ31 alloy disc electrodes served as the working electrode (WE), Ag/AgCl (3.0 M NaCl) served as the reference electrode (RE), and a graphite rod served as the counter electrode (Limmersed = 2.3 cm, ∅ = 0.7 cm, CE). All potentials in voltammograms are quoted against RHE and were calculated using the following equation:

$${E}_{\mathrm{RHE}} = {E}_{\mathrm{Ag}/\mathrm{AgCl}}+0.059 \mathrm{pH} + {{E}^{\varnothing}}_{\mathrm{Ag}/\mathrm{AgCl}}$$
(2)

where EAg/AgCl = +0.210 V vs. SHE (298.15 K) and EAg/AgCl is the measured working potential.

Prior to data acquisition, the electrolyte was thoroughly de-aerated with nitrogen (N2) for 10 min. Cyclic voltammograms (CVs) and linear sweep voltammograms (LSVs) at various scan rates (υ) were recorded in de-aerated 0.10 M ammonium dihydrogen phosphate (pH 4.42) on stationary disc Mg and Mg AZ31 alloy electrodes at room temperature. Electrochemical impedance spectroscopy (EIS) was performed with the same experimental setup by applying a 10-mA current, with an AC amplitude of 10 mV vs. EOCP over a frequency range of 0.1–106 Hz. The experimental setup used in the studies is shown in Fig. 1.

Fig. 1
figure 1

Electrochemical experimental setup for studying the electrochemistry of ammonium dihydrogen phosphate on Mg and Mg AZ31 alloy disc electrodes

Surface and Material Characterization

The elemental composition and morphology of the produced precipitate (mainly struvite, see later) on the Mg disc electrodes were evaluated by using a scanning electron microscope (SEM, FEI Nova Nanolab 200 Dual-Beam). The SEM images and the electrochemically obtained struvite crystal sizes were further analysed by using NIH Image/ImageJ, an open-source image processing program. The crystal structure analysis was performed via x-ray diffraction (XRD) on a Philips PW1830 double system diffractometer equipped with a Cu cathode. X-ray photoelectron spectroscopy (XPS) data were obtained by using a PHI Versaprobe XPS scanning X-ray monochromator with a monochromatic Al Kα beam. The determination of Mg2+, Na+, and Cl ionic species in the test solutions were conducted using a dual-channel Thermo ICS-6000 ion chromatography system (Thermo Fisher Scientific, USA) with suppressed conductivity detection and electrolytic eluent generation. Calibration was performed using multi-ion standards IC-2 for anions and IC-CAT6 for cations, both purchased from High Purity Standards, USA. The cations were separated on a CS12A column by using potassium hydroxide (KOH) as eluent, whilst the anions were separated on an AZ19 column by using methane-sulfonic acid (MSA) as eluent. The samples were pre-filtered by using an Acrodisc LC 25-mm syringe filter with a 0.2-μm PVDF membrane, HPLC certified (Pall Corporation, USA).

Results and Discussion

Cyclic Voltammograms of Ammonium Dihydrogen Phosphate on Mg and Mg Alloy

It is well-known that the electrochemistry of Mg and its alloys is complex [34,35,36,37,38,39, 44]; therefore, controversy still exists as to the corrosion and passivation processes of Mg and the roles of alloying components. For instance, Birbilis et al. and Atrens et al. have both studied the electrochemistry of Mg and its alloys in a wide range of aqueous solutions and environment compositions extensively; therefore, in some areas, the two groups do not always agree [42, 43]. This is due mainly to the very negative equilibrium electrode potential of Mg/Mg2+ (EMg/Mg2+ = −2.363 V vs. SHE), and thus, measurements can easily be carried out with most currents containing both anodic and cathodic contributions, leading to major assumptions, such as, the so-called “negative difference effect” (NDE) which has been reported with a range of different interpretations and thus, without agreement [42, 43].

Due to the lack of agreement and complexity regarding the corrosion and passivation of Mg during the electrochemical struvite production, we decided to further study this phenomenon. As a first step, we studied the electrochemical behaviour of the Mg electrodes by cyclic voltammetry. Figure 2 shows two single-cycle CVs on pure Mg and Mg AZ31 alloy electrodes in 0.10 M ammonium dihydrogen phosphate at 50 mV s−1 and RT, where the potential was scanned from −3.0 to +2.5 V vs. RHE and back. From the figure, it can be seen that the CVs for both Mg electrodes are similar, with no major anodic or cathodic peaks, and “IR drop responses,” indicative of either deposit formation or electrode passivation. The noise observed at high positive potentials may be associated with gas bubble formation visually observed during the potential scans (results not shown here) on the surface of both Mg electrode materials. Additionally, the increased current observed in the backward scan would further suggest that there is a dynamic change occurring at the electrode surface during the scan.

Fig. 2
figure 2

Full CVs of 0.10 M ammonium dihydrogen phosphate on a pure Mg and b Mg AZ31 alloy at 50 mV s−1 in the potential range of −3.0 V vs. RHE to +2.5 V vs. RHE and RT

Corrosion Studies of Mg and Mg Alloy in Ammonium Dihydrogen Phosphate

In this study, we assume for the corrosion rate measurements for Mg and its alloy, that the corrosion process is uniform and not localized. Figure 3 shows a series of linear sweep voltammograms (LSV) of 0.10 M ammonium dihydrogen phosphate on Mg and Mg AZ31 alloy at RT at various scan rates (1, 10, and 100 mV s−1) in the potential range of −3.0 V vs. RHE, +2.5 V vs. RHE. It can be observed that the current density decreased at positive potentials when a low scan rate was applied for both electrodes (Fig. 3, blue lines). This can be explained by the formation of the struvite layer, an insulating layer, which at higher scan rates (10 or 100 mV s−1) does not have the time to form properly.

Fig. 3
figure 3

LSVs of 0.10 M ammonium dihydrogen phosphate on a pure Mg and b Mg AZ31 alloy at RT at various scan rates (1, 10, and 100 mV s−1) in the potential range of −3.0 V vs. RHE, +2.5 V vs. RHE

Next, we studied the corrosion behaviour of the Mg-based anodes in 0.10 M ammonium dihydrogen phosphate by the electrochemical impedance spectroscopy (EIS) method and the results are shown in Fig. 4. It can be observed (Fig. 4a) that both anodes produced a single capacitive loop at all frequencies, indicating that the electrode/electrolyte interface is controlled predominantly by activation-controlled processes. The pure Mg exhibited a significantly larger capacitive loop diameter in the Nyquist plane compared with the Mg AZ31 alloy, suggesting a better anti-corrosion behaviour. In the Bode plot coordinates (Fig. 4b), the pure Mg exhibited higher impedance values compared with Mg AZ31 alloy, indicating a different corrosion rate, however, with a possible similar mechanism.

Fig. 4
figure 4

The EIS spectra presented in a Nyquist plot and Bode plot coordinates, recorded in 0.10 M ammonium dihydrogen phosphate on pure Mg (black symbols) and Mg AZ31 alloy (red symbols) at the EOCP (−1.9 V vs. RHE for pure Mg, −1.65 V vs. RHE for Mg AZ31 alloy) and at RT

Based upon the Nyquist plots (Fig. 4a) from the intercept on the x-axis at higher frequencies, we estimated a polarization resistance (Rp) of ~6 kΩ for the pure Mg and ~1 kΩ for the Mg AZ31 alloy, respectively; however, it was difficult to model the semi-circles and not possible to fit a circuit to determine the Rp values accurately. This was attributed to the dynamically changing surface of the anode during the experiment as seen previously, where the solids produced accumulate on the magnesium, thus increasing the surface complexity of the anode. The noise observed at low frequencies (Fig. 4a) for pure Mg may be attributed to gas bubble formation on the surface of the electrode (results not shown here) during the EIS experiments, which is also expected to have a significant impact on the Rp values as well. Zhang et al. elegantly showed that the layer of gas bubbles on the surface of the electrode represented a significant energy barrier, which ultimately increased resistance [47]. Therefore, the reported Rp values here should be considered as relative values, i.e., a comparison between the two anode types, rather than absolute values.

To further understand the mechanism of the electrochemical reactions occurring on the Mg-based electrodes in 0.10 M ammonium dihydrogen phosphate, polarization curves were generated as shown in Fig. 5, where two approaches were adopted: (A) the anodic and cathodic E vs. log (j) branches were generated separately from the corresponding anodic LSV (from the rest potential to +2.5 V vs. RHE), and cathodic LSV (from the rest potential to −3.0 V vs. RHE) with a cleaning step in between, and (B) the E vs. log (j) plots were obtained from a full LSV scan starting from −3.0 to +2.5 V vs. RHE. The Tafel plots were obtained after electrochemical measurements, where the corrosion potential (Ecorr) and the corrosion current (Icorr) were generated from the Tafel plots i.e., log (j) vs. E (see Fig. 5).

Fig. 5
figure 5

Potentiodynamic polarization (PDP) curves (Tafel plots-log (I) vs. E) for bare Mg and Mg AZ31 alloy in 0.10 M ammonium dihydrogen phosphate on Mg and Mg AZ31 alloy at RT (data generated from the LSVs at a scan rate of 1 mV s−1). Two approaches were adopted: a the anodic and cathodic E vs. log (j) branches were generated separately from the corresponding anodic LSV (from the rest potential to +2.5 V vs. RHE) and cathodic LSV (from the rest potential to −3.0 V vs. RHE) with a cleaning step in between, and b the E vs. log (j) plots were obtained from a full LSV scan starting from −3.0 V vs. RHE to +2.5 V vs. RHE

The corrosion rate was estimated according to the following equation:

$${v}_{\mathrm{corr}}=\frac{{I}_{\mathrm{corr}} \times K \times EW}{\rho \times A}$$
(3)

where vcorr is the corrosion rate in millimetre per year (mm year−1), K is a constant that defines the units of the corrosion rate (K = 0.0254), EW is equivalent weight (g eq−1), ρ is the density (g cm−3) (for pure Mg (ρ = 1.74 g cm−3) and Mg AZ31 alloy (ρ = 1.80 g cm−3)), and A is the geometrical area of the electrode (cm2). Table 1 shows the corrosion current density (jcorr), the corrosion potential (Ecorr), Tafel slopes (βa and βc) and corrosion rate (vcorr) for Mg and Mg AZ31 alloy in 0.10 M ammonium dihydrogen phosphate at RT.

Table 1 The corrosion data obtained for the Mg-based disc electrodes in 0.10 M ammonium dihydrogen phosphate at RT

The results show that the Mg AZ31 alloy exhibited significantly higher jcorr values compared with pure Mg, suggesting a higher Mg dissolution rate from the respective electrode materials. Moreover, significant changes in the jcorr data can be observed by studying method A vs. method B for the same electrode material type (Table 1). These changes can be attributed to the passive surface film formation involving the oxidation of magnesium or struvite formation, which can further add to the complexity of the overall reaction kinetics and electron transfer process at the electrode surface [37, 41,42,43]. The higher vcorr values can be explained by the presence of impurities such as Al and Zn atoms present in the AZ31 alloy, which changes the surface morphology, thus making the alloy more vulnerable to galvanic or bimetallic corrosion. These impurities may act as local cathodes at the grain boundaries, thus promoting a small, more uniform pitting on the surface of the alloy [35]. The calculated cathodic and anodic Tafel slopes (βc and βa) show a direct correlation with the Mg type used, where slopes generally increased when the pure Mg anode was used. These shifts in Tafel slope values usually indicate changes to the reaction mechanism or changes in the rate-limiting step of the overall reaction, as well as the overall reaction kinetics.

The study then turned to a more detailed investigation of the corrosion potential (Ecorr), i.e., the potential where no net current is flowing in or out from the electrode for the pure Mg and Mg AZ31 alloy disc electrodes at various LSV scan rates. For these experiments, the LSVs of pure Mg and Mg AZ31 alloy disc electrodes in 0.10 M ammonium dihydrogen phosphate were recorded from −3.0 V vs. RHE to +2.5 V vs. RHE and stopped at that potential. It was observed (see Fig. 3) that after reaching the Ecorr, the current reached a plateau, a phenomenon which is mainly attributed to the formation of a passive hydroxide film, which ended when the current increased. This activation is often associated and commonly referred to as the pitting potential (Epit). At low scan rates (see Fig. 3) after passing the Epit potential, the current showed a decrease, which can be attributed to a secondary passivation [38]. A more detailed investigation of the Ecorr shift based on the scan rate is presented in Fig. 6a.

Fig. 6
figure 6

The obtained a corrosion potentials (Ecorr) and b pitting potentials (Epit) from a series of linear sweep voltammograms recorded at different scan rates: 1, 5, 10, 25, 50, and 100 mV s−1 (not shown here) on (1) pure Mg and (2) Mg AZ31 alloy disc electrodes in 0.10 M ammonium dihydrogen phosphate. The LSVs of pure Mg, and Mg AZ31 alloy disc electrodes in 0.10 M ammonium dihydrogen phosphate were recorded at RT from −3.0 V vs. RHE to +2.5 V vs. RHE and stopped at that potential

It can be observed that the Ecorr values obtained for the Mg AZ31 alloy were slightly more positive compared with the pure Mg at all scan rates, which can be attributed to the more positive equilibrium electrode potentials of the main impurities such as Al/Al3+ (EAl/Al3+  = −1.660 V vs. SHE) and Zn/Zn2+ (EZn/Zn2+  = −0.760 V vs. SHE) present in the alloy composition. The pure Mg electrode exhibited a gradual shift in the Ecorr towards more negative potential with the increase of scan rate (Fig. 6a). On the other hand, the Mg AZ31 alloy at low scan rates showed an opposite trend with a shift towards more positive potentials, while at higher scan rates (25, 50, and 100 mV s−1), the Ecorr shifted towards more negative potentials. The Epit obtained based on the scan rate is showed in Fig. 6b, where the pure Mg electrode shows a random shift, while the Mg AZ31 alloy shows a gradual increase towards more positive potentials. The change in the Ecorr and the Epit with the scan rates can be explained by the phenomenon known as the negative difference effect (NDE), a characteristic to magnesium, where during anodic polarization, Mg corrosion is followed with a significant release of hydrogen, a cathodic reduction reaction [40,41,42,43]. The formation of the precipitate layer on the Mg discs’ surface during the LSV experiments may also influence the obtained Ecorr and Epit, respectively.

Concentrations of the ionic species (Mg2+, Na+, and Cl) present in the test solution after the experiments were investigated by ionic chromatography (IC) analysis, and the results are presented in Fig. 7, where all three of the ionic species were detectable. The presence of Mg2+ is mainly attributed to the oxidation of the Mg-based sacrificial electrode as discussed earlier, and the higher concentration obtained for the Mg AZ31 alloy (62.7 ppm) is in good agreement with the higher jcorr and vcorr values obtained in Table 1 compared with the pure Mg electrode. On the other hand, the presence of Na+ and Cl in small traces is somewhat surprising; however, the 1:1 ratio would suggest that these ions originate from the reference electrode filling solution (3 M NaCl) leaked through the glass frit. It should be noted that the presence of chloride ions (Cl) in the solution may have an adverse effect on the Mg dissolution rates, and on the struvite film formation. However, based upon the XRD and XPS spectra (see later), neither Na+ nor Cl were observed into the formed precipitates.

Fig. 7
figure 7

Concentrations of the ionic species present in the solution after the experiments performed with pure Mg and Mg AZ31 alloy as the anode, determined by ionic chromatography analysis

The phosphorus removal efficiency as struvite using each of the two different anodes was calculated after the LSV study at 1 mV s−1 using the following equation:

$${P}_{\mathrm{Rem}}=\frac{\left({C}_{0}-{C}_{t}\right)}{{C}_{0}} \times 100\%$$
(4)

where PRem is the phosphorus removal efficiency (%), C0 is the initial phosphorus concentration (mg L−1), and Ct is the phosphorus concentration at time t (mg L−1). The results based on the IC analysis showed a phosphorus removal efficiency (PRem) of 16.8% for pure Mg anode and 17.2% for Mg AZ31 alloy, respectively. On the other hand, based upon the chemical reactions discussed earlier, concomitantly with struvite, molecular hydrogen production should occur as well. During the LSV experiments, the amount released was estimated at ~61 mL for Mg AZ31 alloy and ~53 mL for pure Mg.

Struvite Analysis

Scanning Electron Microscopy

The precipitates formed on the bare Mg disc after the LSV experiments (in the potential range of −3.0 V vs. RHE to +2.5 V vs. RHE) in 0.10 ammonium dihydrogen phosphate at various scan rates and RT were studied and analysed by SEM, and the results are shown in Fig. 8. It can be observed that the precipitates uniformly covered the discs, and as expected, the thickness of the precipitates was influenced by the applied scan rate. At all scan rates, the high-resolution SEM images (Fig. 8 insets) show a morphology indicating the formation of a deposit, with a needle-shaped elongated structure and smooth, sharp edges. From our previous observations using lab-scale and scaled-up batch reactors, this deposit corresponds to struvite [34,35,36]. It should be noted that bubble formation, most likely hydrogen, was visually observed on the discs during the LSV runs in the negative potential range, especially at low scan rates [45]. This bubble formation may also influence the precipitate formation (see Fig. 8b), where the deposit’s thickness was negatively impacted.

Fig. 8
figure 8

SEM images of the precipitate film obtained on the surface of a pure Mg disc after LSV runs in 0.10 M ammonium dihydrogen phosphate at RT and various scan rates: a 1, b 5, c 10, d 25, e 50, and f 100 mV s−1. The LSVs of pure Mg disc electrode in 0.10 M ammonium dihydrogen phosphate were recorded from −3.0 V vs. RHE to +2.5 V vs. RHE and stopped at that potential. Insets: High-resolution SEM images showing the change in the precipitate structure based on the applied scan rate

Next, the precipitates formed on the Mg AZ31 alloy discs from the LSV experiments, performed in 0.10 M ammonium dihydrogen phosphate at RT and various scan rates, were analysed by SEM, see Fig. 9. At high scan rates (25, 50, and 100 mV s−1), see Fig. 9d–f, the precipitates produced typical struvite morphologies, with elongated needle-shaped patterns and sharp, smooth edges. On the other hand, at low scan rates (Fig. 9a–c), the morphology changed significantly to a more compact and uniform layer. These findings are in excellent agreement with the results obtained by our group, where the formation of struvite layer was obtained in a bench-scale electrochemical batch reactor with no energy input, by simply monitoring the open circuit potential (OCP) [36]. It was also observed that the formation of this compact layer was attributed to the impurities such as Zn and Al, which were homogeneously distributed throughout the alloy structure. These impurities considerably limit the Mg atoms to form a localized supersaturation, thus delaying the nucleation process and slowing down the crystal growth rate. Moreover, the presence of Zn and Al atoms make the alloy less reactive, thus negatively influencing the (hydrogen) bubble formation on the disc during the LSV runs at negative potentials.

Fig. 9
figure 9

SEM images of the precipitate films obtained on the surface of a Mg AZ31 alloy disc after LSV runs in 0.10 M ammonium dihydrogen phosphate at RT with various scan rates: a 1, b 5, c 10, d 25, e 50, and f 100 mV s−1. The LSVs of Mg AZ31 alloy disc electrodes in 0.10 M ammonium dihydrogen phosphate were recorded from −3.0 V vs. RHE to +2.5 V vs. RHE and stopped at that potential. Insets: High-resolution SEM images showing the change in the precipitate structure based on the applied potential scan rate

Precipitate Morphology

The deposits formed on the pure Mg and Mg AZ31 alloy discs, from the LSV experiments carried out at 1 mV s−1 and recorded from −3.0 V vs. RHE to +2.5 V vs. RHE were further characterized using XRD and XPS to study the morphology of the crystal structure of the precipitates. For these studies, the deposits were left on the discs, which were carefully stored; therefore, the initially formed crystal structure was not altered; however, it is expected that the Mg substrate would have an influence (interference) on the obtained spectra.

The crystal morphology of the obtained precipitates was characterized by XRD, and the results are shown in Fig. 10. The XRD patterns of the precipitates obtained on the Mg and Mg AZ31 alloy disc electrodes showed no differences in the peak positions. Moreover, there were no new diffraction peaks observed when compared with the standard pure struvite (PDF card no. 01-077-2303) and even the commercially available struvite (Crystal Green), suggesting that in our conditions, the recovered precipitates from the Mg disc electrodes were mainly struvite. Interestingly, the electrochemically obtained struvite films on both the pure Mg and the Mg AZ31 alloy discs showed no characteristic diffraction peaks between 10 and 25° (2θ) compared with the standard and commercially available struvite, which would suggest a slight difference in the crystallite morphology. On the other hand, the well-defined diffraction peaks seen at 57° (2θ) for the precipitates obtained with the pure Mg and Mg AZ31 alloy discs (Fig. 10 (3,4)) can be attributed to the Mg substrate.

Fig. 10
figure 10

XRD patterns of (1) standard pure struvite (PDF card no. 01-077-2303), (2) commercially available struvite (Crystal Green), and struvite produced electrochemically during the LSV experiments in 0.10 M ammonium dihydrogen phosphate on the surface of (3) pure Mg, and (4) Mg AZ31 alloy disc electrodes. The LSVs of pure Mg and Mg AZ31 alloy disc electrodes in 0.10 M ammonium dihydrogen phosphate were recorded from −3.0 V vs. RHE to +2.5 V vs. RHE (and stopped at that potential) at a 1mV s−1 scan rate

The chemical composition of the electrochemically obtained precipitate, and the chemical morphology of the elements consisting of struvite was analysed by XPS. The survey spectra were obtained over the energy range of 0–1400 eV, as shown in Fig. 11a, b, and indicated the core level photoelectron and Auger electron peaks of Mg 1 s (1304.9 eV), Mg KLL (352 eV; 306 eV), Mg 2 s (89 eV), Mg 2 p (50 eV), O KLL (1001.4 eV; 978 eV), O 1 s (531.4 eV), N 1 s (385.1 eV), N 2 s (37 eV), C 1 s (284.5 eV), P 2 s (191 eV), and P 2 p (133.1 eV). It should be noted that in the case of the precipitates formed on the Mg AZ31 alloy, additional peaks were observed: O KLL (1020.9 eV), Al 2 s (120.9 eV), and Al 2 p (75.9 eV), see Fig. 11b. The presence of the Al peaks in the XPS diagrams can be attributed as an interference from the substrate which contains 3% wt in its composition. It is expected that the film thickness in this case would not be more than a few nanometre thick; consequently, the XPS most probably penetrated the substrate was well. Furthermore, the precipitates collected from the alloy surface performed previously by our group showed no evidence of Al contamination in their XPS spectra [34]. Overall, based upon the XPS study, the precipitates showed a high degree of similarity with the XPS survey reported previously by our group using a small lab-scale, scaled-up batch reactor, respectively, and with the chemically precipitated struvite (Crystal Green) [34, 35].

Fig. 11
figure 11

The XPS diagrams obtained with the electrochemically obtained precipitates on the a pure Mg and b Mg AZ31 alloy disc after the LSV experiments in 0.10 M ammonium dihydrogen phosphate. The LSVs of pure Mg and Mg AZ31 alloy disc electrodes in 0.10 M ammonium dihydrogen phosphate were recorded from −3.0 V vs. RHE to +2.5 V vs. RHE (and stopped at that potential) at a 1mV s−1 scan rate

The elemental mapping, see Fig. 12, revealed a homogeneous distribution of the significant elements (Mg, P, and N) on the struvite crystal surface. The homogeneous distribution further confirms the good quality of the obtained precipitates.

Fig. 12
figure 12

The superimposed elemental map of the precipitate showing the contact of the three elements and EDX elemental mapping of Mg, N, and P of the struvite precipitate formed on the surface of the ad pure Mg and ef Mg AZ31 alloy disc electrode, respectively, during the LSV run. The LSVs of pure Mg and Mg AZ31 alloy disc electrodes in 0.10 M ammonium dihydrogen phosphate were recorded from −3.0 V vs. RHE to +2.5 V vs. RHE (and stopped at that potential) at a 1 mV s−1 scan rate

pH Effects

The pH difference in the bulk solution measured before and after the LSV runs at 1 mV s−1 in 0.10 ammonium dihydrogen phosphate with the pure Mg and Mg AZ31 alloy disc electrodes is shown in Fig. 13. For the pure Mg and Mg AZ31 alloy, a pH increase of 0.49 units and 0.57 units, respectively, was observed. It is evident that Mg-based electrode materials engage in chemical reactions and corrosion (see earlier). Studies have shown that during electrochemical struvite precipitation, there is an increase in the local pH at the electrode surface due to electrochemical reduction of dissolved oxygen or water molecules, and it is expected that this local pH could influence the bulk pH over time [44].

Fig. 13
figure 13

The pH difference in the bulk solution measured in 0.10 M ammonium dihydrogen phosphate with various working electrodes (pure Mg and Mg AZ31 alloy disc electrode, respectively) in a conventional three-electrode cell system

Conclusions

Struvite formation mechanism on pure Mg and Mg AZ31 alloy electrodes immersed in 0.10 M ammonium dihydrogen phosphate was investigated electrochemically. It was found that the Mg AZ31 alloy electrode exhibited higher corrosion current densities, and thus higher Mg dissolution rates and corrosion rates when compared with pure Mg. It was also observed that the presence of other elements in the Mg alloy might affect Mg dissolution rates. The shifts in Tafel slopes had a direct correlation with the Mg material type used and were mainly attributed to changes in reaction mechanism or/and in the rate-limiting step of the overall reaction kinetics. Results also showed higher phosphorus removal efficiencies and H2 yields for Mg AZ31 alloy than for pure Mg. It was found that the struvite morphology and the deposit thickness were affected by (i) the applied potential scan rate and (ii) molecular hydrogen bubble formation, while an increase in the local pH at the electrode surface was possible due to the electrochemical reduction of dissolved oxygen or/and water molecules, which over time, could influence the bulk pH.