Introduction

Reactive dyes constitute one of the most extensive categories of organic chemicals utilized across various industries including leather, tannery, textiles, cosmetics, food, printing, and plastics (Balarak et al., 2020). The textile industry is characterized by its substantial water consumption and the use of various dyes to impart colour to its products (Das et al., 2023). This process results in the generation of a substantial volume of coloured wastewater. The direct discharge of this wastewater into natural water bodies such as rivers and streams has far-reaching environmental consequences. These include a high organic load, the introduction of toxic substances, colour pollution, diminished light penetration, and a detrimental impact on aquatic ecosystems due to its effect on photosynthesis (Chen et al., 2018). Furthermore, it should be noted that many dyes used in this industry exhibit either toxic, mutagenic, or carcinogenic properties (Patel et al., 2022). Long-term exposure to dye pollutants may lead to various adverse health effects in humans, such as eye irritation, dermatitis, and allergic diseases (Al-Musawi et al., 2021). The treatment of dye-containing wastewater poses a significant challenge due to the varied synthetic origins and complex aromatic structures of these dyes. Moreover, they exhibit resistance to biological degradation. One notable example is Congo red (CR), an anionic diazo dye commonly used for colouring materials like paper, cotton, hemp, and silk, which has been associated with allergic reactions (Patel & Vashi, 2012; Rendon-Castrillon et al., 2023).

Even at low concentrations, the presence of residual dyes in wastewater not only results in the undesirable production of visible colours but also exerts adverse effects on the health of both aquatic organisms and human populations when this wastewater is discharged into water bodies (Balarak et al., 2019; Almroth et al., 2021; Sudarshan et al., 2023). Numerous strategies have been applied to address the challenge of dye removal from wastewater. Photodegradation (Sun et al., 2009), coagulation and flocculation (Hassaan et al., 2017), ozonation (Khadhraoui et al., 2009), and adsorption (Munagapati & Kim, 2017; Zhang et al., 2015) represent diverse methods that have been investigated and implemented for the elimination of CR from wastewater (Balarak et al., 2021; Nguyen et al., 2021). Among these approaches, adsorption stands out as a particularly prominent method, garnering extensive research attention due to the abundance and versatility of raw materials and the notable efficiency of this technique (Ali et al., 2018). Recent investigations have emphasized that adsorption is a particularly promising technology for treating wastewater contaminated with dyes (Balarak et al., 2020; Jorge et al., 2023). Its appeal lies in its simplicity, cost-effectiveness, and the wide array of adsorbents available for use. Activated carbon–based adsorption, while highly effective, introduces challenges related to cost and resource availability. Therefore, there has been a shift towards seeking effective, economically viable, and readily available biosorbents as alternatives to activated carbon (Bhatia et al., 2017; Katheresan et al., 2018).

Consequently, several investigations have been undertaken to examine the efficacy of economical adsorbents in eliminating dyes from aqueous solutions. Agricultural waste or by-products have surfaced as viable contenders to mitigate production expenses (Singha et al., 2015). These materials are renewable, are easily obtainable, and enable the elimination of energy costs associated with thermal processes. In this context, hazelnut shell–based activated carbon (HSAC) has been prepared through activation with nitrogen gas in an oxygen-free environment to investigate its potential for CR removal. Batch adsorption experiments have been carried out to systematically analyze the impact of parameters such as contact time, pH, adsorbent dosage, CR concentration, and temperature on the adsorption of CR by HSAC.

Artificial neural networks (ANNs) represent advanced computational architectures specifically designed to replicate the cognitive capacities of the human mind, including learning, discovery, and the generation of knowledge. These networks find utility in scenarios where conventional computational paradigms prove intricate or unfeasible. ANNs constitute a specialized subfield of computer science dedicated to adaptive data processing and have demonstrated their applicability across diverse domains, spanning from engineering to healthcare and textiles. They are particularly favored for tasks involving prediction, diagnosis, interpretation, classification, and recognition (Souza et al., 2018; Yusuf et al., 2020).

