1 Introduction

The huge quantity of industrial effluents containing organic pollutants, and their being efficiently treated prior to being pumped into the environment, has created immense interest among researchers [1]. One of the organic pollutants most detected in water bodies are dyes. In fact, these compounds are the major pollutants in wastewaters of textile, paper, leather, and cosmetic industries [1, 2]. On account of their non-biodegradable property and high toxicity to humans, wastewater containing dyes must go through efficient purification processes prior to discharge into the environment [3]. In addition, dyes can disturb aquatic life because of their ability to reduce the penetration of sunlight that is essential for the process of photosynthesis [4]. The malachite green (MG) dye is considered one among the synthetic azo dyes and is typically used in the dyeing process of paper, fabrics, clothes, and leather, in addition to being used as a raw material in the manufacture of paints and inks [5]. Moreover, MG dye is one of the antimicrobial medicines that is used in the fish breeding fields. Owing to its direct effect on human health because of its carcinogenic nature, the use of MG dye had been prohibited in many countries for nearly 2 decades [6, 7]. It is noteworthy that studies which discuss removing hazardous dyes from wastewater are among the priorities of scientific research in the field of environmental pollution treatment [8, 9].

Currently, several advanced treatment technologies are used for the purpose of treating dye-laden wastewater; the most efficient are adsorption membranes, flotation, advanced oxidation, and microbial degradation [10, 11]. Adsorption is said to be simple in design and operation, and an efficient, environment friendly, and cost-effective technology, for removal of different organic and inorganic pollutants [12]. Major mechanisms related to the removal of pollutants by adsorption include ion exchange, chemical reaction, electrostatic process, and bonding processes. The success of the adsorption treatment depends greatly on the characteristics of the adsorbent used, in terms of its ability to adsorb the target pollutants [13]. However, different materials have been applied as adsorptive agents to remove dye pollutants from contaminated solutions, such as activated carbon [14], sugarcane [15], alumina [16], ash particles [17], chitin [18], and bentonite [19]. On the other hand, the use of abundant adsorbents is important in large-scale wastewater treatments. In recent times, more attention has been given to adsorbents prepared from agricultural waste [8]. This is due to the exceptional properties that agricultural waste has, such as availability in large quantities, cheap price, ease of handling and use, and its effectiveness in the adsorption process [20, 21]. Almond is a plant that grows over an area of more than 122,000 hectares in northern Iran and has a high economic value in this country. In addition, the estimated amount of almond exported from Iran in 2020 was about 1% [22, 23]. The outer peel makes up about 35–75% of the weight of the almond fruit [24]. During the harvest season, large quantities of almond peel were generated and disposed of as agricultural waste.

To identify the relationship between the variables, the model that is used for the description of the adsorption process has to satisfy some conditions, such as the dependence of the evaluated parameters on the adsorption mechanism. Therefore, one of the effective tools for this approach is the artificial neural network (ANN), which could perform the mathematical functions for linear and nonlinear systems [25]. In general, the ANN tool can handle a large number of datasets and it also has the ability to detect all possible interactions between the dependent and independent variables. This tool has been commonly used in numerous studies for the optimization of experimental parameters that affect the water treatment process [25,26,27]. In reality, the ANN tool is a significant method that can be used to shorten the duration of the operation and reduce the total cost of the treatment.

To date, there are very few studies related to the ability of the almond peel to remove the MG dye. Moreover, there is no study that has examined the optimization of the environmental parameters of the MG dye adsorptions using the ANN tool [28]. Therefore, the objective of this research is to investigate the adsorptive performance of the almond peel waste, as a cheap and efficient adsorbent, and to remove MG molecules from aqueous solutions. The properties regarding the morphology and structure of the used adsorbent have been characterized by using advanced techniques. In addition, the adsorption performance of the almond peel for the removal of MG molecules has been examined at different values of the environmental parameters. The ANN tool has been used to optimize and predict the impact of the important environmental parameters on the MG adsorption efficiency. Ultimately, the reusability potential of the almond peels was tested through five successive cycles of MG adsorption.

2 Materials and methods

2.1 Materials

