1 Introduction

One of the greatest challenges of the twenty-first century is the provision of safe drinking water to millions of people around the world, whose pollution potential is increasing as a result of rapid industrialization and the diversity of human activities. The world produces more than 8 × 105 tons of dyes every year, and approximately 200,000 tons of textile dye waste are disposed of as industrial wastewater [1,2,3]. Dye pollution is a potential threat to the balance between the environment and human health. Among a wide variety of pigments, MB is a heterocyclic aromatic organic compound used mainly in the dyeing of fabrics and ornaments [4, 5]. MB not only causes eye and skin stinging, similar to other dyes but also causes hypertension, mental disorders, nausea, gastrointestinal disorders and other diseases when the concentration is greater than 7.0 mg/kg [6,7,8]. Every year, the state spends a large amount of money on the removal of nonferrous dye waste, and eliminating dye pollution in the environment has become an important issue.

A variety of technologies have been applied to the removal of colored dyes, including reverse osmosis [9], membrane filtration [10], biofiltration [11], coagulation/flocculation [12], chemical precipitation [13], and adsorption [14]. Compared with other technologies, adsorption is the most ideal and promising strategy for the treatment of MB in aqueous solutions due to its ease of operation, low cost and efficient removal capability [15]. In the selection of adsorbents, the use of commercial activated carbon as an adsorbent greatly increases the cost of production. Therefore, researchers are exploring the use of inexpensive and abundant environmental waste as an alternative to commercial activated carbon. Agriculture and forestry are major sources of environmental waste [16]. Currently, a wide variety of biomasses are involved in the preparation of activated carbon, such as palm fibre/palm husk [17, 18], coconut husk [19], walnut husk [20], corn straw [21], rice husk [22], olive stone [23], cellulosic pumpkin seed hulls [24], wood shavings [25], bamboo [26], crab shells [27], and shrimp shells [28]. The transformation of agricultural wastes into high-value activated carbon provides a new way to treat agricultural wastes.

Walnut shell is the main agricultural waste in China, and according to statistics, China produces more than 100,000 tons of walnut shell every year [29]. Walnut shell itself has a certain adsorption capacity [30]; after it is converted into activated carbon, the adsorption capacity is further enhanced, making it an effective adsorbent; therefore, we used walnut shell as a precursor for this study. Walnut shell activated carbon moulding occurs mainly through physical activation and chemical activation in two ways. Chemical activation is one of the most common methods for developing carbon adsorbents containing different oxygen-containing functional groups (carboxyl-COOH and hydroxyl-OH) [31, 32]. At present, studies on the chemical activation of walnut shell charcoal have focused on ZnCl[33], H3PO[34], and KOH [35]. For example, Aygün et al. prepared activated carbon ACW with ZnCl2 as an activator, and its adsorption capacity for MB was 1.33 mg/g [36]. Zichao Li [37] and Zhengyan Chen [38] used H3PO4 and KOH as activating agents to mold walnut shell carbon, and the adsorption of MB on activated carbon reached 867.9 mg/g and 47.6190 mg/g, respectively. Although the above activators can produce large porosities and high adsorption capacities, the disadvantages of strong corrosivity, which can cause safety problems and equipment damage at high temperatures, limit their practical application [39,40,41]. Therefore, it is very important to develop safe, inexpensive and effective activators.

The specific surface area of activated carbon prepared from walnut shells activated by potassium carbonate was 1046.9 m2/g, and the adsorption capacity for mercury ions was 182.9 mg/g [42]. Using corn straw as a raw material, Ling Zhu et al. prepared potassium carbonate-activated biomass carbon KBC750, which has a maximum specific surface area of 815 m2/g and a naphthalene adsorption capacity of 130.7 mg/g [43]. Therefore, potassium carbonate has great potential for the preparation of adsorptive activated carbon. At present, there is still a gap in the study of MB adsorption by activated carbon (WSAC) prepared from walnut shells activated by potassium carbonate. Due to the low cost, nontoxicity, and slight or noncorrosive advantages of potassium carbonate, we used potassium carbonate as an activator and Walnut shell as a precursor. WSAC, a walnut shell activated carbon with a high specific surface area and rich micropore structure, was successfully prepared by a two-step heating method. The effects of the activation temperature and impregnation ratio on the structure and adsorption properties of activated carbon were compared. The samples were characterized by XRD, nitrogen adsorption/desorption, SEM and FTIR. In addition, the zero-point potential pHpzc was determined. The activated carbon sample WSAC2-900, with the highest parameters, was used as the adsorbent. The effects of different initial concentrations of MB solution, pH values of the solution, contact times and temperatures on the adsorption performance were studied, and the optimum adsorption conditions for WSAC2-900 were determined. The isotherms, kinetics and thermodynamics of MB adsorption by WSAC2-900 were investigated. In addition, the mechanism of MB adsorption by WSAC2-900 was discussed.

2 Materials and methods

2.1 Chemicals and instruments