In recent years, there has been a growing interest in employing artificial neural networks (ANN) for modelling the adsorption of organic dyes (Hasanzadeh et al., 2019; Dahlan et al., 2023; Ramesh et al., 2023). ANNs offer a powerful tool to capture intricate relationships in data, enabling more precise predictions of adsorption behaviours. Their flexibility allows the incorporation of various parameters, contributing to a comprehensive understanding of the adsorption process. This integration of ANN with experimental data holds promise for optimizing adsorption conditions and advancing wastewater treatment efficiency.

This study presents a novel activation approach for hazelnut shells to enhance their effectiveness as adsorptive agents for CR dye removal. Unlike previous works, which primarily focused on hazelnut shell waste, our research investigates the activation process to optimize adsorption capacity. Additionally, we employ artificial neural networks (ANNs) to predict the adsorption process, distinguishing our study from others. Furthermore, our findings contribute to a deeper understanding of adsorption kinetics and mechanisms, offering insights into effective wastewater treatment strategies. Overall, our study highlights the potential of hazelnut shell waste as a sustainable adsorbent and introduces an innovative approach to predictive modelling in adsorption research.

Materials and method

Adsorbent preparation

Before utilizing hazelnut shells as an adsorbent, they underwent a thorough cleaning process involving multiple washes with distilled water to eliminate surface contaminants. A portion of the cleaned hazelnut shells was immersed in 95% hexane for a duration of 2 h, using hexane of analytical grade from Merck. Subsequently, all hazelnut shells were subjected to drying in an oven at temperatures between 103 and 105 °C and then reduced to a finer powder by crushing them in a mortar. Further refinement to achieve a particle size of ≤ 0.30 mm was accomplished using a mechanical grinder. These finely powdered hazelnut shells were employed as adsorbents in both their natural state and following purification with hexane. Following this stage, an oxygen-free environment was established within an oven, and the hazelnut shells were activated at 800 °C for 90 min with nitrogen gas.

The surface area of the hazelnut shell has been increased through thermal modification. Consequently, the augmented porous structure has led to an increase in the active sites necessary for adsorption.

Subsequently, the adsorbent, referred to as HSAC (C6767 from Sigma-Aldrich), was collected in a sealed container for future use. The chemical structures of the CR dye are illustrated in Fig. 1.

Fig. 1
figure 1

Chemical structures of CR

Adsorption studies

The adsorption study was conducted using a thermostatic shaker (Nüve SL350) with a 1 L solution volume and a shaking speed of 150 rpm. In the investigation of the effect of contact time on the removal of CR, adsorption analyses were carried out at different contact times ranging from 2 to 240 min. When examining the impact of the adsorbent quantity on CR removal, varying amounts of HSAC ranging from 0.5 to 10 g/L were employed. To evaluate the influence of pH on CR adsorption, experiments were conducted using pH values within the range of 3 to 9. For pH adjustments, HCl (ACS reagent, 37%) and NaOH (ACS reagent, ≥ 97.0%, pellets) were procured from Sigma-Aldrich. Adsorption studies were also performed to determine the effect of the initial concentration of CR dye on removal efficiency, utilizing seven different initial dye concentrations ranging from 5 to 400 mg/L. Temperature’s effect on CR removal efficiency was investigated by conducting analyses at temperatures between 20 and 40 °C. In the studies on the effects of adsorbent quantity, pH, contact time, temperature, and initial CR concentration, samples were centrifuged at 3000 rpm for 4 min (using a Nüve CN180 centrifuge) after collection from the solutions. Subsequently, measurements were carried out using a UV-Vis spectrophotometer. Based on the data obtained from the experiments, Ce (mg/L), qe (mg/g), and percentage removal rates were calculated according to Eqs. (1) and (2).

$$\mathrm{CR}\ \mathrm{removal}\ \left(\%\right)=\frac{C_0-{C}_e}{C_0}\times 100$$
(1)
$${q}_e=\frac{\left({C}_0-{C}_e\right).V}{m}$$
(2)

C 0 and Ce (mg/L) are respectively the initial and final concentrations of CR. m (g) represents the mass of AAS. The volume of the solution is indicated with V (L), where qe (mg/g) is the amount of adsorbed CR ions by AAS.

Isotherm and kinetic study