The required quantity of almond peels was collected from several forests in Iran, from the almond fruit harvest. The collected quantity was first cleaned with tap water to remove the dirt and then sun dried and crushed. Following that, it was ground using a planetary mill and sieved using 60-mesh and 200-mesh sieves, to obtain powdered almond peels with a particle size of: 75–250 µm. Finally, the powdered quantity was washed with tap water, thrice with deionized water, and then dried in a digital oven at 55 °C for 2 days. Eventually, the dried almond peels was placed in a desiccator for dehumidification, prior to its use in the adsorption experiments.

In addition, an analytical grade MG stock solution of properties listed in Table 1 was purchased from Merck (Germany). Deionized water was used to prepare and dilute the MG solution. Furthermore, the pH values of the used solutions were controlled by NaOH and HCl solutions (0.1 N).

Table 1 Physicochemical characteristics of used malachite green (MG) dye

2.2 Characterization

Field emission scanning electron microscopy (FESEM, ZEISS Sigma VP-500) was used for characterization of the surface properties. The specifications of the pore size and surface area of the almond peels were determined by the Brunauer–Emmett–Teller (BET) test, using Belsorp Mini II (Bel Japan Co.). In addition, Fourier transform infrared spectroscopy (FTIR) analysis (AVATAR 370 model) was applied, to determine the functional groups of an almond peel sample and to determine their involvement in the MG dye adsorption reaction.

2.3 Experiments of MG adsorption

The MG adsorption experiments were performed at a temperature of 25 ± 1 °C, using 500-mL conical flasks, filled with 200 mL of MG dye solution. The pH value of the MG solutions was controlled and adjusted by a pH meter (pH 765 m manufactured by the Calimatic Company of Germany) using 0.1 N NaOH and HCl. The working MG–almond peel solution was agitated at a speed of 300 rpm with a shaker machine (KS260 model manufactured by IK Germany) for 180 min. Accordingly, the adsorption capacity of the almond peels was determined at different environmental conditions: pH, 2.5–10.5; adsorbent dose, 0.25–1.5 g/L; initial MG concentration, 10–60 mg/L; and adsorption time, 0–180 min. These conditions were chosen based on the previous adsorption studies and the reported condition of most of the liquid waste generated from industries [29,30,31].

After inception of the limited time of the adsorption process, a 4 mL sample was taken from each flask. The samples were subjected to filtration using a Whatman 42, filter paper (15 mm), followed by centrifugation (Select-a-Fuge Bio Dynamics centrifuge) at 6000 rpm for 30 min, for solid–liquid separation. The initial and remaining MG concentrations were measured using a UV/Vis spectrophotometer at a wavelength of 616 nm. To obtain accurate results, all UV/Vis readings were measured in triplicate. The percentage of removal of MG by almond peels (%R) was calculated using Eq. (1).

$$R\%= \frac{\left({C}_{0}-{C}_{t}\right)}{{C}_{0}}$$
(1)

where C0 and Ct are the MG dye concentrations (mg/L) in the solution at inception and after a specific time after inception of the adsorption process, respectively.

In addition, the adsorption capacity (qt) was measured using Eq. (2).

$${q}_{t}=\frac{({C}_{0}-{C}_{t})}{M}\times V$$
(2)

where M (g) is the weight of the almond peels used in the adsorption experiments and V (0.2 L) is the MG solution volume. It must be noted that at the equilibrium status, the concentration and adsorption capacity are denoted by Ce (mg/L) and qe (mg/g), respectively.

2.4 ANN model

This model is based on the biological neural networks and is used to model and simulate the nonlinear and complex processes. The structure of the neural network includes neurons that are connected as input, hidden, and output layers. To minimize the error and to get accurate results, the neurons and hidden layers have been determined using a trial and error method [32]. As shown in Fig. 1, a three-layer, feed-forward ANN, with 4:10:1, architecture, was used to model the adsorption parameters of the MG dye using almond peels. In addition, the input variables selected in the present study were the initial pH, adsorbent dose, initial dye concentration, and adsorption time. The output variable or process response was the percentage of MG dye removal achieved via adsorption on the almond peels. Various architectures, with 2 to 20 neurons, were tested to compute the optimal number of neurons in the hidden layer of the ANN model. In the ANN analyses, the sum square error (SSE) statistical parameter was used as a loss function for training the ANN. Figure 2 shows the determined results of the SSE values versus the number of neurons in the hidden layer. Notably, the minimum error was obtained by selecting 10 neurons in the middle layer (SSE = 0.196). The hidden layer (fx) of the neural network used the sigmoid function.

