Optimization of Espresso Spent Ground Coffee Waste Extract Preparation and the Influence of its Chemical Composition as an Eco-friendly Corrosion Inhibitor for Carbon Steel in Acid Medium

This work proposes the reuse of spent ground coffee waste (SCG) extracts as eco-friendly corrosion inhibitors for carbon steel in acid medium, and the correlation between their anticorrosive efficiency and chemical composition. The extraction method was optimized using a central composite design, and the chemical composition of the extracts was accessed using UV-Vis spectrometry, HPLC, and ICP-OES. EIS and Potentiodynamic Polarization (PP) tests evaluated the anticorrosive properties of the extracts. Total phenol content ranged from 93 mg L-1 to 219 mg L-1 Gallic Acid Equivalent. The highest concentration of phenolic compounds was observed for syringic acid (78.67 mg L-1), while the lowest concentration was verified for (-)-epigallocatechin-3-O-gallate (0.01 mg L-1). The Pearson correlation coefficient showed no correlation between the Rct and the total phenol content, although, positive correlations with the Rct was observed for caffeic acid, (+)-catechin, ferulic acid, and protocatechuic acid. EIS analysis revealed that all of the extracts could act as corrosion inhibitors. The best performance was verified for C3 extract (IE % = 94.83%). PP tests showed that this extract acted as a mixed inhibitor, with a predominant cathodic effect. Therefore, the valorization of the extracts as corrosion inhibitors was successfully achieved.


Introduction
Coffee in capsules has gained popularity as a straightforward way to prepare this beverage. However, this method has led to the production of a large amount of waste containing polymeric materials, metals, and coffee residues. 1,2 Different works have addressed their attention to the treatment of polymeric and metallic waste from coffee in capsules 3 , while the spent coffee grounds (SCG) have been applied as adsorbers, 4 filters, and additives for polymer composites 5,6 , supplement in animal feed, among others 7 . It is possible due to SCG water and oil holding capacity and its vast composition that presents compounds such as caffeine, tannins, flavonoids, and trace elements 8 . Also, it may include oils, crude fiber, alkaloids, proteins, minerals, phenols, among others, 7 depending on the variety of coffee beans, the roasting process, and the extraction method. Moreover, this material has been reported for a high concentration of inorganic components (K, Mg, P, Ca, Na, Fe, Mn, and Cu). 9 Also, the value of SCG has already been demonstrated in biodiesel production, cosmetic industry, renewable energy, as a source of sugars, a precursor for activated carbon production, compost, sorbent for metal ions removal and for the extraction of many organic compounds. 3,10,11 Given the vast chemical composition of the SCGs, their extracts may present the potential to be applied as corrosion inhibitors for carbon steel in acid solutions. These solutions are used in the cleaning and pickling processes of metallic structures, causing the dissolution of the metal. Although the use of corrosion inhibitors is the most common method applied to protect these metals, the toxicity of regular inhibitors has led to the search for new green corrosion inhibitors, which are mostly obtained from natural products, therefore considered eco-friendly, relatively harmless upon disposal, and where the natural products from the food industry may be valorized. 12 By-products containing organic substances, such as phenolic compounds, alkaloids, and tannins, may be useful as corrosion inhibitors in several corrosive media as they may be adsorbed onto the metal's surface. 13,14 In the case of SCGs, the use of caffeine as an inhibitor has already been tested for different metals and alloys, 15,16 and studies using specifically coffee extracts have shown their efficacy as a corrosion inhibitor for C-steel in a 1 mol L -1 HCl solution. 17 In order to apply the SCGs as a corrosion inhibitor, an extract must be prepared. Solid-liquid extraction is the most widely used procedure for the extraction of organic substances in botanical materials due to its easy use, efficiency, and wide range of applicability. 18,19 Different organic solvents and their combination, as well as the combination of organic solvents and water, may be applied. Other factors such as pH, temperature, sample mass, and extraction time may be studied, as well as sequential steps in order to maximize the extraction. 12,20 In most of the studies concerning the production of eco-friendly corrosion inhibitors extracts, however, the extraction parameters are chosen randomly or based in univariate experiments 17,[21][22][23] . These procedures are time-consuming, and a large number of experiments are generally needed to perform the extraction. Moreover, as only one of the parameters is varied at each time, the optimum conditions obtained using these procedures may not represent the best conditions to obtain the polyphenols. The use of an experimental design matrix, where all parameters are varied simultaneously, could decrease the number of experiments and offer optimized conditions to produce extracts 24 .
Therefore, this work aims to optimize the procedures to produce SCG extracts containing the active organic compounds that can be applied as corrosion inhibitors. Also, it is proposed an investigation concerning the correlation between the chemical composition of this extract and its efficiency as a corrosion inhibitor for carbon steel in acidic medium.