The Langmuir adsorption isotherm (Langmuir, 1918) is specifically applicable to the monolayer adsorption of a solute from a solution onto a surface containing a defined number of identical sites. This model, based on the assumption of similarity in energy of the adsorbent surface, is utilized to describe monolayer homogeneous adsorption and enables the estimation of maximum adsorption capacity (Kostić et al., 2016). The model rests on fundamental assumptions: (i) adsorption transpires within distinct homogeneous regions within the adsorbent, (ii) a single dye molecule associates with a sole binding site, (iii) the adsorbent possesses a finite capacity for the pollutant at equilibrium, and (iv) all regions exhibit uniformity and energetic equivalence. Conversely, the Freundlich isotherm model (Freundlich, 1906) postulates a multi-layered manifestation of adsorption and acknowledges the heterogeneity of the adsorptive surface in terms of both adsorption sites and energy. The Freundlich model is an empirical equation used to determine the adsorption intensity that may occur on the adsorbent surface (Kaykıoğlu, 2016). In contrast, the Temkin isotherm model (El-Shafie, 2023) proposes a linear reduction in adsorption heat with the adsorbed molecules in the environment, indicative of a homogeneous binding energy. The Dubinin-Radushkevich (D-R) isotherm (Laskar & Hashisho, 2020) is rooted in the potential change theory, specifically applied to a heterogeneous surface. Adsorption kinetics is utilized to specify the type of mechanism involved during the adsorption of pollutants onto the surface of the adsorbent. This study provides information about the potential adsorption mechanism and the ultimate interaction between the pollutant and adsorbent, assisting in the development of appropriate mathematical models to characterize these interactions. For this purpose, the pseudo-first-order kinetic model, pseudo-second-order kinetic model, and intra-particle diffusion model have been utilized in the adsorption process (Ho et al., 2000; Ho & McKay, 1999; Kostić et al., 2017; Lagergren, 1898). Isotherm and kinetic equations along with their corresponding parameters are provided in Table 1.

Table 1 Isotherms and kinetic parameters related to adsorption of CR

Relative deviation in adsorption capacity, RD (%), and mean relative deviation, MRD (%), were calculated using Eqs. (3) and (4), respectively (Kostić et al., 2022).

$$\mathrm{RD}=\frac{\left|{q}_{e,\exp }-{q}_{\mathrm{eorm},\mathrm{cal}}\right|}{q_{e,\exp }}x\ 100\%$$
(3)
$$\mathrm{MRD}=\frac{\sum_{i=1}^{i=n}\left|{q}_{t,\exp }-{q}_{\mathrm{torm},\mathrm{cal}}\right|}{q_{e,\exp }\ x\ n}x\ 100\%$$
(4)

where i is the experimental point and n is the number of experimental points.

ANN structure

ANN model exhibits an inherent proficiency in discerning and internalizing latent patterns that underlie complex processes by virtue of analyzing preceding datasets (Tanzifi et al., 2018). This assimilated knowledge subsequently extends itself to encompass the intricate mathematical relationships governing the dynamic interplay between input and output data. The ANN model, contingent upon its specific architectural instantiation, evinces the capacity to prognosticate intricate systems of diverse typologies, a phenomenon that finds articulation within the conceptual confines of its design (Mendoza-Castillo et al., 2018). Considering the intricate and multifarious attributes characterizing adsorption processes, an ANN model imbued with computational intelligence offers a heightened degree of adaptability vis-à-vis its conventional statistical counterparts. This is particularly salient when considering the latter’s limited efficacy in modelling intricate datasets imbued with nonlinear characteristics. Demonstrating its aptitude for sophisticated modelling endeavours, the ANN model instantiated through a hierarchical composition encompassing input, hidden, and output layers—individually characterized as neurons—constitutes a representation endowed with the acumen to anticipate the intricate interrelationships underpinning the input-output continuum (Pauletto et al., 2020). The visual exposé of this construct is vividly portrayed in Fig. 2, thereby underscoring its prospective utility in elucidating and prognosticating the interrelationships.

Fig. 2
figure 2

Architecture of an ANN

The entirety of the dataset has been meticulously partitioned into two distinct categories: a learning subset, encompassing 70% of the data, and two validation and testing subsets, each embracing 15% of the data volume.