Fig. 1
figure 1

Network architecture used to optimize MG adsorption on almond peels

Fig. 2
figure 2

Sum square error values versus number of hidden layer neurons

The numbers from the 154 data were used for the training phase and 38 for the network evaluation. The data used for the evaluation phase were randomly selected as the initial data. As the Sigmoid function was used as an activation function for the hidden layer neurons, all data had to be in the range of 0.1 to 0.9. Therefore, all inputs (Xi) were converted to the new value (Ai), using Eq. (3).

$${A}_{i}=0.8\left(\frac{{X}_{i}-min{(X}_{i})}{max{(X}_{i})-min{(X}_{i})}\right)+0.1$$
(3)

To compare the experimental data with the one obtained by the ANN model, we converted these last data back to the range (0–100) using Eq. (3).

3 Results and discussion

3.1 Characterization analyses of almond peels

Figure 3a shows the FESEM micrographs (at k × 2000 magnification) of the almond peel sample before and after the MG adsorption. Clearly, the SEM figure before MG adsorption shows that the prepared almond peels are rough and highly porous adsorbents. The conclusion that can be drawn from this characterization is that almond peel is a good material for adsorbing elements. This conclusion must be considered from the BET results, which demonstrate that the specific surface area of almond peels and average diameter of the pores are equal to 49.52 m2/g and 59.283 nm, respectively. After MG adsorption, the MG molecules can be clearly noticed as bright dots on the almond peels.

Fig. 3
figure 3

FESEM images of almond peel sample (a) and FTIR spectra (b) before and after MG adsorption

The FTIR spectra of the almond peel before and after adsorption are illustrated in Fig. 3b. This study found that many functional groups occurring at 577, 701, 988, 1428, 1662, and 3467 cm−1 are responsible for the adsorption of MG molecules on almond peels. The FTIR spectrum of the almond peel sample shows a sharp peak at 3467 cm−1, due to OH group stretching, which in turn is due to the intermolecular hydrogen bonding of polymer compounds, including alcohol or phenol [33, 34]. The weak peak, close to 2918 cm−1, is attributed to the stretching vibrations of the C–H bond of the aliphatic group [33, 35]. The existence of a peak close to 1735 cm−1 is also attributed to the stretching vibration of C = O, which indicates a hemicellulose content. The sharp peak at 820 cm−1 confirms the presence of lignin in the structure of the almond peels [33, 36]. By comparing the FTIR spectra of almond peels before and after the adsorption process of MG molecules, it was found that the peaks of the functional groups present on the almond peels decreased significantly after the adsorbent was used. Such behavior can be attributed to the reaction between the functional groups and MG dye in the solution and illustrates the role of chemical reactions in the adsorption process.

3.2 Effect of initial pH

pH is one of the most important parameters that can change the efficiency of pollutant removal in adsorption treatment systems [37]. In the current study, the effect of pH has been tested at values of 2.5–10.5, under the following conditions: MG dye concentration, 30 mg/L; almond peels dose, 0.5 g/L; and adsorption time, 0–180 min. The results are plotted in Fig. 4a. In addition, Fig. 4b depicts the effects of pH on the removal efficiency, at equilibrium condition. The results of the pHpzc analysis are presented in Fig. 4c, according to which the pHpzc of the almond peel used is around 2.88. Thus, at pH below pHpzc (adsorbent zero point), the adsorbent charge is positive; therefore, the adsorbent and pollutant repel each other, decreasing the adsorption efficiency. However, at a pH higher than pHpzc, the dominant charge on the adsorbent surface will be negative, increasing the dye adsorption. Moreover, the pKa of the MG molecule is reported to be 6.9 [5, 6]. The results of this experiment indicate that an increase in the pH value has a positive effect on the efficiency of MG molecule removal. The maximum removal efficiency is determined at alkaline pH values. The findings can be explained as follows: At low pH, the surface charge of the adsorbent is positively charged because of the protonation of the active sites on the almond peel surface, which include polar groups like the hydroxyl, carboxyl, and phenolic groups [37]. Due to the cationic nature of malachite green, the positive surface charge created in the acidic medium reduces the amount of intermolecular interaction between the various polar surface factors of the MG dye. Therefore, there is a reduction in the amount of adsorbed MG molecules. Contrary to that, at pH > 7, due to the presence of the phenoxide and hydroxide groups, ​​the density of the negative charges on the adsorbent surface increases. Thus, the electrostatic attraction increases between the positive ions of malachite green and the negative charges on the adsorbent surface. Consequently, the adsorption efficiency increases. As the dye undergoes restructuring at a pH value above 10, no significant changes in the adsorption rate are found in the pH range from 6.5 to 10.5. Thus, further experiments have been done with pH 6.5 as the optimum pH.