Samples
Eight different samples of coffee capsules were obtained from a local supermarket, and the samples were stored at room temperature until their extract preparation. The coffee capsules are composed of a small polymer pod capped with aluminum foil, which is filled with grounded coffee. The SCGs were obtained after the preparation of coffee using an espresso coffee machine. The samples encompass different coffee brands that differ among each other in variety and coffee preparation. These samples were named C1, C2, C3, C4, C5, C6, C7, and C8.

Extract preparation
The extracts of the SCGs were obtained in triplicate, after the optimization of the sample preparation, using only ultrapure water, heating, and shaking. An amount of 2 g of each sample was placed into a polytetrafluoroethylene (PTFE) flask, mixed with 40.00 mL of water, and shaken for 13 min at 80ºC. The extracts were filtered in a vacuum system and stored at -20 o C.

Total phenol determination
The total phenolic content was determined using a UVvisible spectrophotometer (Cary 60, Agilent Technologies, Germany) according to the method described by Singleton and Rossi. 25 Gallic acid was used as a standard and its concentration ranged from 5 to 70 μg/mL in the analytical curve. The extracts were diluted with ultrapure water 1:10 (v/v). 200 μL of both each diluted extract and the standard were pipetted into a round flask, and then 1400 μL of ultrapure water and 100 μL Folin-Ciocalteu's reagent were added. The flasks were shaken and 300 μL of 20% (w/v) aqueous sodium carbonate solution was added after the resting time of 30 s. The resulting solution was shaken and placed onto a water bath for 30 min at 40°C. The absorbance was measured at 765 nm.
The phenolic compounds were quantified using the method developed by Burin et al. 26 with modifications. The compounds were eluted using a gradient elution program and a binary mobile phase. Mobile phase A consisted of ultrapure water:acetic acid 98:2 (v/v) and mobile phase B was composed of acetonitrile:mobile phase A 80:20 (v/v), with the flow rate set at 1.0 mL min -1 . The gradient elution conditions were: 0-30% B in 25 min, 30-50% B in 5 min, 50-100% B in 5 min, 100% B held over 5 min and 0% B in 1 min. The detection was set at 254 nm for protocatechuic acid, ellagic acid, quercetin and kaempferol, at 280 nm for syringic acid, (+)-catechin, (-)-epicatechin and (-)-epigallocatechin-3-Ogallate, and at 320 nm for caffeic, ferulic, chlorogenic, transcaftaric and p-coumaric acids.
The quantification of individual phenolic compounds was carried out using matrix-matched calibrations. Standard solutions of each phenolic compound were used for the construction of analytical curves and comparing the peak areas of the analytes with their respective standards. All determinations were performed in triplicate.

Inorganic composition
The multi-element determination was performed using an Inductively Coupled Plasma Optical Emission Spectrometry (ICP OES) model iCAP 6000 Series (Thermo Scientific).