The learning subset stands as the crucible for the training of the artificial neural network (ANN) model, while the testing subset furnishes the means for meticulously appraising the prognostic capabilities exhibited by the ANN model.

The quantitative evaluation of the ANN model’s prognostic outputs is judiciously undertaken by recourse to two pivotal performance metrics: the mean square error (MSE) and the coefficient of determination (R2). The efficacy and potency of the ANN model are profoundly interwoven with a constellation of pivotal variables. Among them, the count of neurons populating both the concealed and terminal strata commands significance, while the intrinsic attributes of the transfer function exert a pronounced bearing. Notably, in the context of this scholarly inquiry, the computational implementation of the ANN protocol is executed leveraging the MATLAB version R2023a Toolbox.

The architectural composition of the adopted ANN structure adheres to a tripartite arrangement, distinguished by a tangent sigmoid transfer function (tansig) adorning the hidden layer, a linear transfer function (purelin) adorning the output layer, all galvanized by the Levenberg-Marquardt backpropagation algorithm (trainLM), iterated across a course of 1000 cycles. The ingress layer, with discerning acumen, accommodates three constituent nodes that emblemize the elemental factors underpinning the adsorption process. These encompass the initial concentration, reaction time, and the quantum of adsorbent dosage. In the hidden layer, the neural ensemble varies across a span of 1 to 20, while the egress layer is graced by a solitary neuron, constituting the ultimate arbiter of the prognosticative endeavour.

Results and discussions

Characterization of the adsorbent

The FTIR spectra corresponding to HSAC are presented in Fig. 3. Within the hazelnut shell spectra, discernible spectral bands have been identified. Notably, a band appearing at 3360 cm−1 is attributed to the hydroxyl (–OH) group, while a prominent band observed at 3020 cm−1 indicates C–H stretching vibrations, suggesting the presence of constituents such as pectin, hemicellulose, cellulose, and lignin. The band observed at approximately 2700 cm−1 can be assigned to the aliphatic C–H group. A significant feature at 1670 cm−1 originates from C=C stretching, plausibly corresponding to the aromatic C–C bond. The presence of an aromatic ring within lignin is notably evident through bands occurring at 1460 cm−1. In the spectral range spanning from 1360 cm−1, the observed band likely corresponds to manifestations of O–H bending, O–H stretching, or C–H bending vibrations. The distinct C–O stretching vibration of carboxylic acids becomes perceptible at 1080 cm−1. It is remarkable to mention that carboxylic groups C–O have an absorbance in the region of 1650–1900 cm−1, while the bands of 400–650 cm−1 propose the formation of dye coupled with oxygen. These functional groups serve as indicative features within agricultural waste substrates. The surface area of the hazelnut shell, which served as the adsorbent material, was determined through BET analysis. Similarly, the surface analysis of the HSAC following the activation process was conducted using BET analysis. The BET-specific surface area of unmodified hazelnut shells and HSACs was 367 m2/g and 812 m2/g.

Fig. 3
figure 3

FTIR spectra of HSAC before/after adsorption

Effect of operating parameters on CR removal

In the adsorption study, parameters such as pH, adsorbent quantity, initial CR concentration, and contact time were investigated. Detailed results for each parameter are provided in Fig. 4. The adsorption behaviour of the examined systems is influenced by pH, with variations in adsorption capacity occurring because of the alteration in the ionization state of binding groups in both the adsorbate and adsorbent, as previously discussed. Consequently, it becomes imperative to identify the optimal pH for CR adsorption onto HSAC. To address this, experiments were conducted across a pH range of 3 to 9, incorporating different initial dye concentrations, solid/liquid ratios ranging from 0.5 to 10 g/L, and a temperature of 25 °C. The quantity of adsorbent is instrumental in elucidating the removal capacity within the adsorption mechanism. In this context, the amount of HSAC was incrementally varied from 0.5 to 10 g while maintaining a constant pH and a temperature of 25 °C. The removal efficiency of CR increased up to 87%. As the adsorbent quantity was increased, the efficiency of CR removal also increased naturally due to the increase in binding sites. The removal efficiency initially increases as the adsorbent quantity is raised from 0.5 to 10 g, reaching a balance thereafter. However, the adsorption capacity decreases. This is attributed to the lower dose of adsorbent having relatively more available reaction and binding sites on the surface area. In the study, the removal rate of CR occurs rapidly within the first 30 min of contact time. Subsequently, a slow increase leads to the attainment of equilibrium in approximately 60 min. The presence of a greater active surface area of the adsorbent in the initial minutes of adsorption has ensured a high removal efficiency of CR. With CR initial concentrations ranging from 5 to 400 mg/L, a 98% efficiency was achieved within the first 60 min.