Fig. 4
figure 4

Effect of pH on MG removal efficiency (a), effect of pH at equilibrium time (b), the results of pHpzc analysis (c), effect of the almond-peel dose on adsorption of the MG dye (d), and effect of the initial concentration of MG dye on its adsorption by almond peels (e)

3.3 Effect of the almond peel dose

The adsorbent dosage is one of the significant parameters that strongly affects the adsorption process [38]. Therefore, the effect of the almond peel was examined in the current study by varying its dose from 0.25 to 1.5 g/L (conditions: MG dye concentration, 30 mg/L; pH, 6.5; and adsorption time, 0–180 min). According to Fig. 4d, an increase in almond peels increased the efficacy of MG molecule adsorption. These findings could be related to the increase in the number of sorption sites of almond peels needed for MG molecule adsorption [39]. As noticed, in the initial stages and due to the availability and vacancy of a large number of adsorption sites on almond peels, the adsorption process was fast and high. On reaching saturation, the adsorption speed decelerated gradually and stayed constant until it reached a steady state. This state was reached after filling a majority of the available sites, after about 60 min. A similar behavior was discussed by Lee et al. (2019) [40]. After equilibrium and by varying the amount of almond peel adsorbent used from 0.75 to 15 g/L, the efficiency of MG molecule removal obtained remained constant with a negligible difference of about 4 to 5%. Therefore, all experiments performed used 0.75 g/L of almond peels.

3.4 Effect of initial concentration

To evaluate the effect of the initial concentration on MG removal from an aqueous solution, the concentrations were varied from 10 to 60 mg/L in the following conditions: almond peels dose, 0.5 g/L; pH, 6.5; and adsorption time, 0–180 min) (Fig. 4e). The adsorption efficiency of the MG molecules decreased with the increase in MG concentration. One of the main reasons for this decrease was related to the limited and constant sorption capacity of the almond peels used. Thus, as the MG concentration increased, the capacity uptake of the used almond peels decreased [41]. Indeed, the main reason for the decrease in the adsorption efficiency following the increase in the initial concentration could be attributed to filling the sorption sites with adsorbent particles. According to Othmani et al., after equilibrium, the number of accessible sites of adsorption decreased, such that the MG molecules took a longer period of time to access the most inaccessible sites [37]. Similar findings were also obtained by Sharma et al. (2013), in their specific study on adsorption of MG dye by Timber Waste [42].

3.5 Effect of contact time

According to Fig. 4a, d, and e, it can be seen that the adsorption time has played a positive effect on the adsorption of MG onto the almond peel. An increase in contact time leads to an increase in MG removal efficiency, until it becomes saturated. The equilibrium was reached after 60 min, when most of the MG dye used was fixed onto the available sites of the almond peels.

3.6 Modeling of the isotherm and kinetics data