Electrochemical tests
All of the electrochemical evaluations were performed in duplicate using a potentiostat/galvanostat (model Autolab PGSTAT 302N). The solutions used for these experiments were prepared in a volumetric flask by the addition of 20.00 mL of the extracts and 9.3 mL of 12.3 mol L -1 HCl. The volume was made up to 100.00 mL with ultrapure water to produce extracts with concentrations of 20% v/v in 1.0 mol L -1 HCl solution. A 1.0 mol L -1 HCl solution, without the extracts (Blank test), was also prepared for comparison purposes. Therefore, the electrolyte was the acidic solution containing or not (blank test) the extracts at 20% (v/v).
For all of the experiments, a three-electrode cell was used, at 25 °C, in which 1020 carbon steel (composition wt. %: C = 0.18; P = 0.04; S = 0.05; Mn = 0.30; and Fe = balance) was the working electrode (average area = 1.8 cm 2 ), a saturated calomel electrode was the reference electrode and a platinum spiral was used as the counter electrode. The steel electrodes were sanded with 100 to 600-grade emery paper, washed with water and alcohol, and finally dried with warm air. The platinum spiral was immersed in a 20% (v/v) HNO 3 solution for 1 minute to remove any oxide layer that could be present.
The steel samples were immersed in the electrolytic medium, in the absence or presence of the inhibitory SCG extracts for about 1 h, and during this period the stabilized open circuit potential (OCP) was achieved. When the potential variation was less than 5 mV for, at least, 30 min, this value was considered as the OCP used for the electrochemical experiments. Therefore, all of the electrochemical experiments were performed after the OCP stabilization for approximately 30 min.
The Electrochemical Impedance Spectroscopy (EIS) measurements were carried out using a potential sinusoidal perturbation with an amplitude of 10 mV, in a frequency range between 10 -3 Hz and 10 5 Hz. The results were simulated using the software Nova ® (Metrohm Autolab). The corrosion inhibition efficiency (IE%) was calculated using charge transfer resistance (R ct ) values, obtained from the EIS tests, according to Equation Where R ct and o ct R are the charge transfer resistances for the systems in a 1.0 mol L -1 HCl solution, in the presence and absence (Blank experiment) of the inhibitor, respectively.
Based on these results, potentiodynamic polarization (PP) tests for the carbon steel immersed in the same corrosive medium in the absence (Blank experiment) and the presence of selected SCG extracts were performed. The system was stabilized at open circuit potential for 30 min, and the polarization experiments were performed by varying the potential between ± 250 mV around OCP, using a scanning speed of 1 mV s -1 . Tafel parameters were obtained from the polarization curves using GPES 4.9 software. IE % values were also calculated using the corrosion current densities (j corr ) obtained from the potentiodynamic polarization curves by the Tafel extrapolation method (Equation 2) 21 . j corr,0 and j corr are the corrosion current density values obtained for the system in the absence and the presence of the inhibitor extract, respectively.

Morphological characterization
Scanning electron microscopy (SEM) was performed using a microscope JEOL/EO JSM-6510, Version 1.0, to evaluate the surface morphology of the selected specimens after the immersion of the samples in HCl 1.0 mol L -1 for 24 h, in the absence and presence of coffee extracts (Sample C3). Before the analysis, the specimens were cleaned with alcohol, dried with warm air, and adapted to the stub. SEM analysis was performed using secondary electron mode (SE), with beam acceleration of 20 kV and magnification of 1000X.

Data treatment
All data treatment was carried out using the Software R 27 and the packages corrplot 28 , and qualityTools 29 .

Extract optimization
Given the deleterious effects for the environment that arises from the use of organic solvents, the extraction procedure was optimized using only purified water. Sample mass, temperature, and time of extraction were optimized for the maximum extraction of total phenols, considering that this parameter has been related to the anticorrosive performance of the natural corrosion inhibitors. 30 The domain of the factors sample mass, time, and temperature were optimized using a central composite design (CCD). This procedure is highly efficient and provides sufficient information on the effect of process variables for a resourceful optimization. 31 The experimental design consisted of eight factorial points (2 3 ), six axial points, and five replicates of the central points. The experimental planning is presented in Table 1. The sample mass and the temperature were statistically significant (p<0.05), as well as the quadratic terms for temperature, time, and sample mass.
The residues of the optimization results were proven to follow a normal distribution according to the Shapiro-Wilk test (p>0.05), and the R-Squared obtained for the model was 0.8609. Figure 1 presents the surface response obtained using the built model, and the optimized extraction condition was obtained at 2 g of sample, 13 min, and 80 o C for a volume of 40.00 mL of water.
Three samples (C2, C5, and C7) were analyzed in triplicate using the proposed extraction method and a standard method (as a comparison) described by Lapornik et al., 32 where 50 g of the sample was mixed with 100 mL of the extraction solution composed by ethanol/water 70% (v/v) and shaken for 12h.
Lapornik et al., 32 have proposed that ethanol is crucial for the extraction of phenolic substances in grapes. However, after the proper optimization of the sample preparation parameters, it was possible to obtain a straightforward method relying only on the use of water as an extraction solution, sample mass of about 2 g, and extraction time of only 13 min for the total phenol extraction in SCG.