Fig. 4
figure 4

3D surface plots showing the effect of adsorption parameters on the removal efficiency of HSAC for CR dye removal

Upon comprehensive examination of all results, the optimal adsorption parameters for CR adsorption with HSAC are determined as follows: a contact time of 60 min, HSAC quantity of 10 g/L, initial CR concentration of 400 mg/L, and a pH of 6. Additionally, the adsorption mechanism is conducted at a temperature of 25 °C, in a solution volume of 1 L, and with agitation at a speed of 150 rpm.

The adsorption process is subject to numerous influencing factors, among which the pHpzc (point of zero charge) plays a pivotal role in elucidating the mechanism of dye adsorption on the designated adsorbent. Understanding the pHpzc of the adsorbent is crucial for elucidating the electrostatic interactions between the adsorbent surface and the adsorbate at a specific pH level. Theoretically, when the pH is below the pHpzc, the adsorbent surface is positively charged, creating favourable conditions for the adsorption of anionic dyes like CR. According to these findings, effective removal of the anionic CR dye can be achieved by maintaining the solution pH below 6.5 (Fig. 5). This aligns perfectly with the experiment’s optimal pH result of 6, resulting in an 87% removal efficiency. Upon literature review, it is supported that in the study conducted by Ribeiro et al. (2018) (who used wood sawdust powder from eucalyptus Corymbia citriodora), CR adsorption is augmented with increasing removal percentages at low pH values. Additionally, Khan et al. (2014), who utilized chir pine sawdust, and Chanzu et al. (2019), who employed brewers’ spent grains as adsorbents, achieved maximum removal efficiency at low pH values in CR adsorption.

Fig. 5
figure 5

pHpzc

Isotherm and kinetic study

Equilibrium data, often referred to as adsorption isotherms, play a pivotal role in characterizing and designing adsorption systems. These data establish a mathematical relationship between the quantity of adsorbate per unit of adsorbent at equilibrium and the residual amount in the solution. Isothermal investigations were conducted by subjecting CR dye solutions with initial concentrations ranging from 5 to 400 mg/L to a constant temperature of 293 K for a duration of 30 min. Table 2 provides the constants of Langmuir, Freundlich, Temkin, and D-R isotherm models.

Table 2 Isotherm constants for the adsorption of CR onto HSAC

The examination of the data presented in Table 2 indicates that the regression coefficients (R2 values) obtained for the Freundlich and Langmuir isotherm models are in close proximity to 1. It is noteworthy that the Langmuir equation is based on the assumption that the adsorption process occurs on homogeneous surfaces within a single layer. The Langmuir adsorption model is commonly employed to characterize monolayer adsorption on homogeneous surfaces where there is no significant attraction between binding ions. The calculated Langmuir constant (RL) value for the adsorption on hazelnut shell activated carbon (HSAC) was 0.1322 for CR. The RL offers insights into the sorbent’s affinity for binding ions. This determined value affirms the occurrence of favourable adsorption concerning the reduction of dye ions by the organic adsorbents (RD was − 2.64%, and MRD was 1.04%).

Kinetic parameters play a pivotal role in deciphering the adsorption rate, thereby furnishing crucial insights for the modelling of the adsorption process. Consequently, in this context, three distinct kinetic models, specifically the pseudo-first-order, pseudo-second-order, and intra-particle diffusion models, were employed to comprehensively scrutinize the experimental data. Table 3 presents the pseudo-first-order, pseudo-second-order, and intra-particle diffusion models for the kinetic processes of adsorption, along with their respective parameter values. The correlation coefficients obtained for the pseudo-first-order and intra-particle diffusion models are compared, revealing a good fit to the pseudo-second-order model with higher R2 = 0.998 and lower values of RD and MRD. Similar kinetic results to this study have also been reported in the literature (Altintig et al., 2023; Kostić et al., 2013; Zabihi et al., 2022).