The analytical grade cationic dyes methylene blue (MB) (≥98.5%), NaOH (≥96%), HCl (99%), K2CO3 (analytical purity≥99%, provided by Sinopharm Chemical Reagent Co., Ltd.), anhydrous ethanol (Yantai Shuangshuang Chemical Co., Ltd.), and walnut shells were produced and grown locally in Zibo. The equipment used included a tubular furnace (Tianjin Zhonghuan Electric Furnace Co., Ltd.), a UV–visible spectrophotometer, a pH meter, a thermostatic water bath shaker, an electric thermostatic drying oven (Shaoxing Shangcheng Instrument Manufacturing Co., Ltd.), a BET surface area and pore size analyser (Micromeritics - ASAP2460, USA), Fourier transform infrared spectroscopy (FT-IR) (Thermo Fisher Scientific - Nicolet IS5, USA), and a liquid zeta particle size/potential analyser (Dynamic Light Scattering, DLS) (Malvern - Zetasizer Nano S90, UK).

2.2 Preparation of walnut shell carbon

The walnut shells were washed with ultrapure water, dried, ground into powder, and sieved. The dried WSAC was pyrolyzed in a tubular furnace at 400 °C for 4 hours (heating rate of 5 °C/min, nitrogen intake rate of 150 mL/min) and then cooled to room temperature to obtain biochar. Subsequently, 4 g of WSAC and 8 g of K2CO3 were thoroughly mixed, ground, and passed through a 60-mesh sieve. The mixture was then placed in a tubular furnace and heated at 900 °C for 2 hours in a nitrogen atmosphere (heating rate of 10 °C/min, N2 flow rate of 150 mL/min) [44]. Finally, the resulting material was ground and passed through a 60-mesh sieve, washed alternately with dilute HCl and deionized water until the pH was neutral, and then dried at 65 °C. The product was named WSACR-T, where R represents the mass ratio of K2CO3 to BC (R = 1, 2, and 3) and T represents the second-stage pyrolysis temperature (T = 500, 700, and 900°C).

2.3 Characterization

The pore structure characteristics of the activated carbon were analysed using a BET surface area and pore size analyser (Micromeritics - ASAP2460, USA). N2 adsorption and desorption isotherms were measured at 77 K. The micromorphology of the activated carbon was observed using a scanning electron microscope (SEM) (ZEISS - Sigma 500, Germany). After sputter coating with gold using a sputtering device, SEM images were obtained in the range of 100 μm to 1 μm under an accelerating voltage of 30 kV. Before and after MB adsorption, the changes in the chemical groups of WSAC2-900 were determined using Fourier transform infrared spectroscopy (FTIR) (Bruker - INVENIO S). FTIR spectra of the samples were collected in the range of 4000-400 cm-1 with 16 accumulated scans at a resolution of 4 cm-1. The zeta potential of WSAC2-900 in the pH range of 2-10 was measured using a Zetasizer Nano S90 (Malvern, UK). By calibrating the point of zero charge (pHpzc), the variation pattern of the surface charge of WSAC2-900 with the pH of the solution was summarized.

2.4 Adsorption performance

A specific amount of dried WSAC2-900 was added to 25 ml of methylene blue (MB) solution at a concentration of 400 mg/L. The adsorption process parameters were optimized by varying the pH of the MB solution (2-10), temperature (283 K-313 K), contact time (10, 20, 100-600 min), and concentration of the MB solution (50-400 mg/L). The pH of the solution was adjusted using dilute HCl and NaOH solutions. The experiments were conducted in 30 ml centrifuge tubes, which were agitated at 250 rpm. The solution was then centrifuged, and the supernatant was extracted to measure the change in MB concentration using a UV spectrophotometer (UV, U-3900, Hitachi, Japan). The tests were repeated three times to obtain average values. The removal percentage (%R) and adsorption capacity (q, mg/g) of WSAC2-900 for the MB solution were calculated using formulas (1) and (2), where C0 and Ci represent the initial and final concentrations of MB, respectively, m is the mass of the activated carbon (g), and V is the volume of the MB solution (mL).

$$\textrm{R}\left(\%\right)=\left[\frac{{\textrm{C}}_0-{\textrm{C}}_{\textrm{i}}}{{\textrm{C}}_0}\right]\times 100\%$$
(1)
$$\textrm{q}=\left[\frac{{\textrm{C}}_0-{\textrm{C}}_{\textrm{i}}}{\textrm{m}}\right]\times \textrm{V}$$
(2)

2.5 Theoretical studies

2.5.1 Adsorption kinetics

Batch adsorption experiments were conducted at different time intervals on WSAC2-900 to determine the adsorption process involved. The adsorption data obtained at different times were processed using the pseudo-first-order Lagergren equation (pseudo-first-order, PFO; kinetic model, 1898), the pseudo-second-order Lagergren equation (pseudo-second-order, PSO; kinetic model, 1999), and the intraparticle diffusion equation (referred to as IPD). The best kinetic model was selected based on the regression correlation coefficient (R2) and the size of the adsorption capacity to determine the kinetic adsorption mechanism. The linear mathematical forms of the PFO, PSO, and IPD kinetic models are as follows (Eqs. 3, 4, 5):