Chemical extracts composition
In order to access the composition of the extracts obtained from the SCG, the extracts of the samples were analyzed regarding the total phenolic content via molecular absorption spectrometry, individual phenolic compounds via HPLC-DAD, and element content using ICP OES. Table 2 presents the chemical composition of the samples, where it is possible to observe a considerable variation in concentration for total phenols, ranging from 93 mg L -1 (C8) to 219 mg L -1 GAE (C7). For the individual phenolic compounds, the highest concentration was observed for syringic acid, in sample C7 (78.67 mg L -1 ), while the lowest concentration was observed for (-)-epigallocatechin-3-Ogallate, in sample C3 (0.01 mg L -1 ). The inorganic composition also presented a large variation among the samples, ranging from 21.121 mg L -1 for Mg, in sample C6, to 0.010 mg L -1 for Ba in samples C2 and C4.
This variation in chemical composition among the samples arises from different factors, such as the origin of the sample (species and variety), soil and climate conditions, cultivation of the coffee, industrial processing, and also, how the coffee was prepared.
The main phenolic compounds found in coffee are the chlorogenic acids, which include a large group of compounds that are, in the majority, synthesized by esterification of a C 6 -C 3 trans-hydroxycinnamic acid with 1L-(−)-quinic acid, such  as p-coumaric, caffeic and ferulic acids 17,33 . These phenolic acids were indeed found in all SCG samples and, together with (+)-catechin and (-)-epicatechin, the hydroxybenzoic and hydroxycinnamic acids, were the most abundant polyphenols in samples. These compounds are commonly denoted as bioactive compounds and are responsible for the antioxidant activity of vegetable matrices. 34 The chemical composition of SCG extracts produced using different extraction methods has been explored in the literature. Different works show a recovery of up to 77.2 mg GAE g -1 of total phenolics compounds, 2.00 μmol g -1 of caffeic acid, 0.17 μmol g -1 of ferulic acid, 0.24 μmol g -1 of p-coumaric acid 33 and 8.29 mg Quercetin Equivalent g -1 of Flavonoids 35 . Regarding the mineral composition of the extracts, the work of Conde and Mussatto 35 states that it was possible to recover of 0.74 mg g -1 of Mg, demonstrating that, in this work, a higher recovery was accomplished.
Considering the chemical composition of the SCG samples, particularly their phenolic constituents, and the aim of proposing interesting reuse for SCG, we further evaluated the anticorrosive properties of their extracts.

