1 Introduction

Nowadays, water pollution by industrial dyes is a principal concern for the scientists, due to their toxicity to the environment and human health [1], and must be combatted by adopting suitable strategies. The textile industry is one of principal sources of serious pollution problems, and its effluents contain various toxic dyes, including methylene blue (MB). During the dyeing process, approximately 2 to 20% is released directly into the environment as wastewater. Therefore, it is crucial to treat wastewater contaminated with dyes before releasing them into water resources [2]. Dyes fall into three categories: anionic, cationic, and non-ionic [3]. Methylene blue (MB) is one of the most vastly utilized dyes in many industries [4]. The presence of methylene blue in the waters makes them undesirable for industrial and domestic use [5, 6]. Due to the high toxicity of MB, its existence in the water will cause serious damages to the human body, causing symptoms like dizziness, nausea, jaundice, anemia, chest pains, and even nerve damage [3, 7]. Therefore, water bodies containing MB dyes must be subjected to treatment processes which have the ability of its removal from the aquatic environment.

In adsorption technology, the focus in wastewater management is currently transitioning from traditional adsorbents to biosorbent materials, which hold significant promise for applications in environmental regulation and the retrieval of metals [8, 9]. For adsorption methods, carbonaceous materials with porous structures (biochars and activated charcoals) have exhibited splendid properties as adsorbents for both organic and inorganic contaminants, in recent years [11, 12]. Similar to activated charcoal, low-cost biochar production plays an imperative role in water purification, thanks to its superior structural properties, viz. great specific surface areas, high total pore volumes, splendid chemical stabilities, and better hardnesses [9]. However, biochar is much cheaper to produce than activated charcoal. Indeed, the biochar preparation process does not require additional activation (neither physical nor chemical) and high temperatures for carbonization (that is, > 1000 °C) [13, 14].

Several researchers have exploited various agricultural wastes and natural materials for preparing biochar, through pyrolysis, such as wood [15], olive husk [16], bamboo wood, nut shells [17], sawdust [10], rice hulls [18], algae [19], coconut fiber [20], Tectona grandis tree sawdust [14], pepper stems [21], sawmill residues date palm petioles [22], and biomass polymeric substances [23] [24]. Some produced biochars from wastes, as well as ashes and activated carbons, have been used for methylene blue removal from waters and wastewaters. For instance, Yang et al. [25] used industrial food waste digestate as a widely available feedstock to produce ash-biochar composites for the removal of methylene blue (MB) from contaminated wastewater. The resulting ash-biochar composites exhibited a maximum MB adsorption capacity of 1123.5 mg/g. Mechanistic and modeling assessments revealed that the ash components on the ash-biochar composite surface enhanced MB removal by providing an alkaline adsorption environment and more oxygen-based n-π interaction sites. Additionally, increasing the pyrolysis temperature expanded the biochar surface area and uniformly rearranged the carbon structure, strengthening the π-π interactions between MB and the ash-biochar composites adsorbent. Biochar offers significant environmental and economic benefits, including carbon sequestration, improved soil fertility, enhanced water retention, and the ability to adsorb pollutants. It is a low-cost product that can utilize agricultural waste, contributing to better waste management and reduced greenhouse gas emissions. However, biochar production is energy-intensive and can result in inconsistent quality due to variability in feedstock and pyrolysis conditions. Initial investment costs and limited market demand are economic constraints, while long-term soil impacts and potential contaminant introduction pose environmental risks. Additionally, the lack of standardized guidelines and limited public awareness may hinder its widespread adoption [26, 27].

In the present work, agricultural waste-based biochar from neem tree shells was produced (named B-700) by pyrolysis of the waste precursor This biomass was selected as the raw material for biochar production due to its abundant availability in the study region. These agricultural wastes are frequently burned or discarded, resulting in a loss of valuable resources. By converting neem barks into biochar, we provide a sustainable solution for waste management and simultaneously produce a material with advantageous properties for water treatment. This approach not only reduces environmental waste but also enhances resource utilization and offers potential benefits for addressing water pollution. FTIR analysis, BET measurements, SEM images, and pHZPC were used to characterize the adsorbent. After investigating characteristics, the prepared biochar was subjected to different tests as an adsorbent for the removal of MB dye as a contaminant of waters, checking the effects of physiochemical variables. Then, extensive work was performed on scrutinization of the adsorption properties; by using different mathematical models Langmuir, Freundlich, Temkin, Dubinin–Radushkevich, Khan, Sips, Toth, and Redlich-Peterson models were used to evaluate parameters such as maximum adsorption capacity (Qmax), affinity constant (KL), adsorption intensity (1/n), average adsorption energy (E), and system heterogeneity. Additionally, kinetic parameters including the pseudo-first-order rate constant (k1), pseudo-second-order rate constant (k2), intraparticle diffusion coefficient (kip), the Elovich parameters, and the Avrami model factors were determined to understand the adsorption properties of the new biochar. Thermodynamic analysis was also conducted to calculate changes in free enthalpy (ΔG°), enthalpy (ΔH°), and entropy (ΔS°) to assess whether the adsorption process is spontaneous and to determine if it is endothermic or exothermic.