$${q}_t={q}_e\left(1-{e}^{-{k}_1t}\right)$$
(3)
$${q}_t=\frac{{q_e}^2{k}_2t}{1+{q}_e{k}_2t}$$
(4)
$${q}_t={k}_{pi}{t}^{1/2}+C$$
(5)

where:

t:

contact time (min)

qt:

quantity of adsorbate at time t (mg/g)

qe:

quantity of adsorbate at equilibrium (mg/g)

K1:

pseudo-first-order rate constant, min-1

K2:

pseudo-second-order rate constant, g/(mg·min)

Generally, the closer the regression correlation coefficient (R2) of a model is to 1, the better it explains the adsorption mechanism. The pseudo-first-order kinetic model suggests that the rate-limiting step in adsorption is the internal diffusion resistance within the particles, while the pseudo-second-order reaction kinetic model considers that the rate-limiting factor is the adsorption mechanism itself [45]. In most cases, the PSO (pseudo-second-order) kinetic model is most suitable for processes involving dye adsorption.

2.5.2 isotherm adsorption

Isotherm adsorption models are used to study the relationship between the amount of adsorbate adsorbed on the surface of biomass activated carbon (qe) and the equilibrium concentration of the adsorbate in the solution (Ce). By fitting and analysing the isotherms, the interaction between the biomass activated carbon and the adsorbate was clarified. Adsorption isotherm models are used to help identify the adsorption mechanism and to determine the maximum adsorption capacity of the adsorbent. The Langmuir (1917), Freundlich (1906), Temkin and D-R isotherm models are frequently used. These sorption isotherm models were used to analyse equilibrium adsorption data for different MB concentrations. According to the Langmuir adsorption isotherm model, the adsorbent surface is considered uniform, with indistinguishable adsorption sites; all adsorbing particles have the same heat and energy; adsorption occurs in a monolayer, and there are no interactive forces between the adsorption sites and the adsorbate.

The following is the linear mathematical form of the Langmuir isotherm model:

$${q}_e=\frac{b{q}_m{C}_e}{1+b{C}_e}$$
(6)
$${R}_L=\frac{1}{1+{K}_Lg{C}_i}$$
(7)

In this context, b is the Langmuir constant (L·mg-1), and qmax​ represents the maximum adsorption capacity. RL is the Langmuir separation factor, which indicates the favourability of adsorption: RL>1 implies unfavourable adsorption; RL=1 indicates linear adsorption; RL=0 represents irreversible adsorption; and 0<RL<1 suggests favourable adsorption. Specifically, when 0<RL<1, the larger the value of RL is, the more favourable it is for pollutant removal [46].

The Freundlich adsorption isotherm model represents multilayer adsorption and is an empirical model. This model assumes that the adsorbent surface is heterogeneous and that the adsorption process of the adsorbate on the adsorbent and between adsorbate molecules involves various conditions. Equation (8) displays the linear mathematical form of the Freundlich isotherm. By performing a linear fit with the experimental data, using lnCe​ as the x-axis and lnqe​ as the y-axis, the values of k and n in the Freundlich model are determined.

$${q}_e=k{C_e}^{1/n}$$
(8)

where

n:

Freundlich constant related to the adsorption intensity of biomass activated carbon;

K:

an empirical constant related to the nature and type of pollutants in the solution and biomass activated carbon. The value of ‘n’ indicates the adsorbability; the larger the value of ‘n’, the stronger the interaction between the adsorbate and the adsorbent (n > 1 indicates favourable adsorption conditions) [47].

The Temkin sorption isotherm model is used to study the linear relationship between the heat of adsorption and temperature. This approach is suitable for chemical adsorption processes where the heat of adsorption varies linearly with the degree of surface coverage. The Temkin sorption isotherm model can be expressed as:

$${q}_e= Aln{A}_T+ Aln{C}_e$$
(9)
$$A=\frac{RT}{b}$$
(10)
qe:

The equilibrium adsorption capacity of biomass activated carbon, mg/g;

R:

gas constant, 8.314 J/(mol·K);

T:

Absolute temperature, K;

b:

A constant related to the free energy of adsorption, mol2/J2;

Ce:

The solubility of methylene at adsorption equilibrium, mg/g;

A:

A constant relating to the heat of adsorption, L/g;

AT:

Dimensionless adsorption constant;

The Dubinin–Radushkevich model is often used to analyse adsorption mechanisms. It is assumed that the adsorption energy on the surface of the material is nonuniformly distributed and that the energy is Gauss distributed. The D-R isotherm model for the adsorption of colored dye pollutants in water by biomass activated carbon can be expressed as:

$${q}_e={q}_m{e}^{\left(-k{\varepsilon}^2\right)}$$
(11)
$$\varepsilon = RTln\left(1+\frac{1}{C_e}\right)$$
(12)
ɛ:

Polanyi potential energy, J/mol;

k:

Parameters related to the adsorption energy, mol2/kJ;

β:

Parameters related to the free energy of adsorption, mol2/J2;

E:

Energy per mole of adsorbent, kJ/mol, \(E=\frac{1}{\sqrt{2}K}\).

When E < 8 kJ/mol, physical adsorption occurs; when 8 kJ < E < 16 kJ, ion exchange occurs; and when E > 16 kJ, chemical adsorption occurs.

2.5.3 Thermodynamic studies

To study the spontaneous adsorption properties of MB on WSAC2-900 activated carbon, MB adsorption experiments were conducted with temperature as the single variable. The adsorption thermodynamic parameters were calculated using the van't Hoff equation.

$${K}_L=\frac{q_e}{C_e}$$
(13)
$$\Delta {G}^{{}^{\circ}}=- RTln{K}_L$$
(14)
$$\mathit{\ln}{K}_L=\frac{\Delta {S}^{{}^{\circ}}}{R}-\frac{\Delta {H}^{{}^{\circ}}}{RT}$$
(15)

The slope and intercept of the linear plot of ln KL versus 1/T yield the values of ΔH° and ΔS°, respectively.

3 Results and conclusions

3.1 Characterization of the physical and chemical properties of activated carbon

3.1.1 Study on the structure of activated carbon

After the activation of potassium carbonate, the crystal structure of the activated carbon was determined by X-ray diffraction (XRD). The XRD patterns of the activated carbon before and after activation are shown in Fig. 1. The WSAC2-900 sample did not show sharp diffraction peaks, indicating that cleaning with hydrochloric acid removes potassium-containing impurities generated during the decomposition of potassium carbonate [41]. The peak position of WSAC2-900 moves forward and becomes wider than that before activation, which indicates that carbon reacts with potassium carbonate during activation. Two broad peaks were detected at 2θ = 20.64° and 43.68° after activation, which are attributed to the (002) and (100) planes in the disordered carbon material structure due to graphite disorder [48, 49]. The XRD results show that the activated carbon is amorphous. The increase in the peak intensity indicates that the activation of potassium carbonate promoted the formation of graphite structures [50].

Fig. 1
figure 1

XRD patterns of the WSAC and WSAC2-900 samples in the range of 2θ = 10-80°

Figure 2a shows the N2 sorption isotherms of activated carbon prepared at different impregnation ratios and at different temperatures. The image shows that there is significant N2 adsorption in the range of 0-0.1 relative pressure, with the adsorption amount rapidly increasing at relatively low pressures and reaching a saturation point, resembling the Langmuir type adsorption isotherm. According to the IUPAC classification, WSAC2-900 has type I microporous isotherms, with all the activated carbons exhibiting characteristics of microporous solids. Table 1 summarizes the main data associated with the porous structure, and the combination of low SEXT values and high Vmicro values confirms a minor contribution from mesopores [51]. Figure 2(b-d) shows the pore size distribution of WSAC2-900, which has a size range of 0.7-10 μm and contains a large number of micropores as well as certain mesopores and macropores, which are advantageous for the adsorption process.

Fig. 2
figure 2

Voidage structure of WSAC at different temperatures and impregnation ratios: a N2 adsorption isotherms of all the ACs at -196°C. b, c, d Distribution of pore size of activated carbon at different temperatures and same impregnation ratio

Table 1 WSAC2-900 pore structure study BET data summary

The impregnation ratio plays a critical role in the preparation of biomass activated carbon, significantly impacting the structural parameters of the activated carbon. By adjusting the impregnation ratio, it is possible to change the pore structure, optimize the adsorption activity, and introduce new functional groups, thereby enhancing the chemical reactivity of the activated carbon. Choosing an appropriate impregnation ratio is crucial for preparing activated carbon with a high specific surface area and high performance. However, a higher ratio of activator to biomass does not always lead to greater adsorption performance. Excessive impregnation ratios may result in residual chemical reagents that can destroy the already formed pore wall structures, reducing the specific surface area of activated carbon (AC). K2CO3, as an activator, decomposes upon heating to produce K2O and CO2, which helps in the development of micropores in the material. Additionally, the reactions of K2CO3 and K2O with carbon lead to the formation of metallic potassium [52]. This potassium can diffuse into carbon layers, increasing the reactivity of carbon and producing the highly loaded activator WSAC2-900.

In addition to the impregnation ratio, temperature is another crucial factor influencing the pyrolysis effect of potassium carbonate. As the temperature increased, the specific surface area and total pore volume of the WSAC increased. At 500°C, the pore volume of the micropores is less than that of the mesopores and macropores. When the pyrolysis temperature reaches 700°C and 900°C, the pore volume and specific surface area of the micropores are greater than those of the mesopores and macropores. This indicates that potassium carbonate primarily generates mesopores and macropores at lower temperatures, resulting in a lower specific surface area, while at higher temperatures, the number of micropores increases. The specific surface area increases with temperature, while the average pore size decreases with increasing activation temperature. The activated carbon WSAC2-900, which has the most developed porosity (chosen for subsequent adsorption tests), possesses a micropore volume of 0.5963 cm3/g and a mesopore volume of 0.1348 cm3/g. The mesopore ratio is approximately 20% (percentage of mesopores relative to the total pore volume), which is considered a significant proportion for a material with a notably developed microporosity and a significant mesoporosity. Therefore, the prepared WSAC2-900, due to its significant pore structure, has the potential to be a promising adsorbent for the adsorption of both gaseous and liquid-phase pollutants.