Corrosion inhibition assay
Plant extracts are rich in different chemical compounds that may affect the corrosion rate by adsorption of antioxidant species on metal surfaces. Therefore, all of the SCG extracts were evaluated as corrosion inhibitors by using EIS.
The Nyquist diagrams (Figure 2) show the EIS results of the carbon steel in 1.0 mol L -1 HCl in the presence or absence (Blank test) of the coffee extracts. From these diagrams, it is possible to obtain information about the capacitive or resistive behavior of the metal/medium interface. The extract-free solution (Figure 2A) shows only one depressed capacitive loop, which can be attributed to the time constant of the charge transfer and the double-layer capacitance. Depression is characteristically observed in solid electrodes and can be related to dispersing effects, which are ascribed to the roughness and non-homogeneity of the steel surface during the corrosion process 17,22 . This effect was not changed by the presence of the inhibitor, as shown in Figure 2B, indicating that the activation-controlled nature of the reaction is a single-charge transfer process 22,23 .
The diameter of the semicircle of the capacitive loop can be employed to evaluate the corrosion resistance of the metal/medium system. The intersection of this semicircle with the Z ' axis at low frequencies shows the R ct values. Higher values of R ct indicates that less intense is the corrosion process of the metal in the studied medium. As can be seen in Figure 2B, all of the assays containing the coffee extract presented higher capacitive loop diameters than that verified in the absence of the extract (Blank test). These results indicate that more resistive films were formed on the carbon steel surface in the presence of the aqueous coffee extracts studied. The best anticorrosive protection conferred on carbon steel in 1.0 mol L -1 HCl was obtained with the use of aqueous extract C3, while the worst was verified for aqueous extract C2.
The Bode plots are presented in Figure 3. The Z modulus diagram ( Figure 3A) shows that the presence of the inhibitory extracts in the corrosive medium enhanced impedance modulus at low frequency. Moreover, the curves of the samples were shifted to higher frequency values, which is also an indication of anticorrosive protection 36 . Although there are few differences, the C3 extract presented the highest |Z| values at low frequency among all of the curves. Considering the phase plot ( Figure 2B), only one phase angle These results confirmed the metal surface protection in the presence of SCG extracts, probably due to the adsorption of the polyphenol compounds 37 .
The data obtained in the EIS assays were simulated using the equivalent electric circuit model 21,38 presented in Figure 4, and the simulation results are presented in Table 3, while the simulated curves are also shown (full line) in Figures 2 and 3. In this circuit, R s represents the solution resistance, R ct is the charge transfer resistance, and CPE is the constant phase element (represented by Q and N) associated with the electrical double layer capacitance. Considering the inhomogeneities of the steel surface 17,22 , as mentioned earlier when discussing Figure 2A, a CPE element was used in this work instead of a capacitor. Therefore, this circuit was chosen because a surface time-constant distribution could represent the physical state of the steel surface in the studied corrosive medium more faithfully 39 . The simulation adjustment for each simulated parameter was considered satisfactory for an error value of less than 5% (χ 2 smaller than 1%). 40 The IE % values, calculated using Equation 1, as well as the double-layer capacitance (C dl ), calculated using Equation 3 39 , are also shown in this table.
( ) The results presented in Table 3 confirm the observations from the Nyquist diagrams (Figure 2) that the presence of the SCG extracts in the corrosive HCl medium decreased the corrosion process of the substrate and the inhibition   Table 3. R ct , R s , and CPE (Q and N) values obtained after the simulation of the EIS data for 1020 carbon steel in 1 mol L -1 HCl solution, in the absence and presence of SCG extracts. IE % and C dl values, calculated using Equations 1 and 3, respectively, are also presented.