Table 3 Rate constants of kinetic models with correlation coefficients for CR adsorption onto HSAC

The results of the literature review conducted for the adsorption of CR dye are presented in Table 4. HSAC provides higher removal compared to other adsorbents.

Table 4 Comparison of adsorption capacities reported for various adsorbents for CR

ANN modelling

ANNs are employed to predict the behaviour and outcomes of systems, as well as to forecast existing processes. In this study, initial CR concentration, pH, contact time, and HSAC quantity are introduced as input parameters to the system. The removal efficiency of the adsorption mechanism is designated as the output parameter. An ANN network structure is constructed using these input and output parameters. The performance of the network is assessed using the mean squared error (MSE) and the regression analysis coefficient (R2). ANNs exhibit a notable sensitivity to the quantity of neurons in the hidden layer of the model. An excessive number of neurons may induce overfitting, while an insufficient number may lead to underfitting in the model system (Badkar et al., 2013). The study’s findings, aimed at identifying the optimal number of neurons for integration into the ANN model, are illustrated in Table 5. According to these results, the network structure with 8 neurons achieves the lowest MSE and the highest R2 values. The network (4-8-1) is trained using the Levenberg-Marquardt backpropagation algorithm (trainlm). The primary reasons for choosing this algorithm include its suitability for large datasets and its relatively faster training time.

Table 5 Model topologies for CR adsorption removal efficiency

In neural network studies, to achieve the best learning and closest results to reality, the constructed network structure iteratively operates consecutively. In each iteration, the network provides mean squared error and correlation coefficient. When the model yielding the lowest mean squared error and the highest correlation coefficient is obtained, the network operation is halted, and the network is saved. In this study, the regression results that yield the lowest MSE and the highest correlation coefficient for the network are presented in Fig. 6. These high correlation values obtained in the created ANN structure show that they best describe the relationship between input and output parameters, which consist of data of the adsorption mechanism.

Fig. 6
figure 6

The correlation coefficient results obtained from the analysis using the ANN structure

As seen in Fig. 6, a correlation coefficient of 0.984 was obtained for both the training and test data, indicating a strong correlation. For the validation data, a correlation coefficient of 1 shows a perfect fit. Despite the limited amount of data used for model training, the reliable agreement between the model’s predictions and the unseen data suggests the credibility of the model’s predictions. According to the results of the ANN, the correlation coefficient values indicate a good fit of the output. This result demonstrates that the ANN model is sufficiently accurate in predicting the actual values. Additionally, the ANN prediction data generated has been thoroughly compared with the experimental data in Fig. 7. Moreover, these values are like the correlation results of many other studies that have used and succeeded with ANN (Dolatabadi et al., 2018; Kaya et al., 2022; Al-Musawi et al., 2023; Ilavenil et al., 2024).

Fig. 7
figure 7

Comparison of the ANN model developed for HSAC and CR adsorption with the output data against experimental data

Conclusions

In this study, an artificial neural network (ANN) model structure has been developed to predict the removal efficiency of the CR dye using HSAC. The obtained results demonstrate that ANN emerges as a promising predictive technique, exhibiting a high level of effectiveness and satisfactory accuracy in forecasting the removal of CR from aqueous solutions. Functional groups of HSAC were identified through FTIR analysis, confirming the binding of the CR dye onto the adsorbent after adsorption. The results revealed a maximum removal efficiency of 87% under optimized conditions (pH 6, HSAC dosage 10 g/L, CR concentration 400 mg/L, and adsorption time 60 min). A kinetic study demonstrated a good fit of the experimental data to a pseudo-second-order model. Furthermore, isothermal data were consistent with both Freundlich and Langmuir models. The maximum adsorption capacity of HSAC for CR was determined to be 34.8 mg/g. This finding suggests that activated hazelnut shells, as a natural waste material, can be effectively utilized for dye removal. The key finding of this study is the high applicability of ANN in modelling the CR adsorption process, as evidenced by a strong correlation between the results of ANN analyses and the experimental values of the CR adsorption process.