3.1.2 Surface morphology study

The SEM images of WSAC2-900 are shown in Fig. 3. The surface of the unactivated walnut shell carbon was relatively rough, with few pores observed Fig. 3a. The surface of WSAC2-900 became very smooth due to activation with K2CO3, indicating a melted state Fig. 3b. From the longitudinal cross-section, it can be observed that the interior of the activated carbon contains abundant channels, with the carbon framework resembling a hollow lotus root structure Fig. 3c. These interconnected channels facilitate the passage of MB molecules. In the transverse cross section, WSAC2-900 has a dense internal space, resembling a honeycomb-like structure (Fig. 3d) [53]. This high porosity enhances the ability of the adsorbent to capture MB from wastewater, reducing mass transfer resistance. According to Fig. 3e, after adsorption of MB, the edges of the pore structure of the activated carbon are covered with adhesions. Upon magnification, it is evident that the surface of WSAC2-900 has increased particulate matter, with pores filled with MB particles.

Fig. 3
figure 3

Morphology and structure of WSAC2-900. SEM images: a Unactivated carbon WSAC-900. b, c, d Activated carbon sample WSAC2-900 before adsorption. e WSAC2-900 activated carbon after adsorption

3.1.3 Functional group determination and potential analysis

FTIR spectroscopy was used to further explore the surface chemical groups of WSAC2-900. The FTIR spectra of WSAC2-900 before and after the adsorption of MB are compared in Fig. 4a. New absorption bands emerged in three regions—1800-1500 cm-1, 2800-3000 cm-1, and 3600-3900 cm-1—for WSAC2-900 after adsorption. The stretching vibration of -OH groups occurred at 3438 cm-1 [54], with increased vibration intensity, indicating the formation of hydrogen bonds between WSAC2-900 and MB. The antisymmetric and symmetric stretching of -CH2 or -CH3 in aliphatic or aliphatic groups occurred at 2920 cm-1 and 2851cm-1, respectively, exhibiting a decrease in aged biochar as a result of oxidation [55]. These peaks are below 3000 cm-1 and feature two absorption peaks, suggesting that they originate from methylene groups. The reduced transmittance at these wavelengths before and after adsorption, along with an increase in the number of methylene groups, indicates that methylene blue was effectively attached to the surface of the activated carbon. This provides solid evidence for the study presented in this article. The amide C=O double bond can be identified by the broad band at 1631 cm-1. After MB adsorption, the spectral bands shifted from 1626 and 3434 cm-1 to 1631 and 3440 cm-1, respectively, indicating a weakened interaction between the functional groups on the surface of the activated carbon and the dye molecules. The existence of functional groups such as carboxyl groups was further confirmed using the zeta potential of WSAC2-900 at different pH values. The zeta potential graph Fig. 4b shows that the material maintains a negative charge between pH 2 and 10. When the pH is greater than 2, the surface negativity of WSAC2-900 gradually increases due to hydrolysis, thereby enhancing its adsorption capacity for cationic dyes (as shown in Fig. 7a).

Fig. 4
figure 4

Chemical characteristics of WSAC2-900: a FTIR spectra of WSAC2-900 before and after MB adsorption. b Zeta potentials of WSAC2-900 AC at different pH values

3.2 Adsorption performance

3.2.1 Impact of the MB concentration and sorption isotherm

The impact of the initial concentration on the adsorption capacity of WSAC2-900 is shown in Fig. 5a. As the concentration of methylene blue (MB) increased from 50 mg/L to 400 mg/L, the adsorption capacity also increased. This is because the mass transfer between WSAC2-900 and MB molecules increases with increasing concentration, and the driving force between molecules increases, allowing MB molecules to be brought to the surface of the adsorbent more rapidly [56]. However, as effective adsorption sites gradually become occupied by the adsorbate, the adsorption quantity starts to approach an equilibrium state at approximately 250 mg/L, and the adsorption efficiency decreases. The maximum adsorption capacity of WSAC2-900 was approximately 557.5462 mg/g.

Fig. 5
figure 5

a Effect of the MB concentration on the adsorption capacity of WSAC2-900 at T = 299 K, 10 mg of adsorbent, 25 ml of adsorbents and pH = 8.13. Analysis of WSAC2-900 adsorption of MB using the b Langmuir model, c Freundlich model, d Temkin model and e D-R model