Simulated results
Calculated results R s (Ω cm -2 ) Where ε o is the permittivity of the air, ε is the local dielectric constant, S is the exposed area, and d is the thickness of the inhibitor film on the surface of the electrode.
As the polyphenols present in the extracts adsorbed on the electrode, the surface area exposed to the corrosive medium decreased, reducing the corrosion process. Moreover, the gradual replacement of water molecules by organic compounds at the metal/electrolyte interface may lead to a thicker electric double layer and cause a diminution in the local dielectric constant. All these factors could have contributed to the C dl values reduction when the SCG extracts were added to the corrosive medium 42 .
Among all the samples studied, the highest R ct and, consequently, IE% values were verified when the C3 and C6 extracts were used. As the extraction conditions were optimized in the present work, the inhibitory performances of these SCG extracts were superior to other eco-friendly inhibitors based on coffee-residues extracts, such as roasted coffee and coffee husks aqueous extracts produced by infusion 16,23 . Also, their anticorrosive efficiency was similar to those using ground coffee aqueous extract prepared by infusion 17 and coffee husks aqueous extracts obtained by decoction 21 , always using HCl 1.0 mol L -1 as the aggressive medium. Nonetheless, it is necessary to point out that these comparisons must be carried out carefully, because they do not consider several parameters, such as the different extraction techniques, the initial waste mass, and the amount of extract added to the aggressive solution, for example.
The Pearson correlation coefficient ( Figure 5) may be useful to correlate two variables; in this case, it may be used for correlating the chemical composition with the R ct . Positive correlation with the R ct was observed for caffeic acid, (+)-catechin, ferulic acid, and protocatechuic acid, while a negative correlation was verified for chlorogenic acid, (-)-epigallocatechin-3-O-gallate, (-)-epicatechin, and trans-caftaric acid. Unlike expected, however, no correlation was observed between the R ct and the total phenol content.
Organic corrosion inhibitors contain S, N, and/or O atoms and organic heterocyclic compounds with polar groups that adsorb and form a covalent bond on the metal surface, covering it with a thick film that consists of several monolayers. This film decreases the depolarization rate and also acts as a barrier by blocking anodic and cathodic active sites or by decreasing electroactive species transport rate to or from the metal surface. 37 The film is formed initially through Van Der Waals forces and stabilized by chemisorption, which consists of unshared electron pairs or "p" electrons from the heteroatoms and/or aromatic rings present in the organic compound interacting with the metal orbitals to form a coordinate-type bond. 37 The efficiency of the inhibitor is improved by the strength of the adsorption bond and with higher molecular weight, asymmetry, and electron density. The adsorption bond strength is determined by functional group steric factor, polarizability, and the electron density of donor atoms. 37 The literature also reports that the corrosion medium may affect this process. In HCl medium, the adsorption of chloride ions from the acid ionization on the surface of the carbon steel creates an excess of negative charges on the surface, favoring the adsorption of cations (protonated inhibitors), by the formation of a bridge between the surface of the positively charged steel and the protonated inhibitor molecules. 38,43 It is assumed that electrostatic interactions may also occur between the protonated molecules and the (FeCl -) adsorbed species at the anodic sites. 43 Polyphenols have a typical chemical structure derived from benzene, attached to a hydrophilic group, and its inhibitory action to the corrosion process can be attributed mainly to the presence of hydroxyl groups. Therefore, it could be considered that high R ct values are in line with the polyphenols content in the inhibitor extract. However, no correlation was found between the total phenol content and R ct values, according to Figure 3. Despite this, it can be speculated that the positive correlation of the R ct with some phenolic acids may arise from the size of the molecules that can allow a more straightforward approximation with the surface of the metal. On the other hand, larger molecules can present a steric hindrance, causing a decrease of the adsorption bond strength, and therefore having a negative correlation with R ct .
In agreement with this work, Torres et al. 17 observed that the results for the corrosion inhibition using coffee extracts did not seem to be caused by the presence of isolated chlorogenic acids. It is consistent with our observations regarding the individual phenolic composition of the SCG samples. Other phenolic compounds, particularly some major flavan-3-ols and flavonols were found in these samples, suggesting that many polyphenols may contribute to the anticorrosive properties of the coffee extracts.
Also, spent coffee extracts possess a high percentage of phenolic acids compounds linked to macromolecules such as melanoidins, which are high molecular weight compounds In this circuit, R s represents the solution resistance, R ct is the charge transfer resistance, and CPE represents the constant phase element. generated from the Maillard reaction 33 . De Souza et al. 16 showed that the isolated high molecular weight fraction has greater efficiency in inhibiting the corrosion than the roasted coffee extracts and attributed the inhibitory character of the extracts to the presence of melanoidins.
Therefore, considering the EIS results for steel immersed in HCl medium containing the SCG extracts (Figures 2 and 3, and Table 3), the chemical evaluation of the extracts ( Table 2), and the correlation diagram ( Figure 5), Samples C3 and C6 presented the highest contents of the compounds which showed a positive correlation with R ct (caffeic acid, (+)-catechin, ferulic acid, and protocatechuic acid), among the SCG samples studied in this work. It is reflected by the IE% values obtained when these extracts were added to the corrosive medium (Table 3). However, when these two samples were compared, C3 presented the lowest contents of those compounds that showed a negative correlation with R ct (chlorogenic acid, (-)-epigallocatechin-3-O-gallate, (-)-epicatechin, and trans-caftaric acid). Therefore, considering the joint effect of all of the compounds presenting positive and negative correlation with R ct , the addition of sample C3 in the corrosive medium led to a more efficient anticorrosive performance.
The polarization curves of the steel immersed in the acid medium containing the C3 extract is shown in Figure 6, while the parameters obtained from Tafel extrapolation is presented in Table 4.
As a whole, the potentiodynamic polarization curves ( Figure 6) show that the presence of the C3 extract in the corrosive medium caused a decrease in both the anodic and cathodic current densities, with a more pronounced drop in the cathodic branch. This result can be related to the adsorption of the organic compounds (polyphenols, organic acids, etc.) present in the extracts at the active sites of the electrode surface. As already mentioned, the process of adsorption of inhibitory molecules on the metal surface occurs by displacing the water molecules adsorbed on the metal surface by the molecules of the organic compounds 42 The results presented in Table 4 confirm the high inhibitory effect verified for this extract by the decrease of the corrosion current density (j corr ) when compared to the value obtained for the Blank experiment. The IE % value  (calculated using Equation 2) was 80%. Additionally, as can be seen from both Figure 6 and Table 4, the difference in the corrosion potentials (E corr ) of these curves indicates that the C3 extract acts as a mixed inhibitor because ΔE corr < 85 mV. 44 Therefore, both the metallic dissolution (Fe → Fe 2+ + 2e) and the hydrogen evolution (2H + + 2e ↔ H 2 ) processes were decreased, as also shown by the variations in the Tafel coefficients (β a and β c ) and, consequently, the corrosion process was slowed.
The cathode branch of the C3 polarization curve is in the form of Tafel lines, indicating that the hydrogen reduction reaction on the steel surface is carried out according to a pure activation mechanism 45 . When comparing to the Blank experiment, it is confirmed the decrease in the hydrogen evolution process by this extract.
In the anodic branch, at low potential values (from E corr to approximately -0.336 V SCE ), the presence of the C3 extract in the medium reduced the current densities values. In this potential range, the adsorption rate is higher than the desorption rate of the organic molecules, and therefore, the anode reaction is dominated by the adsorption of the organic compounds 45,46 . However, at potential values more positive than -0.336 V SCE (the desorption potential 45,47 ), there is an apparent increase in the current density values, suggesting that the mechanism of the anodic reaction was changed, leading to the desorption of the inhibiting molecules at the desorption potential 45,47 (in this case, -0.336 V SCE ) and an increase in the iron dissolution process [45][46][47] . Generally described as the corrosion inhibition of the metal with the formation of a protective layer of adsorbed species at the metal surface 46 , the occurrence of this phenomenon indicates that the inhibition mode of the C3 extract depends on the electrode potential. Figure 7 presents the surface morphology of carbon steel before ( Figure 7A) and after immersion in HCl 1.0 mol L -1 for 24 h, in the absence ( Figure 7B) and presence ( Figure 7C) of C3 SCGs extract, with a magnification of 1000x. Figure 7B shows a rough surface and corrosion products on the surface of the metal caused by the attack of the HCl solution in the absence of the inhibitor. Based on the substrate and the aggressive medium used in this work, it is possible that these corrosion products are composed mainly of iron oxides, although Zhao, Liang, and Li 48 have also found the presence of Cl on the surface of mild steel samples immersed in HCl medium for three hours.