2 Experimental

Neem tree shells (B-700’ precursor) were harvested in Sétif from Algeria and used as raw material. The precursor small pieces were subjected by a complete wash: first with the city water till becoming clear, then complete rinsing with deionized water to remove any impurity existing with the shells. Subsequently, the shell pieces were oven-dried at 110 °C for 48 h. Following the drying phase, the desiccated material underwent grinding and sieving to attain the desired particle dimensions of 200 µm. Subsequently, the precursor was subjected to gradual heating from ambient temperature to 700 °C, employing a heating rate of 5.0 °C per minute, and kept at 700 °C for a duration of 3 h. Actually, the temperature of 700 °C was selected after preliminary adsorption studies, which showed its superiority for MB adsorption, compared to biochars prepared at both higher and lower temperatures. The pyrolysis procedure was executed within a controlled oxygen-deficient environment, utilizing a crucible encased in porcelain. The methodology adopted for this stage closely followed the guidelines outlined by Chahinez et al. [21, 22, 28].

Methylene blue (cationic type, chemical formula, C16H18ClN3S; M, 319.86 g mol−1; solubility, 1 g/25 mL at 298 K) was acquired from Aldrich (USA). Doubly-distilled water was employed for building all diluted solutions (1 to 200 mg/L), and all utilized substances were of analytical grade.

Following the process of pyrolysis conducted underneath controlled oxygen-depleted circumstances, the biochar specimen underwent immersion in a 0.10 M HCl solution. Subsequently, it was subjected to successive rinsing cycles utilizing hot deionized water, continuing till the filtrate pH attained a level of neutral. The resultant biochar, originating from neem tree shells (B-700), was ultimately oven-dried at 110 °C for a duration of 24 h to ensure that moisture content remained below 5%. This prepared biochar was then securely stored within a desiccator until future usage.

The prepared biochar through the carbonization process at temperatures surpassing the raw material’s final threshold temperature primarily comprises carbon owing to complete thermal degradation of volatile organic components like hemicellulose and cellulose. This transformation yields porous materials as a result [6, 20]. Consequently, for the purposes of this investigation, in this study, we have centered to use the biochar generated at 700 °C for both characterization and adsorption analyses.

The prepared sorbent was subjected to characterization by Fourier transform infrared spectroscopy (FTIR; exploiting JASCO 6800 IR instrument). The textural features of the biochar, encompassing parameters like BET surface area (SBET), pores volume, and pores size, were ascertained using conventional analyses of N2 adsorption–desorption isotherm at 77 K. Such analyses were performed utilizing a Quantachrome Instruments device at a temperature of 77 K. Micrographs for assessing the surface morphology were taken from a (FESEM, JEOL, JSM-7001F) field emission scanning electron microscope (FESEM).

The solution acidity at the point of zero charge (pHpzc) signifies the value of pH where the adsorbents’ surface holds no net charges. This determination was conducted using a UV–visible spectrophotometer “SHIMADZU UV-1900 i” and a pH meter “WTW Inolab 7110.” In the current study, for determining of ZPC point pH, the initial pH of NaCl-containing (0.01 mol/L) was adjusted at values in the 2–13 span, using HCl or NaOH. Subsequently, at a temperature of 25 ± 1 °C, 25 mL samples of NaCl were individually combined with 25 mg of biochar and subjected to mechanical agitation for 50 h, with the resulting final pH value being documented. The drift method was used, and the experimental outcomes were plotted, and the pHPZC value was identified from the intersection point of the graph [29].

The knowledge of the physicochemical and structural properties of any solid support is essential to contribute to grasping the phenomena such as adsorption and desorption. Hence, after structural characterizations, adsorption experiments were conducted in closed vials containing 100 mL of MB solutions at the specified level. The dye-containing aqueous phase and adsorbent were agitated at a specified temperature and contact durations, at an agitating speed of 200 rpm. Afterward, the biochar was isolated by filtration through a 45-μm filter, and the remained level of the dye was determined. The amount of MB dye was measured exploiting a UV–Vis spectrophotometry method (by a SHIMADZU UV-1900 instrument) at the wavelength of maximal absorption (λ max = 664 nm). The Beer-Lambert was exploited for deducing the final MB concentrations.