To better understand the interaction between activated carbon and MB dye molecules, the Langmuir, Freundlich, Temkin and D-R sorption isotherm models were used to analyse the experimental results. The Langmuir adsorption isotherm model is suitable for describing monolayer adsorption processes, where adsorption sites on the surface of the adsorbent are uniformly distributed, and there is no interaction between MB molecules adsorbed on adjacent sites. In contrast, the Freundlich adsorption isotherm model represents multilayer adsorption, with a nonuniform distribution of adsorption sites on the adsorbent surface, and various interactions exist between the adsorbent and MB molecules, as well as among the MB molecules themselves. The Temkin sorption isotherm model is mainly used to describe the chemical adsorption process in which the heat of adsorption varies linearly with the degree of surface coverage. The D-R sorption isotherm model is often used to analyse the adsorption mechanism, assuming that the adsorption energy is nonuniform on the surface of the material and that the energy distribution is Gaussian. According to the analysis results shown in Fig. 5(b-e), the correlation of the Langmuir isotherm (R2 = 0.9993) was more significant than that of the other adsorption isotherms. The results indicate that the adsorption of MB on the WSAC2-900 surface is a process of monolayer adsorption. The results presented in Table 2 show that the adsorption equilibrium parameter RL for methylene blue on WSAC2-900 is 0.0029, which falls within the range of 0-1. This indicates that the adsorption of MB on WSAC2-900 is advantageous and easy to occur [57]. According to the Freundlich model, the value of 1/n can be used as an indicator of the adsorption strength. The calculated value of 1/n falls between 0 and 1, indicating good adsorption characteristics on a heterogeneous surface [58]. Using the Langmuir adsorption isotherm model, the maximum adsorption capacity of WSAC2-900 was determined to be 552.4851 mg/g, which aligns well with the actual value of 557.5462 mg/g. Compared to other activated carbons, such as coriander (296 mg/g), flax (464.2 mg/g), and bamboo charcoal (67.46 mg/g), WSAC2-900 demonstrated a greater adsorption capacity (a comparison of the adsorption capacities of different adsorbents for MB is shown in Table 3). This can be attributed to its larger specific surface area and greater porosity, as summarized in Table 1.

Table 2 Summary of Langmuir, Freundlich, Temkin, and DR isotherm model parameters for the adsorption of MB dye on WSAC2-900 at 299 K
Table 3 Comparison of the adsorption capacities of different adsorbents for MB

3.2.2 Study on the influence of contact time and adsorption kinetics

The effect of time on the adsorption capacity of WSAC2-900 was investigated at 26 °C, pH 8.13, and an MB concentration of 400 mg/L. As shown in Fig. 6a, the MB adsorption quantity rapidly increased within the first 200 minutes and then reached saturation. The maximum MB adsorption capacity of WSAC2-900 was 541.2885 mg/g. The adsorption mechanism was studied using pseudo-first-order [65], pseudo-second-order [66] and intraparticle diffusion models [67]. The correlation coefficient of the pseudo-second-order kinetic model (R2 = 0.9992), as shown in Fig. 6d, was greater than that of the pseudo-first-order kinetic model (R2 = 0.8675), as shown in Fig. 6c, suggesting that the pseudo-second-order kinetic model better describes the adsorption kinetics of WSAC2-900. According to the kinetic parameters presented in Table 4, the theoretical qe value of 541.2885 mg/g from the pseudo-second-order model is consistent with the actual value of 557.5462 mg/g. This indicates that chemical adsorption occurs during this adsorption process [68]. According to the physical interpretation of the model, MB formed chemical bonds or exhibited relatively strong adsorption on the surface of WSAC2-900.

Fig. 6
figure 6

a The effect of time on the adsorption capacity of WSAC2-900 activated carbon was studied at T = 299 K, 10 mg of adsorbents, 25 ml of adsorbent and pH = 8.13. b Fitting curves for intraparticle diffusion of methylene blue adsorption on WSAC2-900 activated carbon. c Fitting curves for the pseudo-first-order model and pseudo-second-order model

Table 4 Kinetic parameters of WSAC2-900 adsorption of methylene blue at T = 299 K, 10 mg of adsorbent, 25 ml of adsorbent and pH = 8.13

The intraparticle diffusion model was used to identify the diffusion limitations and influence of the internal structure of the particles on the overall adsorption performance during the adsorption process. From the data shown in Fig. 6b and Table 5, the in-particle diffusion model divided the adsorption process into three linear stages, and the adsorption rate constant decreased in the order K1d> K2d > K3d. This indicates that the rate of adsorption decreases over time, which is typical as the adsorption process progresses from initial rapid adsorption to slower adsorption due to fewer available sites and diffusion resistance within the particles. The first stage of adsorption is characterized primarily by surface adsorption, where the slope K1d is the largest and the line segment is the steepest. This indicates that Methylene blue molecules diffuse rapidly on the surface of WSAC2-900 activated carbon during the initial stage of adsorption. This is mainly due to the synergistic effect of hydrogen bonding and electrostatic interactions. Due to the large number of oxygen-containing functional groups, a large number of potential active adsorption sites can be effectively bound to methylene blue molecules. Therefore, at this stage, chemical adsorption plays a leading role in promoting an efficient adsorption reaction. K2d is the slope of the second adsorption stage, in which diffusion within the adsorbent becomes the control step due to the saturation of the adsorption sites on the surface and the decrease in the number of adsorption sites, and the adsorption rate decreases. In the third stage, due to the saturation of the adsorption site, diffusion within the particle becomes the dominant step, and as MB molecules need to travel a more complex path to reach the remaining small number of unoccupied active sites, the adsorption rate is further reduced. The smallest line segment of the K3d value is the smoothest, indicating that the adsorption-desorption dynamic equilibrium is gradually reached in this stage [69, 70]. Additionally, the fact that the fitted straight lines do not pass through the origin confirms that intraparticle diffusion is not the sole rate-limiting factor [71, 72]. This indicates the involvement of other mechanisms in the overall adsorption process, such as surface adsorption and chemical interactions. The intercepts C1 < C2 < C3 indicate that as time progresses, the surface of the activated carbon is increasingly occupied by MB molecules. The enhanced repulsive forces between MB molecules with the same charge, along with the reduction in available active sites, led to increased adsorption resistance. Consequently, the intercepts gradually increase until a dynamic equilibrium between adsorption and desorption is reached. This mechanism, comprising three stages, reveals the importance of the synergistic effect of external and internal diffusion during the adsorption of methylene blue onto WSAC2-900.