Morphological characterization
A smoother surface can be observed when the specimen was immersed in the corrosive medium containing C3 spent ground coffee extract. Figures 7C indicates that the steel surface was protected by the inhibitory extract, which is in agreement with the results verified in the electrochemical Table 4. Electrochemical parameters obtained from Tafel extrapolation of the polarization curves of carbon steel in 1 mol L -1 HCl medium in the absence and presence of C3 aqueous SCG extract. The IE% results are also shown in this table. tests. It was possible to verify, therefore, that the SCG extract acted as a corrosion inhibitor for the carbon steel in a medium of HCl 1.0 mol L -1 .

Conclusions
A straightforward and eco-friendly method for the total phenol extraction in SCG was obtained, after the proper optimization of the parameter for the extract preparation, the results from which are in agreement with the standard method for the studied sample.
The organic and inorganic composition of different SCGs was obtained and compared among the samples, showing that the chemical composition is highly dependent on the coffee type. Apart from the main phenolic acids in coffee, important flavan-3-ols and flavonols such as (+)-catechin, (-)-epicatechin, quercetin, and kaempferol were identified in the sample extracts.
Although the chemical composition of the extracts varied, electrochemical impedance spectroscopy analysis revealed that all of the extracts might act as corrosion inhibitors, as high R ct values and low C dl values were always obtained. The IE % ranged from 89.16% (C2 extract) to 94.83% (C3 extract).
Potentiodynamic polarization tests confirmed that the C3 extract decreased the corrosion process of the carbon steel substrate in the HCl 1.0 mol L -1 solution. Although this extract acted as a mixed inhibitor, the inhibition of the cathodic reaction was more pronounced, while the anodic inhibition process seems to be dependent on the applied potential used.
The Pearson correlation coefficient has been applied for correlating the chemical composition and the R ct , presenting a positive correlation with different organic compounds. However, no correlation could be found with the total phenol content. These results suggest that the kind of phenolic compound present in the extracts affects their inhibitory efficiency.