The experimental results were adopted to evaluate the effects of agitation time, dye level (1 to 200 mg/L), temperature (15, 25, 35, and 45 °C), and pH (2 to 11) at constant biochar dosage (0.5 g/L) to determine the optimal circumstances for maximal removal of the MB dye. The amount of dye uptaken by the solid support at the specified time (qt) and equilibrium (qe) in mg/g and adsorption efficacy (R%) were measured from Eqs. (1)–(3):

$${q}_{\text{t}}=\frac{\left({C}_{0}-{C}_{\text{t}}\right)\times V}{m}$$
(1)
$${q}_{\text{e}}=\frac{\left({C}_{0}-{C}_{\text{e}}\right)\times V}{m}$$
(2)
$$R\%=\frac{\left({C}_{0}-{C}_{\text{t}}\right)}{{C}_{0}}$$
(3)

where C0, Ct, and Ce are dye concentrations (mg/L) at the beginning, specified time, and at equilibrium, respectively. V (L) is the dye solution volume, and m (g) is the amount of sorbent.

For the modeling of the adsorption process, several adsorption models of kinetics and isothermal mathematical equations were exploited to elucidate the process of adsorption. The detailed information and route of derivation of these models have been gathered by Tran et al. [28]. Nonlinear forms of kinetic models, viz. NPFO (nonlinear pseudo-first order), NPSO (nonlinear pseudo-second order), Elovich, Avrami, and intraparticle diffusion mathematical relations can be expressed in the Eqs. (4), (5), (6), (7), and (8), respectively.