Table 5 The adsorption parameters of the diffusion model of WSAC2-900 with adsorbed MB particles at T = 299 K, 10 mg of adsorbent, 25 ml of adsorbent and pH = 8.13

3.2.3 Effect of pH

With an initial MB concentration of 400 mg/L, a volume of 25 mL for MB, an adsorbent dose of 10 mg, and a temperature of 299 K, the effect of pH on the adsorption of MB by WSAC2-900 was studied by adjusting the pH using hydrochloric acid and sodium hydroxide solutions. As shown in Fig. 7a, the adsorption capacity of WSAC2-900 for MB dye increased with increasing pH from 565.4073 to 636.8153 mg/L, and no significant changes were observed above pH 8. The lower removal rate at pH 2-4 may be due to two reasons: one is the decrease in available active sites due to MB molecules and excess H+ competing active sites on activated carbon; second, the repulsion between MB and H+ decreases the adsorption rate. As the pH increases, the oxidative groups dissociate to form MB-oxygen binding sites that favour cationic adsorption, resulting in an increase in the number of adsorption sites and an increase in the adsorption rate [73]. Therefore, due to its cationic nature, MB is more readily adsorbed in alkaline environments. The results indicate that a pH range of 8-10 is more conducive for adsorption experimental studies. Notably, the variation in adsorption capacity related to the initial pH suggested the existence of electrostatic interactions between WSAC2-900 and MB [74, 75].

Fig. 7
figure 7

a Influence of pH on the adsorption capacity of WSAC2-900 activated carbon, adsorbent =10 mg, adsorbent=25 ml, T=299 K, pH=8.13, and C0=400 mg/L. b Effect of different cations on MB adsorption by WSAC2-900, adsorbent =10 mg, adsorbent=10 ml, T=299 K, pH=8.13, CMB0=100 mg/L, and CMI0=100 mg/L. c Desorption of adsorbed WSAC2-900 in different metal solutions. d Impact of temperature on the adsorption capacity of WSAC2-900 activated carbon at adsorbent =10 mg, adsorbents=25 ml, pH=8.13, and C0=400 mg/L. e Thermodynamic model of methylene blue adsorption by WSAC2-900 activated carbon. f Effect of adsorption/desorption cycles on the equilibrium adsorption capacity of MB on MPPMC at adsorbent =10 mg, adsorbent=25 ml, T=299 K, pH=8.13, and C0=100 mg/L

In addition to the effect of H+ on MB adsorption, the potential competition of coexisting cations for electrostatic sites must also be considered. As shown in Fig. 7b, common cationic perturbations, including K+, Na+, Mg2+, Ca2+ and Fe3+, were investigated. The results show that, except for Fe3+, other ions have less effect on MB adsorption, indicating that the higher the valence state of interfering ions is, the more obvious the effect on MB adsorption. To better verify this phenomenon, the adsorption of WSAC2-900 on monovalent, bivalent and trivalent ions was considered only without the addition of MB, and WSAC2-900 exhibited a high removal rate of Fe3+, which was basically in agreement with the results of the point-line diagram. Figure 7c shows the displacement of MB molecules by coexisting cations. An experiment was performed in a 338 K water bath in which WSAC2-900 was immersed after the complete adsorption of MB to KCl, NaCl, MgCl2, CaCl2, and FeCl3. In contrast to the control, the FeCl3 solution turned green rapidly and became darker, which indicated that FeCl3 strongly displaced the MB molecules and could desorb the MB molecules well.

3.2.4 Thermodynamic studies

Adsorption experiments of MB were conducted in the temperature range of 283 K to 313 K to investigate the thermodynamic characteristics of MB adsorption by WSAC2-900. Figure 7d shows that at 283 K, the adsorption capacity is 468.1695 mg/g, and when the temperature is increased to 313 K, the adsorption capacity reaches 548.2178 mg/g. The results show that the kinetic energy of MB increases with increasing temperature, which increases the frequency of MB molecules approaching the active sites on the surface of activated carbon and the adsorption capacity [76, 77]. The fitted curve and thermodynamic parameters were calculated by the van’t Hoff equation, and the linear relationship between lnKL and 1/T is shown in Fig. 7e (R2 = 0.9800). The entropy change △S° and enthalpy change △H° can be obtained by calculating the intercept and slope.