The isotherm experimental data were modeled based on the Langmuir, Freundlich, and Temkin models. In addition, the experimental data on the MG kinetics process were analyzed by utilizing the pseudo-first- and pseudo-second-order models. Furthermore, the kinetic data were modeled using the intraparticle diffusion kinetic model. For more information about the theoretical background of these four models, one can refer to the following references [29,30,31] [43]. The isotherm and kinetic model parameters are listed in Table 2. The statistical analyses using the coefficient of determination (R2), chi-square test (X2), and root mean square error (RMSE) showed that the isotherm and kinetics data were consistent with the Langmuir and pseudo-second-order models, respectively. Such data indicated that the MG dye molecules were adsorbed via chemical reactions onto the monolayer of the homogeneous active sites of almond peels [44]. From Table 2, the C value was observed to be > 0. This meant that the boundary layer diffusion might have been the rate-limiting step in the adsorption process of MG onto almond peels and not intraparticle diffusion [45].

Table 2 Isotherm and kinetic model parameters of the adsorption of MG dye using almond peels

3.7 Modeling of the adsorption of malachite green by ANN

Figure 5 shows output values ​​(dye removal percentage) of the neural network model and experimental data. The obtained results show that the linear coefficient of determination for the whole data reached 0.976. Based on the modeling data, the ANN model can be successfully applied for the adsorption of MG, because of the almond peels. It may also well describe the dye removal rate for new inputs.

Fig. 5
figure 5

Results of MG dye adsorption with ANN models

Figure 6 shows a bar graph of the relative effect of each variable of the input layer in the ANN tool. It is noted that all input variables have a significant effect on the response variable or on the percentage of dye removal, but none of them can be ignored. A comparative study of the experimental and theoretical findings has been carried out after studying the effects of pH, the almond peel dose used, and the adsorbent time for the adsorption of MG molecules, after having performed the process using the ANN model. The comparison has been done in compliance with the mean values ​​obtained from the model. The results illustrated in Fig. 7A to C show a good correlation between the ANN model results and those of MG adsorption.

Fig. 6
figure 6

Relative effect of input variables of the adsorption of MG on the output variable (percentage of dye adsorption)

Fig. 7
figure 7

Corresponding results of the ANN model to the experimental results of A pH, B adsorption time, and C adsorbent dose

3.8 Comparative study and recyclability test

Table 3 presents the maximum uptake (qm) of almond peels and other previously reported adsorbents used for MG dye adsorption. Based on the values reached, it can be inferred that almond peels are superior adsorbents for the removal of MG molecules from aqueous solutions.

Table 3 Comparison of MG adsorption capacities (qm) with different adsorbents reported in previous studies

In addition, the recyclability of the used adsorbent was tested in the five adsorption–desorption cycles of MG. The condition of this experiment was fixed at the optimum values determined from the optimization study. The results are depicted in Fig. 8 showing that, compared to the former cycle a decrease in the removal efficiency of MG by the almond peels could be detected. In the first cycle, the removal efficiency was observed to be 85.2%, while it reached 82.00% in the fifth cycle. This small decrease in the removal efficiencies during five cycles of treatment is representative of the high reusability level of almond peels in the adsorption treatment of MG wastewater.

Fig. 8
figure 8

Results of the experiments on recyclability of almond peels for MG adsorption

4 Conclusion

In the current study, the adsorption process of the MG dye on almond peel waste was comprehensively examined, using the ANN tool for optimization of the environmental conditions that had an effect on the adsorption mechanism. The characterization properties of the used adsorbent were determined by BET, FTIR, and FESEM analyses, which indicated that almond peels possess excellent morphological properties and functional groups. In addition, these analyses confirmed the adsorption phenomenon of MG dye molecules on used almond peels. The environmental conditions for MG molecule removal by almond peels were optimized by using the ANN tool. The findings showed that the maximum removal efficiency was 96.1% at the optimized conditions (pH, 8.5; almond peels dose, 0.75 g/L; MG concentration, 10 mg/L; and adsorption time, 60 min). A kinetics study showed that the experimental data fitted well with the pseudo-second-order model. Furthermore, the isothermal data were consistent with Langmuir model. The findings of this model revealed that the maximum adsorption capacity of almond peel waste for MG dye was 34.6 mg/g, which was much higher than what was obtained from other adsorbents used for the same purpose. The key finding of this study is that the ANN tool has high applicability to model the MG dye adsorption process, as a high correlation was determined between the determined results of ANN tool analyses and the experimental values of the MG molecule adsorption process.