$${q}_{\text{t}}= {q}_{\text{e}} (1-{e}^{\left(-{k}_{1}t\right)}$$
(4)
$${q}_{\text{t}}= \frac{{k}_{Z}\times {q}_{e}^{2}}{1+{q}_{e}{\times k}_{2}\times t}$$
(5)
$${q}_{\text{t}}=\frac{1}{\beta }\times \text{ln}(\alpha \times \beta \times t)$$
(6)
$${q}_{\text{t}}={q}_{e} (1-{e}^{-({{K}_{av.}t)}^{{n}_{\text{av}}}})$$
(7)
$${q}_{\text{t}}={K}_{ip}\times {t}^{{~}^{1}\!\left/ \!{~}_{2}\right.}+C$$
(8)

where k1 is the NPFO rate constant (1/min), k2 is that of the NPSO equation (g/(mg min)), α is the sorption rate at the beginning (mg/(g min)), β is related to the coverage extent of the surface and the activation energy related to the chemisorption (g/mg), kAV is the Avrami kinetic constant (1/min), nAV is a fractional sorption order corresponding to the adsorption mechanism, ki-p is the IPD (intraparticle diffusion) velocity constant (mg/(g min1/2), and C is constant of intraparticle diffusion model (mg/g).

Regarding adsorption isothermal evaluations, Eqs. (9)–(16) express the nonlinear mathematical relations of Langmuir, Freundlich, Temkin, Dubinin–Radushkevich, Khan, Sips, Toth, and Redlich-Peterson adsorption isotherms, respectively.

$${q}_{\text{e}}= \frac{{Q}_{\text{max}}{K}_{\text{L}}{C}_{\text{e}}}{1+{q}_{\text{e}}{C}_{\text{e}}}$$
(9)
$${q}_{\text{e}}= {K}_{\text{F}}{C}_{e}{~}^{(1}\!\left/ \!{~}_{n)}\right.$$
(10)
$${q}_{\text{e}}=Bln\left({AC}_{\text{e}}\right)$$
(11)
$$q_\text{e}=q_{DR}e^{-K_{DR}}\mathcal E^2;\;\varepsilon=RT\text{ln}(1+\frac1{C_\text{e}}$$
(12)
$${q}_{\text{e}}= \frac{{q}_{\text{s}}{b}_{\text{K}}{C}_{\text{e}}}{{(1+ {b}_{K}{C}_{e})}^{{a}_{K}}}$$
(13)
$${q}_{\text{e}}= \frac{{q}_{\text{max}} {({K}_{\text{S}} \times { C}_{\text{e}})}^{{~}^{1}\!\left/ \!{~}_{n}\right.}}{1+({{K}_{\text{S} }\times { C}_{\text{e}})}^{{~}^{1}\!\left/ \!{~}_{n}\right.}}$$
(14)
$${q}_{\text{e}}= \frac{{q}_{\text{max} }{K}_{\text{T}} {C}_{\text{e}}}{{\left[1+{ ({K}_{\text{T}}{C}_{\text{e}})}^{n}\right]}^{{~}^{1}\!\left/ \!{~}_{n}\right.}}$$
(15)
$${q}_{\text{e} }= \frac{{K}_{\text{RP} }{C}_{\text{e}}}{1+ {a}_{\text{RP} }{{C}_{\text{e}}}^{n}}$$
(16)

where \({Q}_{\text{max}}^{^\circ }\) is the maximal Langmuir adsorption capacity of the B-700 (mg/g), KL is the Langmuir constant (L/mg), KF is the Freundlich constant (mg/g)/(mg/L), n is the Freundlich intensity parameter (dimensionless), A and B are Temkin isothermal constants, and other parameters have been described elsewhere [2].

In all modeling evaluations conducted in the current work, the nonlinear fitness was performed by Solver in Excel to minimize the error functions for models, and also the calculation of all parameters in adsorption kinetics and isotherms was performed by the same software.

The difference betwixt the values qe or qt acquired from the experiments (qe,experimental or qt,experimental) and the model (qe,model or qt,model) was reflected by the coefficient of determination (R2), the adjusted coefficient of determination (R2adj) [23, 30, 31], and another statistical index (χ2).

$${R}^{2}=1-\frac{\sum {({q}_{\text{e},\text{exp}}-{q}_{\text{e},\text{model}})}^{2}}{\sum {({q}_{\text{e},\text{exp}}-{q}_{\text{e},\text{mean}})}^{2}}$$
(17)
$${R}_{\text{Adj}}^{2}=1-\left(1-{R}^{2}\right) \times \left(\frac{n-1}{n-p-1}\right)$$
(18)
$${\chi }^{2}=\sum \nolimits_{i=1}^{N}(\frac{({q}_{\text{e},\text{exp}}-{q}_{\text{e},\text{cal}}{)}^{2}}{{q}_{\text{e},\text{cal}}})$$
(19)

where qe,mean is the average of the qe,exp amounts, n is the tests’ number, and p is the parameters’ number in each of the studied models. The most suitable model has the highest values of R2adj and R2 and the lowest values of χ2.

3 Results and discussion

3.1 Characterization of adsorbents

The FTIR spectra of raw neem tree shell biomass and the B-700 samples are illustrated in Fig. 1a. In both spectra, we have observed bands with different intensities at around 3300–3350 cm−1, which are indicative of O–H stretching vibrations. The gross biomass exhibited a characteristic peak at approximately 2909 cm−1, which is probably assignable to the stretching vibrations of C-H moieties in methyl and methylene. This peak disappeared after pyrolysis due to the decrease in aliphatic components [32]. The peak at a stretching frequency of 1613 cm−1 is assigned to the presence of the C = C group in lignin [33], which is an aromatic compound. Furthermore, the peak observed at 1320 cm−1 may likely be assignable to the stretching vibrations of C–C and C-N bond stretches [34]. Additionally, the characteristic peak with a lower intensity of 1045 cm−1 can be associated to the stretching vibrations of C–O–C bonds found in cellulose, hemicellulose, and lignin [35]. The scattering of peaks following pyrolysis and the appearance of distinct peaks in the biochar spectrum at 1430 cm−1 indicate the stretching of the C–C aromatic ring and off-plane deformation caused by aromatic C-H groups at 885 cm−1 [36].

Fig. 1
figure 1

a FTIR spectra of raw biomass ((A) black line) and B-700 sample ((B) red line) and b pore size distribution for biochar B-700 derived from adsorption/desorption isotherm of nitrogen gas at 77 K

Figure 1b and Table 1 present the texture analysis findings for B-700 biochar. This biochar demonstrates a surface area of 229 m2/g, which is not particularly high, primarily due to its limited microporosity, estimated at 0.08 and 0.092 cm3/g using the t-plot and D-R methods, respectively. However, it surpasses certain other biochar variants discussed in the literature by Xu et al. such as rice straw (with values of 123 m2/g and 0.189 cm3/g) [37], as reported by, and eggshell (with values of 5.3 m2/g and 0.009 cm3/g), also reported by Xu et al. [37]. Additionally, when compared to composite biochar (biochar-ZnO) reported in the same source, B-700 biochar demonstrates superior characteristics, boasting a surface area of 49.39 m2/g and a microporosity of 0.078 cm3/g [38].

Table 1 Textural characteristics of biochar B-700

On the contrary, this material possesses a substantial mesoporous fraction, with estimates of 0.036 cm3/g and 0.023 cm3/g estimated through the t-plot and D-R methods, respectively. These mesopores are characterized by an average size of 3.84 nm. Furthermore, the microporous volume values derived from both the t-plot and D-R methods indicate that B-700 is primarily composed of micropores smaller than 7 Å in size, classified as ultra-micropores according to the t-plot method. Notably, 20% of these micropores exhibit an average diameter ranging from 7 to 20 Å.

There are various factors contributing to the specific surface areas of the synthesized biochars, including the pyrolysis conditions employed, the choice of diverse feedstocks, and the potential utilization of activation techniques. To gain a comprehensive understanding of the influences on biochar properties, it is crucial to undertake rigorous experimentation and adsorption analysis.

Figure 2 illustrates the SEM micrograph of two samples: (a) biochar B-700 and (b) the original biomass. It shows a diverse structure with pores present in both samples. Notably, biochar B-700 displays a notably higher level of porosity in comparison to the raw biomass. This heightened porosity is a result of the degradation of lignin and cellulose caused by the pyrolysis process within the biochar’s composition [28].

Fig. 2
figure 2

SEM microstructures: (a) biochar B-700 and (b) raw biomass

The porosity observed after pyrolysis of the raw material is a consequence of thermal decomposition, structural changes, carbonization, gas evolution, and chemical transformations that collectively lead to the creation of a more porous material. This increased porosity is advantageous in various applications, including adsorption processes, as it provides a larger surface area and greater accessibility for molecules to interact with the material.

To verify the porous nature of biochar B-700, we will conduct a specific surface area characterization. The presence of pores in biochar B-700 holds the promise of substantially improving the efficiency of the provided adsorbents for the removal of MB molecules from aquatic environments.

The electrical state of the surface of adsorbent in aqueous phases is generally characterized by the zero point of charge (ZPC). This point can be described as the solutions’ circumstance in which the density of surface’s charge is equal to zero. Usually, methods like potentiometric titration or similar procedures are recruited for the determination of ZPC pH, by determining the point at which ionic strength has no effect on the density of surface charge, when the used electrolyte for adjusting ionic strength is inert [39, 40]. Figure 3 illustrates the curve depicting the PZC of B-700 and its impact on the adsorption phenomenon. The pHPZC value of B-700 was found to be 8.22, as depicted in Fig. 3. This pHPZC value signifies that the biochar’s surface carries a negative charge when the pH of the solution is greater than 8.22 (pH > pHPZC), which enhances the absorption of the MB dye present in the solution. Conversely, when the pH drops below the pHPZC value (pH < pHPZC), the surface of this adsorbent becomes positively charged, rendering the adsorption of cationic dyes like MB less favorable [41].

Fig. 3
figure 3

Zero point of charge (ZPC) curve of B-700

3.2 Biochar B-700’s adsorption study

3.2.1 Influence of pH on sorption

To investigate the influence of the impacts that pH levels impose on the adsorption process, from dye aqueous phases, a series of experiments were conducted within the pH range spanning from 2.0 to 12.0. The changes in the quantity of sorbed dye as a pH function are visually depicted in Fig. 4. As one may know, when the pH is less than the pHPZC value, the surface of this adsorbent acquires a positive charge, rendering the adsorption of cationic dyes like MB less favorable. In fact, the outcomes vouchsafe that the adsorption of dye by the adsorbent is strongly correlated with the pH level of the solutions. Notably, the retention of MB dye by B-700 experiences a notable increase as the solution’s pH shifts toward the alkaline side, particularly within the pH range of 8 to 9, surpassing the pHPZC threshold of 8.22. In essence, the quantity of dye retained by B-700 in various solutions is intricately tied to the solution’s pH, with a pronounced enhancement in MB dye retention observed as the pH becomes more basic.

Fig. 4
figure 4

The pH’s influence on the adsorption phenomenon

Because of the basic nature of the MB, its dissolution in water causes the formation of ions which are positively charged and can explain increased dye sorption extend in the presence of increased negative charges of biocar’s surface in the high pHs. Hence, in addition to other forces, the electrostatic attractions may play a major role in the dye sorption onto B-700. Such interaction mechanisms are principally controlled by the level of pH of the aqueous phase and can elucidate the changes in the MB’s removal efficacy in the process [39]. Therefore, the dye retention capacity of biochar started to rise at pH = 2 and reached its maximum at a pH as high as 8.5. Nevertheless, because of the augmentation of concentration hydroxide anions at very high pH levels, the adsorption capacity of the biochar declines at these pH levels.

3.2.2 Impact of contact time on adsorption and kinetic scrutinization

The kinetics of the adsorption process should be examined in order to ascertain the pace at which wastewater is treated to remove methylene blue (MB) dye. This data is essential for creating effective treatment plans and making sure the procedure can work within reasonable time limits. Additionally, the kinetic analysis sheds light on the possible mechanisms—such as mass transfer, chemical reaction, or diffusion—that may be in charge of the adsorption process.

The impact of contact duration on the adsorption process of MB dye onto B-700 biochar is demonstrated in Fig. 5a, while the employed kinetic models are fitted in Fig. 5b. The associated constants and statistical errors are summarized in Table 2. As the outcomes vouchsafe, for all dye levels studied, within the first 50 min of contacting, the removal extent of the dye from the solution (adsorption onto B-700) steadily increased, reaching approximately the maximal levels of adsorption, and after that, the adsorption amounts are marginal. This rapid uptake can be assignable to copious active sites on the B-700 absorbent surface, facilitating substantial removal activity. However, as these adsorption sites gradually became saturated, the adsorption rate subsequently decelerated [39]. In fact, for complete equilibrium, the initial 50 min of contact between biochar B-700 and the dye proved insufficient, and the system gradually attained equilibrium after a longer contact period, which took nearly 3 h to reach. At this equilibrium point, B-700 exhibited adsorption capacities of 46, 81, 83.54, and 105.73 mg/g at initial concentrations of 25, 50, and 75 mg/L, respectively.

Fig. 5
figure 5

(a) Influence of contact time on the adsorption capacity of B-700 for the dye (experimental conditions: Co = 25, 50, and 75 mg/L; pH = 9; m/V = 0.5 g/L; and T = 25 °C), (b) fitness of several kinetics equations with the data at the mentioned conditions, and (c) intraparticle diffusion plots for MB adsorption on B-700 at the mentioned conditions

Table 2 Kinetics parameters for the adsorption of methylene blue (MB) onto biochar B-700

In the current study, we analyzed time-dependent adsorption data using four distinct kinetics models. These models were assessed based on correlation coefficients (R2) and their alignment with experimental results. Notably, the R2 values for NPSO kinetics surpassed those for NPFO kinetics, and the calculated qe values closely mirrored the experimental qe. These findings suggest that the most accurate representation of sorption kinetics is provided by the pseudo-second-order kinetic model. Some researchers have mentioned that the pseudo-first-order model posits physical adsorption, where the rate of solute absorption over time is directly proportional to the solute concentration-to-solid quantity ratio [42], while the pseudo-second-order kinetic model is founded on the assumptions that the rate-limiting stage might involve chemical adsorption or chemisorption, characterized by valence forces via exchange or sharing of electrons betwixt sorbents and sorbates [43]. Although such conclusions seem to be rational, the decision about the nature of the sorption process should be made by considering other studies like thermodynamic ones. By and large, one can claim that, when the NPSO model has a high goodness-of-fit with the data, the interaction between sorption sites and adsorbate molecules is the rate-controlling stage.

Avrami’s fractional order model also gave a better fit (\({R}_{\text{adj }}^{2}\) larger than 0.993) for the given experimental outcomes, whose Avrami kinetic constants at 25, 50, and 75 mg/g were respectively 0.068, 0.080, and 0.091 (1/min). The Avrami exponent (nAV) was larger than 0.571. The values were betwixt 0 to 1, suggesting that the adsorption mechanism is probably managed by diffusion [30].

The plots shown in Fig. 5c indicate multilinearity, suggesting the occurrence of multiple distinct steps, which illustrates a graph representing the linearized form of the intraparticle diffusion model for the investigated concentrations. For example, at the dye concentration of 25 mg/g, it reveals that the initial phase, characterized by rapid external surface adsorption, concludes within the first 50 min, followed by the controlled intraparticle diffusion phase (step 2), which persists from 50 to 100 min. Subsequently, the equilibrium adsorption phase (stage 3) commences after 100 min. However, for higher concentrations, the first two stages take shorter times. Also, a fourth stage can be assumed for the highest studied concentration (75 mg/L), which is related to the most inner pores of the biochar beads. During this stage, methylene blue undergoes gradual transport through intraparticle diffusion into the beads and eventually becomes entrapped within the micropores. Typically, the slope of the line observed during these stages is related to as the intraparticulate diffusion rate constant [37]. Generally, the first part corresponds to the rapid external surface sorption (instantaneous sorption), the second part represents the controlled progressive sorption with intraparticle diffusion regulation, and the next parts signify the equilibrium stages where intraparticle diffusion slows down due to exceedingly low adsorbate concentrations in the solution [37]. The result serves to visualize the linear forms of the intraparticle diffusion model at the analyzed dye levels and also highlights the presence of external surface adsorption in the initial step, completed within the first minutes of contact. Subsequently, the intraparticle diffusion through larger pores (next steps) extends, followed by another next step and, finally, the onset of equilibrium sorption (stage 3 for initial dye concentrations of 25, and 50 mg/L and stage 4 for initial concentration of 75 mg/L). During this process, methylene blue molecules gradually interact with the sorption sites even in the most inner parts of the beads (i.e., the most inner micropores). The following tips can be inferred from the results:

The first phase, which is marked by fast exterior surface adsorption, is finished in the first 30 min at lower dye concentrations. This stage is the immediate sorption of MB molecules onto the biochar’s exterior surface. Because there are more MB molecules available at greater concentrations, which quickly saturate the exterior surface sites, this phase lasts shorter. In the second phase, a harsher control is exerted for intraparticle diffusion into narrower pores which are still near the beads’ surface. The equilibrium adsorption phase happens sooner at lower dye concentrations, like at 25 and 50 mg/L whose equilibrium is completed at stage three. As the concentration of MB molecules in the solution decreases and achieves equilibrium, the adsorption rate slows down during this phase. However, an extra step that appears at the highest dye concentration (75 mg/L) is probably the result of MB molecules diffusing into the biochar’s innermost micropores. This step denotes a deeper penetration into the sorbent structure with the progressive transit and trapping of MB within the finest interior pores.

3.2.3 Adsorption isotherm and effect of initial dye level

To comprehend how MB dye molecules interact with the biochar surface at various concentrations, it is crucial to look at isotherm research. It is possible to ascertain the adsorption capacity, surface characteristics, and affinity of the biochar for MB by fitting the experimental data to several isotherm models. This information aids in forecasting the performance of the biochar in practical applications and in the optimization of the adsorbent dose.

The experimental outcomes of equilibrium sorption were acquired underneath batch runs by changing initial levels of MB dye from 10 to 200 mg/L and maintaining the sorbent/liquid ratio of 0.5 g/L at different temperatures 15, 25, 35, and 45 °C. To recognize the nature of the sorption phenomenon, the shape of isothermal curves is one of the primary tools which can be evaluated [44]. The data shows that increasing the temperature has a positive on the removal percentages (Fig. 6a–d). Also, the functions of MB molecules’ adsorption (qe versus Ce) at different temperatures have been demonstrated in Fig. 6e–h which vouchsafe that the extends of adsorption are slightly higher at higher temperatures. The raise of dye concentration is one of the most important stimulates in the adsorption process, although other factors can sometimes have a valuable effect on the sorption extend. The isotherms (Fig. 6e–h) show that, at the low Ce values, the slope of the curves is quite steep, which imply to the high affinity of biochar for MB adsorption.

Fig. 6
figure 6

MB adsorption percentage versus initial concentration at various temperatures (ad) and different functions (isotherms) of MB adsorption (eh) onto the produced biochar at various temperatures (experimental conditions: C0 = 10–200 mg/L, pH = 8.5, m/V = 0.50 g/L, and time (t) = 200 min)

The results obtained from isothermal modeling are reported in Table 3. One can grasp from the results that the Langmuir model, along with some three-parameter equations including Redlich-Peterson, Sips, and Khan equations, has a good fitness with the experimental data, vouchsafing the monolayer sorption mechanism. Also, the exponent values of the three-parameter models are near unity, which is another proof of the monolayer mechanism of the process [2]. These studies show that the best match for our experimental results in this investigation was given by the Langmuir isotherm model, which implies that adsorption takes place on a homogenous surface with a finite number of identical sites. According to this monolayer adsorption method, each dye molecule occupying the charcoal surface takes up a particular location without interacting with other adsorbed molecules.

Table 3 The values of parameters for isothermal models exploited in the equilibrium evaluations

Maximum quantity values for qmax (mg/g) for the prepared biochar at the studied temperature varies from 126.39 to 151.17 mg/g, showing the large potential of the biochar for MB removal plans, from waters and wastewaters.

3.2.4 Adsorption thermodynamics

Thermodynamic assessments are essential to identify adsorption routes. The degree of randomness at the solid–liquid interface and the type of the adsorption, including whether it is endothermic or exothermic, may be inferred from parameters like enthalpy (ΔH°), entropy (ΔS°), and Gibbs free energy (ΔG°). These elements are essential to comprehending the energy shifts that occur during adsorption and guaranteeing the process’s stability and effectiveness in a range of environmental circumstances. The endothermic nature of the adsorption process in our investigation, as indicated by the positive enthalpy change (ΔH°), suggests that energy is needed to potentially cross the activation barrier for chemisorption. The process is confirmed to be spontaneous by the negative Gibbs free energy (ΔG°), and the possibility of MB adsorption onto the biochar is further supported by the positive entropy change (ΔS°), which indicates greater randomness at the solid–liquid interface during adsorption. The thermodynamic parameters of sorption are usually computed by adopting the thermodynamic laws set out in Eqs. (20) and (21), where ∆G° is the Gibbs energy change, ∆H° is the enthalpy change, ∆S° is the entropy change, and KC is the equilibrium constant (dimensionless).

$$\Delta {G}^{0}=-RT\text{ln}{K}_{C}$$
(20)
$$\Delta {G}^{0}=\Delta {H}^{0}-T\Delta {S}^{0}$$
(21)

which the former shows the relation betwixt ∆G° and equilibrium constant and the latter demonstrates the relationship between ∆G° and ∆H° and ∆S°.

The famous van’t Hoff expression is acquired by substituting Eq. (20) in Eq. (21):

$$\text{ln}{K}_{\text{C}}=-\frac{{\Delta H}^{0}}{R}\times \frac{1}{T}+\frac{{\Delta S}^{0}}{R}$$
(22)

In the current work, \(\Delta {G}^{0}\) was estimated directly from Eq. (20), while ∆H° and ∆S° were determined from the slope and intercept van’t Hoff plot (Fig. 7), respectively, i.e., ln KC plot as a function of 1/T (Eq. (22)).

Fig. 7
figure 7

ln K plot as a function of 1/T for thermodynamic evaluations

The KC values at different temperatures were derived from the Langmuir constant (KL) by multiplying the KL by the molecular weight of the MB dye and 1000 [5, 45, 46].

The thermodynamic characteristics of methylene blue (MB) adsorption onto the prepared biochar are summarized in Table 4. The negative \(\Delta {G}^{0}\) values vouchsafe that the adsorption is favorable and occurs spontaneously, requiring minimal activation energy at the specified temperature [47,48,49]. Additionally, the positive ∆H° value (14.07 kJ/mol) indicates that the adsorption process is endothermic, and the amount (lower than 21.9 kJ/mol) reveals that the physiosorption is predominant, i.e., the adsorption proceeds via physical forces like π-π interaction, hydrogen bonding, cation-π interaction, and electrostatic interactions [2]. This is further supported by the increased quantities of adsorbed MB (qe) and larger equilibrium constant (KC) observed at high temperatures, as reported in previous studies [2, 44, 50]. The positive values of ∆S° suggest that the lower organization is happening at the solid/solution interface during the process which can be attributed to the liberation of water molecules and their replacement with MB molecules.

Table 4 Parameters of thermodynamic studies of MB dye adsorption on B-700

3.3 Comparing biochar performance with other biochars

The comprehensive scrutiny of adsorption properties for neem tree shell-based biochar in the current study indicates that this biochar can be applied for removing MB from waters. Also, it should be mentioned that MB bears structural similarities with some pesticides, pharmaceutical compounds, and other organic compounds that can be adsorbed onto the new biochar via the interaction forces implied in Sect. 3.2.4, i.e., π-π interaction, hydrogen bonding, electrostatic interactions, and cation- π interaction, and therefore can be also applied for removal of such contaminants from waters too [51, 52]. Also, through ion-π interactions, interactions with functional moieties existing in the structure of neem tree shell-based biochar, etc., this biochar can also adsorb anionic and cationic inorganic contaminants. It can be claimed that the high performance of the new biochar toward the adsorption of MB in this study can be taken as a gauge for its ability to remove other harmful contaminants from aqueous solutions. Anyway, before any practical usage, the performance of the new biochar in those systems should be scrutinized and optimized.

To grasp the extent of the performance of the new biochar for MB removal, comparing the adsorption results of this study to those of some other biochars is demonstrated in Table 5. As can be observed, in comparison to biochars produced from other precursor biomasses, tree shell-based biochar causes a good efficiency in the removal of MB from waters, because of its high adsorption capacity. Such a biochar can be produced from neem tree shell wastes with ease and speed and be exploited as an adsorbent for MB removal from aqueous solutions, especially in developing countries [51].

Table 5 Comparing different biochars’ performance toward MB removal with neem tree shell-derived biochar

4 Conclusion

In this study, a sustainable method was successfully adopted to treat methylene blue-laden waters and wastewaters using adsorption technology. Agricultural wastes, specifically neem tree shells, were utilized to prepare biochar (B-700), which was then employed as an adsorbent for dye removal. The biochar demonstrated significant potential for efficiently removing methylene blue from aqueous solutions within a pH range of 8.5 to 9. The equilibrium adsorption data showed excellent alignment with the Langmuir isotherm model, indicating a monolayer adsorption process on a surface with a finite number of identical sites. The biochar exhibited an adsorption capacity of 134.13 mg/g at ambient temperature (25 °C), and this capacity increased to 151.17 mg/g at elevated temperatures (45 °C). This increase underscores the enhanced performance of B-700 at higher temperatures and confirms the endothermic nature of the adsorption process. Kinetic analysis revealed that the adsorption process is relatively rapid, with pore diffusion playing a significant role in the overall adsorption mechanism. This finding highlights the effectiveness of B-700 in quickly addressing dye contamination. The results of this study emphasize the potential of using naturally derived waste materials, such as neem tree shells, as efficient and sustainable adsorbents for wastewater treatment. The successful application of B-700 for the removal of cationic dyes like methylene blue suggests that this approach could be extended to other types of organic pollutants and contaminants. Future research could explore the scalability of this method for industrial applications and assess the long-term stability and reusability of the biochar. Additionally, investigating the performance of B-700 in removing a wider range of pollutants and under varying operational conditions would provide further insights into its practical applicability. Overall, this study contributes to the growing body of knowledge on sustainable waste management and wastewater treatment solutions.