According to the data analysis results from Table 6, both △S° and △H° are positive, indicating that the adsorption of MB by WSAC2-900 is an endothermic process and that the disorder of the system increases during the adsorption process, which is consistent with the general trends observed in nature [78, 79]. The system's ΔG° is negative, indicating that the adsorption process is spontaneous, which is highly beneficial for facilitating the adsorption reaction. Moreover, as the temperature increases, the value of ΔG° slightly decreases, suggesting that temperature does not have a significant impact on the progress of the adsorption reaction. Additionally, the decrease in the Gibbs free energy of the system also indicates that the system is evolving towards a more stable and lower energy state [80]. These findings collectively validate the effectiveness of WSAC2-900 in adsorbing MB.

Table 6 The thermodynamic parameters of MB adsorption on WSAC2-900 at adsorbent =10 mg, adsorbent =25 ml, T = 299 K, pH = 8.13, and C0 = 400 mg/L were studied

3.2.5 Study on regeneration performance

The reusability of biomass char is an important factor in evaluating its application value. To assess the regeneration performance of WSAC2-900 after adsorbing MB, adsorption–desorption cycle experiments were conducted. As shown in Fig. 7f, after the first adsorption, the adsorption capacity and removal rate reached 249.6 mg/g and 99.8%, respectively. With an increase in the number of adsorption cycles, after completing the third adsorption experiment, the adsorption capacity and removal rate decreased to 39.0 mg/g and 15.6%, respectively. This decrease occurred because the active sites on the surface of WSAC2-900 were not completely desorbed, leading to a decrease in the number of available adsorption sites and a lower removal rate. Therefore, the maximum usage cycle for WSAC2-900 is three cycles.

3.2.6 Adsorption mechanism

Figure 8 summarizes the main mechanisms of MB adsorption by WSAC2-900. Based on the zeta potential diagram of WSAC2-900 shown in Fig. 4b, it can be inferred that when the pH of the MB solution is greater than the pHpzc, electrostatic interactions are the primary adsorption mechanism. Electrostatic force adsorption is mainly derived from the interaction between oxygen-containing functional groups in WSAC2-900 and cationic MB [56]. When the pH of the MB solution is below the pHpzc, excess H+ competes with MB cationic groups for limited adsorption sites, leading to a reduction in the electrostatic interactions between WSAC2-900 and the cationic dye. At this point, noncovalent π-π interactions and hydrogen bonding between methylene (-CH2-) and hydroxyl (-OH) groups and MB molecules became the dominant binding forces. Hydrogen bonds are formed by the combination of the hydroxyl group on the surface of WSAC2-900 with the N atom of the MB dye, while noncovalent π-π interactions are formed by the combination of the aromatic ring of the MB dye with the hexagonal structure of WSAC2-900 [65]. The entire adsorption process is controlled by various adsorption mechanisms, including van der Waals forces, electrostatic interactions, hydrogen bonding, and noncovalent π-π interactions, with physical adsorption being predominant, accompanied by some degree of chemical adsorption.

Fig. 8
figure 8

Mechanisms of MB adsorption on WSAC2-900

4 Conclusions

Walnut shell activated carbon WSAC2-900, prepared with potassium carbonate as an activator, has good adsorption properties for methylene blue. The structure, morphology and surface functional groups of the activated carbon were determined by XRD, nitrogen adsorption/desorption, SEM, FTIR and zeta potential measurements. In the XRD pattern of WSAC2-900 after activation, two broad peaks were detected at 2θ = 20.64° and 43.68°, which are attributed to the (002) and (100) planes, respectively, of the disordered carbon structure. The specific surface area and pore volume of WSAC2-900 were 1690.9842 m2/g and 0.5963 cm3/g, respectively. SEM images show that the surface of activated carbon is rich in pore structures containing various small channels, which is conducive to the transport of MB molecules and enhances the adsorption capacity. FTIR analysis revealed that -OH, C-H and C=O were involved in the adsorption of MB on the WSAC2-900 surface, and the adsorption process was controlled by van der Waals forces, electrostatic interactions, hydrogen bond interactions and noncovalent π-π interactions. A zeta potential diagram showed that with increasing solution pH, the negative charge of the activated carbon increased, and the adsorption of the cationic dye MB increased. The isotherms, kinetics and thermodynamics of MB adsorption by WSAC2-900 were investigated. The adsorption capacity of MB on WSAC2-900 was 557.5462 mg/g, and the adsorption process was in accordance with a pseudo-second-order kinetic model. At 283 K, 293 K, 303 K and 313 K, the maximum adsorption capacities of MB were 468.1695 mg/g, 506.3057 mg/g, 524.4298 mg/g and 548.2178 mg/g, respectively. Activated carbon can be reused up to three times. In addition, the mechanism of MB adsorption by WSAC2-900 was discussed.