Introduction

Pharmaceutically active compounds (PhACs) play critical roles in curing and deterring the different diseases, an issue which is of utmost importance to the quality of life. With an incessant consumption of PhACs both in veterinary and human rehearsals, a plethora of pharmaceuticals has been detected in wastewater. By and large, the source of PhACs could be the daily consumption, the industrial runoffs, and the medical waste from the point-of-care sewage (do Amaral et al. 2019; El-Shafie et al. 2022; Lindberg et al. 2021; Majumder et al. 2021). The presence of PhACs has therefore arisen as a critical concern for the twenty-first century (Majumder et al. 2021). Generally, PhACs do not exist in the ecosystem as isolated entities. Rather, mixtures of drugs with different pharmacological actions and diverse chemical structures as well as their metabolites exist in the environment. The consequences on the ecosystem are greatly dependent on how complex this mixture is. Nonetheless, it is conceivable that these combinations could prompt serious ecotoxicological impacts depending on their individual effects and whether their interactions are of synergistic or antagonistic nature (do Amaral et al. 2019).

Daunorubicin (DAYN) is an antibiotic of the anthracycline family and is mostly used as anticancer to treat leukemia, breast, and ovarian cancers, lung carcinoma, as well as many sarcomas (Brel et al. 2021). The global DAYN market was approximated to be 1,959.95 million USD in 2021 and is anticipated to further expand to 3610.21 million USD by 2027 (Globenewswire 2022). The existence of DAYN in water (reported to be 26.0 ng/L in surface water) is attributed to the excretion of 13–15% of the DAYN dosage via urine within 24 h (Gouveia et al. 2019; Mahnik et al. 2007). TIGY is a novel tetracycline antibiotic (glycylcycline class) with a broad spectrum of activity and is an FDA-approved therapy for complicated skin and intra-abdominal infections. Tigecycline (TIGY) has been recently approved as a chemotherapeutic agent (Dong et al. 2019; El-Azazy et al. 2021a). TIGY is ranked the first in China and the second in the world, and its consumption in the USA has increased in the last two years from 3,000 to 3,200 tons (Daghrir and Drogui 2013). TIGY concentration in wastewater is 0.11 mg/L. The FDA has updated TIGY administration precautions to reflect the TIGY’s increased mortality (FDA 2017).

Different approaches were used to remove DAYN and TIGY from synthetic and natural wastewater (Table S1). The growing need for economical and high-performance wastewater remediation systems has prompted scientists to explore green and sustainable solutions (Masanizan et al. 2021; Thotagamuge et al. 2021). Among the solutions is the recycling of agro-wastes into beneficial products. Biochar (BC) is a carbon-rich charcoal-like material that could be acquired from the pyrolysis of biomasses under oxygen-limited settings (Sun et al. 2021). Therefore, BC usually possesses a more significant concentration of recalcitrant carbon compared to the fresh parent biomass (Basak et al. 2022). The unique attributes of BC, including high surface area and porous structure, the existence of functionalities, stability, and liability for further functionalization, make it appropriate for innumerable environmental remediation purposes (Osman et al. 2022).

Coffee is a popular beverage worldwide. While preparing a beverage from one ton of coffee beans, ~ 0.65 tons of the grounds are wasted (Nguyen et al. 2021). Because brewing coffee uses just a tiny portion (0.2%) of the bean, vast quantities of waste are created from the ground beans globally. The spent coffee (SC) grounds are normally disposed of by burning or landfilling rather than composting or recycling. Alternative methods of disposing of SC grounds have been intensively researched to resolve these challenges. Since SC grounds are considered a potential energy source, it has been exploited to generate biodiesel and bioethanol (Shin et al. 2020).

In the current approach, the biochar of SC grounds (SCBC) will be recycled and further valorized into a value-added product for remediation of pharmaceutical wastewater. Furthermore, the impact of biochar surface modification with nickel oxide (NiO) nanoparticles on the removal capacity is explored. Nickel oxide (NiO)-impregnated biochar (Ni-SCBC) will be synthesized via the microemulsion-assisted method using oleylamine as a surfactant, which in turn helps forming small- and uniform-sized nanoparticles. Modification with the metal oxide nanoparticles aims to increase the surface area of the adsorbent and boost the number of active adsorption sites.

Most of the efforts for the treatment of DAYN or TIGY polluted wastewater were mainly focused on their single solutions and are mostly following a univariate-based scheme (Table S1) (Almufarij et al. 2022; El-Azazy et al. 2021a; El-Shafie et al. 2022; Ghodrati et al. 2022; Mello Souza et al. 2022; Sajedi and Moghaddas 2022; Zhong et al. 2022). Therefore, in the current investigation, we worked via two intermingling schemes. Since the purpose of the current approach is to generate a competent nanosorbent while maintaining the process sustainability and greenness, a multivariate approach—Box–Behnken design—was instigated to control the performance of the nanosorbent. Variables influencing the efficacy of Ni-SCBC as a nanosorbent (pH, Ni-SCBC dose (AD), pollutant concentration [Drug], and contact time (CT)) will be assessed. Two responses will be optimized: %removal (%R) and the adsorption capacity (qe) (Tee et al. 2022). Following such a scheme helps lower the consumption of chemicals and preserve the resources, while obtaining trustworthy data.

By and large, the removal of DAYN and TIGY, like the other PhACs (Basheer 2018; El-Azazy et al. 2021a; Mansour et al. 2018; Rivera-Utrilla et al. 2013) (Table S1), was attempted from a single-component system with almost no attention being paid for the complicated nature of the pharmaceutical wastewater. Therefore, to mimic the actual situation and address this concern, removal of the two antibiotics from the multi-component solution has been undertaken in the current investigation. In this regard, Box–Behnken design was fully exploited: first to sustainably tune the variables’ levels that could maximize the removal of both drugs from their individual solutions, and moreover to apply the Derringer’s composite desirability (D) tool to boost the uptake of both drugs simultaneously. Parallel to that, the interfacial effects of the biochar and the biochar-based composite adsorbents and the microstructural changes triggered by the loading of NiO are still worth investigation. In the same itinerary, comprehending the impact of existence of one antibiotic on another antibiotic and the competition on the active adsorption sites was explored in depth using different equilibrium isotherm and kinetic models. As far as is known, this is the first investigation targeting the remediation of two antibiotics that are extensively used nowadays from their mixture employing statistical analysis and modeling with no need to instigate a preceding chemical or graphical treatment.

Materials and methods

Materials

Analytical-grade materials were used throughout the investigation. Sodium tetraborate-10-hydrate (Na2B4O7·10H2O), sodium hydroxide, hydrochloric acid, sulfuric acid, ethanol, sodium carbonate, sodium chloride, nickel (II) nitrate hexahydrate (Ni(NO3)2·6H2O), and the tested dyes (rose bengal, fuchsine, and methylene blue) were bought from Sigma-Aldrich (USA). Biosynth® Carbosynth Ltd. (UK) was the source for both daunorubicin hydrochloride (DAYN, C27H29NO10·HCl, Mr: 563.98 g/mol, purity (reported method): min. 95%) and tigecycline (TIGY, C29H39N5O8, Mr: 585.65 g/mol, purity (HPLC): min. 98 area-%), as well as the drugs used in the selectivity test (rifampicin, riboflavin, marbofloxacin, amantadine, sofosbuvir). The ultrapure deionized water was secured from the Millipore-Q water system. Powdered coffee was obtained from the local markets.

Preparation of the adsorbents

Spent coffee (SC) grounds were acquired by boiling the coffee powder in hot tap water 5 times, and then, the residual solid SC grounds were washed 5 times with tap water and then 10 times with deionized water. The clean SC grounds were then roasted for 3 days at 80 °C before crushing and sieving using 0.125 mm sieve. The product was placed in porcelain crucibles (Coors™, Merck, USA), which were then firmly sealed, and burnt in the furnace at 500 °C for 1 h, and the yield was marked as spent coffee grounds biochar (SCBC). To prepare the Ni-SCBC, NiO nanoparticles were produced using the microemulsion method with slight adjustments (Bumajdad et al. 2004). The Ni-SCBC was produced by dissolving 3.3225 ± 0.0005 g of (Ni(NO3)2·6H2O) in 200 mL of deionized water (equal to 1:10 Ni: SCBC, wt/wt%) followed by adding 10 g of the SCBC while stirring continuously at 750 rpm. A volume of 100 mL of oleylamine (0.1 M) dissolved in 2-propanol was added to the previous solution, and the mixture was agitated for 3 h. The formation of NiO nanoparticles was accomplished by adding drops of 26% ammonia solution gradually until the pH is ~ 12. The product, Ni-SCBC, was separated by centrifugation at 4000 rpm for 5 min. The product was then washed with deionized water followed by absolute ethanol 5 times and then dried in the oven at 70 °C for 24 h.

Box–Behnken design

Box–Behnken design was prompted to maximize the efficiency of the Ni-SCBC in removing DAYN and TIGY. The design was formulated and analyzed using Minitab®19, Minitab Inc. The pH, drug concentration [Drug], the dosage of Ni-SCBC (AD), and contact duration (CT) were the four key parameters investigated (Table 1). (The lower bound is symbolized as − 1, and the upper bound is symbolized as + 1.)

Table 1 Studied factors and their levels

Generally, a 500-ppm stock solution was prepared by dissolving the necessary quantities of TIGY and DAYN in deionized water. Drug concentrations in Table 2 were secured via serial dilutions. An adsorbent mass as per the specifications mentioned in Table 2 was mixed with the appropriate drug concentration, and the pH was then adjusted using 0.1 M aqueous solution of either sodium hydroxide or hydrochloric acid to achieve the target pH ± 0.2. The reaction mixture was left in the shaker at 160 rpm for the specified times (Table 2). Samples were then filtered, and the absorbance of the filtrate was reckoned using a UV–Vis spectrophotometer (Agilent diode-array, Agilent, USA) at λmax values of 347 nm and 478 nm for TIGY and DAYN, respectively.

Table 2 Design matrix for the removal of TIGY and DAYN from their single solutions. Experimental, and predicted (theoretical) values, as well as the % error (%Er) for the two responses, are shown

Equations (1) and (2) were used to compute the two responses to be optimized in this investigation, %R and qe (mg/g). The design scheme consisted of 27 trials including 3 central points (Ct Pt, denoted as 0). The design was carried out as 3 blocks, as demonstrated in Table 2.

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

where C0 is the initial concentration of either drug ([TIGY] and [DAYN]) in ppm, Ce is the equilibrium concentration of these two pharmaceutical solutions (ppm), V is the volume of TIGY and DAYN solution (L), and W is the weight of the Ni-SCBC.

Removal of TIGY and DAYN from binary mixture—analysis of the partially overlapped spectra

The removal of TIGY and DAYN from their bicomponent solution was investigated using Derringer’s composite desirability function (D), as illustrated in Eq. (3). Desirability function is a multiple response optimization tool offered by Minitab® to find the ideal experimental conditions to maximize the removal of both drugs.

$${D}={\left({d}_{1}^{r1} {d}_{2 }^{r2}\dots {d}_{m}^{rm}\right)}^{\frac{1}{\sum ri }}={\left(\prod_{i=1}^{n}{d}_{1}^{ri}\right)}^{\frac{1}{\sum ri}}$$
(3)

where D is the composite desirability function, d is the individual desirability, r is the significance of each response, and m is the number of responses to be optimized. The responses in the current study are %R and qe for both TIGY and DAYN. Individual spectra of TIGY and DAYN revealed maximum absorbances at λmax values of 347 nm and 478 nm, respectively, suggesting a case of partially overlapped spectra (Fig. S2) (El-Shafie et al. 2024). Equations (4) and (5) were solved to determine the concentrations of TIGY and DAYN in their binary mixture before and after their treatment using the Ni-SCBC nanosorbent.

$${A}_{347}={\varepsilon }_{{\rm TIGY}\,347}.\left[{\rm TIGY}\right]+{\varepsilon }_{{\rm DAYN}\,347}.\left[{\rm DAYN}\right]$$
(4)
$${A}_{478}={\varepsilon }_{{\rm TIGY}\,478 }. \left[{\rm TIGY}\right]+{\varepsilon }_{{\rm DAYN}\, 478}. \left[{\rm DAYN}\right]$$
(5)

Assuming that the path length is 1 cm, the values A347 and A478 represent the absorbance of either TIGY or DAYN measured at both λmax values. The constants εTIGY347, εDAYN347, εTIGY478, and εDAYN478 were calculated by measuring the absorbance of TIGY and DAYN standard solutions separately at the two wavelengths. [TIGY] and [DAYN] are the concentrations of TIGY and DAYN to be determined. A calibration curve was prepared at each wavelength for both [TIGY] and [DAYN], and the slopes of the curves were used to calculate the ε values. Equations (4) and (5) were solved for the unknown [TIGY] and [DAYN] operating the matrices in Eqs. (6) and (7), respectively. Regression equations were used to obtain the slope and the molar absorptivity (Table 3).

Table 3 Molar absorptivity values for the binary mixture components that were obtained from the calibration curves and analyzed at λmax values
$$\left[{\rm TIGY}\right]= \frac{\left[\begin{array}{cc}{A}_{347}& {\varepsilon }_{{\rm DAYN}\,347}\\ {A}_{478}& {\varepsilon }_{{\rm DAYN}\, 478}\end{array}\right]}{\left[\begin{array}{cc}{\varepsilon }_{{\rm TIGY}\, 347}& {\varepsilon }_{{\rm DAYN}\, 347}\\ {\varepsilon }_{{\rm TIGY}\, 478}& {\varepsilon }_{{\rm DAYN}\, 478}\end{array}\right]}=\frac{{A}_{347}\cdot {\varepsilon }_{{\rm DAYN}\, 478}-{A}_{478}\cdot {\varepsilon }_{{\rm DAYN}\, 347}}{{\varepsilon }_{{\rm TIGY}\, 347}\cdot {\varepsilon }_{{\rm DAYN}\, 478}-{\varepsilon }_{{\rm TIGY}\, 478}\cdot {\varepsilon }_{{\rm DAYN}\, 347}}$$
(6)
$$\left[{\rm DAYN}\right]=\frac{\left[\begin{array}{cc}{\varepsilon }_{{\rm TIGY}\, 347}& {A}_{347}\\ {\varepsilon }_{{\rm TIGY}\, 478}& {A}_{478}\end{array}\right]}{\left[\begin{array}{cc}{\varepsilon }_{{\rm TIGY}\, 347}& {\varepsilon }_{{\rm DAYN}\, 347}\\ {\varepsilon }_{{\rm TIGY}\, 478}& {\varepsilon }_{{\rm DAYN}\, 478}\end{array}\right]}=\frac{{\varepsilon }_{{\rm TIGY}\, 347}\cdot {A}_{478}-{\varepsilon }_{{\rm TIGY}\, 478}\cdot {A}_{347}}{{\varepsilon }_{{\rm TIGY}\, 347}\cdot {\varepsilon }_{{\rm DAYN}\, 478}-{\varepsilon }_{{\rm TIGY}\, 478}\cdot {\varepsilon }_{{\rm DAYN}\, 347}}$$
(7)

Characterization

The structural features of SCBC and Ni-SCBC were analyzed operating a scanning electron microscope (SEM, FEI, Quanta 200, Thermo Scientific, USA). Energy-dispersive X-ray spectrometer (EDX) was operated to explore the elemental structure of both adsorbents. Inductively coupled plasma–optical emission spectrometry (ICP-OES, Optima 7300 DV, PerkinElmer, USA) was employed to verify the amount of nickel loaded on the biochar. The Ni-SCBC sample was prepared for the ICP-OES analysis via the acid digestion method, where 0.25 g of the sample was placed into the digestion vessel followed by 6 mL of nitric acid, 2 mL of hydrochloric, and hydrofluoric concentrated acids. The vessel was then digested in the microwave digestor (MARS 6CM, USA) for 15 min using the power of 1800 W. The vessel was left to cool down for another 15 min. After digestion, the sample solution was neutralized to pH 7 using NaOH solution and the volume was diluted to 100 mL using deionized water. Transmission electron microscopy (TEM) was used to analyze the microstructure of SCBC before and after loading by NiO nanoparticles (TECNAI G2 TEM, TF20, FEI, USA). A porosimetry system, Micrometrics ASAP2020™ (Micrometrics, USA), was employed to investigate the surface properties, including pore size, volume, and the area of the adsorbent surface. Analysis was done by degassing of the SCBC and Ni-SCBC samples, followed by N2 adsorption–desorption investigation. The t-plots, on the other hand, were utilized in conjunction with the Barrett–Joyner–Halenda (BJH) equations to calculate the pore volume (Bumajdad et al. 2004; Mansour et al. 2018). Thermogravimetric analysis (TGA/dTA) was performed at a temperature range of 50–800 °C using TGA/dTA (TGA, PerkinElmer-TGA400, USA). Raman spectroscopy was used to explore the carbonaceous nature of both SCBC and Ni-SCBC using a DXR3 Raman Microscope (Thermo Fischer Scientific, wavelength of 532 nm, 40 times scanning, laser power of 9.2 mW). Fourier transform infrared (FT-IR) spectroscopic analysis (Spectrum 400 FT-IR, PerkinElmer, USA) was used to investigate the functional groups that exist on the surface of both SCBC and Ni-SCBC as well as DAYN and TIGY prior to and following the adsorption. The pHPZC for SCBC and Ni-SCBC was evaluated by adding sodium chloride (0.01 M) aqueous solution and following the previously described procedure (Babic et al. 1999; Kooh et al. 2018).

Equilibrium and kinetic investigations

To investigate the adsorption equilibrium for single and binary drug solutions, a series of dilutions ranging from 5 to 400 ppm of the drug(s) solutions was prepared using deionized water and the pH was adjusted to 5.0 ± 0.2. Each drug solution was mixed with 0.1000 ± 0.0005 g of Ni-SCBC. An automatic shaker was used to shake the drug–adsorbent combination for 24 h at 160 rpm. The produced solutions were filtered, and the absorbance was measured at the λmax value for each drug. The residual drug concentration in the binary system was determined using Eqs. (6) and (7).

The adsorption kinetics for TIGY and DAYN were evaluated by adding 150 mL (100 ppm, pH 5.0 ± 0.2) of both drug solutions to a mass of 0.5000 ± 0.0005 g of Ni-SCBC, stirred continuously at 160 rpm. Over 90 min, aliquots of 10 mL of the reaction mixture were taken and filtered at various time intervals. Lastly, the absorbance of the filtrate was detected.

Selectivity of Ni-SCBC

To determine the selectivity of the prepared adsorbent, Ni-SCBC for DAYN and TIGY, the removal efficiency of Ni-SCBC toward these two drugs was compared with that toward five other drugs (rifampicin, riboflavin, marbofloxacin, amantadine, and sofosbuvir) as well as three dyes (rose bengal, fuchsine, and methylene blue) (Cantarella et al. 2019). Specifically, 13 mL aliquots of each contaminant with a concentration of 50 ppm was mixed with 0.100 ± 0.005 g of Ni-SCBC, and the pH of each contaminant solution was adjusted to 5.0 ± 0.2 using 0.1 M aqueous HCl. The mixture was stirred at 150 rpm for 2 h and filtered, and the filtrate's absorbance was recorded at λmax of each adsorbate solution.

Desorption and regeneration of Ni-SCBC

To investigate the possibility of adsorbent reusability, a mass of the adsorbent Ni-SCBC (1.0000 ± 0.0005 g) was first equilibrated with 150 mL of 50 ppm from both DAYN, TIGY, and their binary mixture for 2 h followed by filtration. The adsorbent was then rinsed with deionized water to eliminate any non-adsorbed remnants of the two drugs before being dried in the oven at 70 °C for 24 h. Five different eluents were employed in this investigation, including: 0.1 M of hydrochloric acid, sulfuric acid, sodium carbonate, 10% ethanol, and deionized water. In the desorption experiment, 0.1000 ± 0.0005 g of the drug-loaded adsorbent was mixed with 10 mL of each eluent. The samples were shaken for 60 min, followed by filtration using syringe filters. Each desorption experiment was conducted 3 times, and the average desorbed quantity was recorded. The standard deviation of the multiple measurements was expressed using error bars.

The recovery experiments were performed by using 0.1 M sulfuric acid for DAYN, 0.1 M hydrochloric acid for TIGY, and 0.1 M sulfuric acid for the desorption of the two drugs in the binary mixture. For 30 min, an amount of 0.2000 ± 0.0005 g of Ni-SCBC was equilibrated with 50 mL of 50 ppm drug solution (pH 5.0 ± 0.2). The resulting mixture was then filtered, and the absorbance was determined. The loaded adsorbent was eluted with chosen eluent, and samples were then dried at 70 °C for 1 h before being employed in another adsorption cycle. This method was repeated 6 times, and the removal efficiency (%R) was calculated following each cycle.

Results and discussion

Adsorption study

Findings of the preliminary experiments

The performance of the two adsorbents, SCBC and Ni-SCBC, was initially screened and compared using un-optimized experimental conditions. Table 4 shows that the Ni-SCBC has a better performance compared to the pristine candidate, SCBC. Therefore, Ni-SCBC will be the adsorbent of choice to be used throughout this work.

Table 4 Comparison of the efficiency of SCBC and Ni-SCBC toward the removal of DAYN and TIGY. Experimental conditions were unified (un-optimized) as follows: pH = 7, adsorbent dose (AD) = 100 mg, [Drug] = 100 mg/L, and contact time (CT) = 60 min. Measurements of the remaining drug concentrations were taken at 478 and 347 nm for DAYN and TIGY, respectively

Design of the experiments: Box–Behnken design

Box–Behnken design is one of the response surface methodology-based factorial designs. Compared to the other response surface designs, Box–Behnken design entails fewer experimental points with no contributions from the preceding screening design (Box and Behnken 1960; Tee et al. 2022). In the current investigation, the obtained data were fitted to the polynomial paradigm defined by Eq. (8).

$$y={a}_{0}+\sum_{i=1}^{n}{a}_{i}{x}_{i}+\sum_{i=1}^{n}\sum_{j=i+1}^{n}{b}_{ij}{x}_{i}{x}_{j}+\sum_{i=1}^{n}\sum_{j=i+1}^{n}\sum_{k=j+1}^{n}{c}_{ijk}{x}_{i}{x}_{j}{x}_{k}$$
(8)

In this model, y represents the theoretic response variable (%R or qe (mg/g)), a0 signifies the global mean, while xi, xj, and xk are the independent factors, and the coefficients: ai, bij, and cijk represent the effects of a single-factor, two-factor, and three-factor interactions, respectively. To improve the response modelling, data transformation was conducted using the Box–Cox response transformation tool, as shown in Eq. (9), where λ represents the transformation factor (Box and Cox 1964).

$${y}^{\left({\varvec{\lambda}}\right)}=\begin{array}{cc}\frac{{y}^{\lambda }-1}{\lambda }& \lambda \ne 0\\ \text{log}\left(y\right)& \lambda =0\end{array}$$
(9)

In the current investigation, the trail of the adsorption experiments involving the use of Ni-SCBC was evaluated in accordance with the settings exhibited in Table 2.

Screening phase

The Pareto chart was used to comprehend the influence of each variable as well as variable–variable linear and squared interactions on the measured response(s) (Fig. 1a, b). As shown in Fig. 1a, b, for both drugs and assessing the influence of the main effects on %R, the [Drug] (C) and the dose of Ni-SCBC (B) were the most significant variables affecting the removal efficiency, implying that the dose of the adsorbent and the [Drug] play the major role in shaping the adsorption process. Main effects plot (figure is not shown) reveals that as the dose of the adsorbent (Ni-SCBC) increases, the %R of either drug increases. A higher dose of the adsorbent implies an availability of more active adsorption sites for capturing the drug. In the case of TIGY, the same plot shows that the adsorption increases as the [TIGY] increases till a concentration of ~ 70–85 ppm; then, the %R starts to decline implying the saturation of the adsorption sites at higher concentrations. The same was noted in the case of DAYN; however, the adsorption starts to decline at ~ 20–30 ppm of the drug.

Fig. 1
figure 1

Pareto chart demonstrating the impact of the experimental conditions on the %R from single drug solutions: a %RDAYN, b %RTIGY

The pH (A) was the third main effect in terms of statistical significance. Main effects plot shows that as the pH increases, the %R of either drug decreases. This finding will be further explained in relation to the pKa of the drug and the pHpzc of the adsorbent. While the CT (D) was the least statistically significant factor for both drugs, the squared effect (DD) was statistically significant in the case of TIGY and insignificant in the case of DAYN. The impact of linear and squared interactions could be deduced from the Pareto chart.

Statistical models and analysis of variance (ANOVA)

The regression models derived for both drugs are described in Eqs. (1013). These models demonstrate the relationship between the responses and the various experimental conditions. Unlike the Pareto charts, these models explain the size and direction of the variable’s influence. As a result, the total influence of any element may be simply determined using these models. Noteworthy, the optimum responses were attained operating the Box–Cox response transformation (Menazea et al. 2020). In the case of DAYN and the mixture of DAYN and TIGY, the value of λ (transformation factor) was selected to be ‘optimal’ compared to 0.5 in the case of TIGY.

$$\begin{gathered} (\% R^{\lambda - 1} )/\left( {\lambda \times g^{(\lambda - 1)} } \right)_{{\text{(DAYN)}}} = 456329 + 1.61\,{\text{pH}} + 0.4151\,{\text{AD}} + 0.2435\,[{\text{DAYN}}] - 0.2112\,{\text{CT}} - 0.0550\,{\text{pH}}^{2} - 0.000126\,AD^{2} - 0.003995 \hfill \\ [{\text{DAYN}}]^{2} - 0.000239\,{\text{CT}}^{2} - 0.05064\,{\text{pH}} \times {\text{AD}} - 0.04678\,{\text{pH}} \times [{\text{DAYN}}] + 0.04671\,pH \times {\text{CT}} + 0.005860\,{\text{AD}} \times \hfill \\ [{\text{DAYN}}] - 0.001806\,{\text{AD}} \times {\text{CT}} + 0.000477\,[{\text{DAYN}}] \times {\text{CT}},(\lambda = - 2.45103,\,g = 56.5862\,{\text{is}}\,{\text{the}}\,{\text{geometric}}\,{\text{mean}}\,{\text{of}}\,\% R) \hfill \\ \end{gathered}$$
(10)
$$\begin{aligned} q_{{e\,{\text{(DAYN)}}}}^{\lambda } & = 1.4508{-}0.0092\,{\text{ pH}}{-}0.010507 \, \,{\text{AD}} + 0.008592 \, \left[ {{\text{DAYN}}} \right]{-}0.000845\,{\text{ CT}} + 0.000904\,{\text{ pH}}^{2} + 0.000088\,{\text{ AD}}^{2} \\ & \quad {-}0.000041 \, \left[ {{\text{DAYN}}} \right]^{2} {-}0.000001 \, \,{\text{CT}}^{{2}} {-}0.000300\,{\text{ pH}} \times {\text{AD}}{-}0.000101\,{\text{ pH}} \times \left[ {{\text{DAYN}}} \right] + 0.000173\,{\text{ pH}} \times {\text{CT}} \\ & \quad + 0.000001 \, \,{\text{AD}} \times \left[ {{\text{DAYN}}} \right]{-}0.000006 \, \,{\text{AD}} \times {\text{CT}} + 0.000001 \, \left[ {{\text{DAYN}}} \right] \times {\text{CT}}, \, \left( {\lambda = 0.138702} \right) \\ \end{aligned}$$
(11)
$$\begin{gathered} \surd \% {\text{R}}^{\lambda }_{{({\text{TIGY}})}} = {4}.{135} + 0.{1774}\,{\text{ pH}} + 0.00{\text{468 AD}} + 0.0{611}0 \, \left[ {{\text{TIGY}}} \right] + 0.0{3}0{5}0{\text{ CT}}{-}0.00{2}0{4}\,{\text{ pH}}^{{2}} {-}0.000{14}0{\text{ AD}}^{{2}} {-}0.000{35}0 \, \left[ {{\text{TIGY}}} \right]^{{2}} \hfill \\ {-}0.0000{\text{93 CT}}^{{2}} + 0.00{\text{1423 pH}} \times {\text{AD}}{-}0.00{26}0{\text{6 pH}} \times \left[ {{\text{TIGY}}} \right]{-}0.00{\text{2177 pH}} \times {\text{CT}} + 0.000{\text{145 AD}} \times \left[ {{\text{TIGY}}} \right] \hfill \\ {-}0.0000{\text{14 AD}} \times {\text{CT}}{-}0.0000{33 }\left[ {{\text{TIGY}}} \right] \times {\text{CT}} \hfill \\ \end{gathered}$$
(12)
$$\begin{gathered} \surd q_{{e\,{\text{(TIGY)}}}}^{\lambda } = 3.648{-}0.084\,{\text{ pH}}{-}0.12237\,{\text{ AD}} + 0.09144 \, \left[ {{\text{TIGY}}} \right] + 0.01213\,{\text{ CT}} + 0.0071 \, \,{\text{pH}}^{2} + 0.000920 \, \,{\text{AD}}^{2} {-}0.000273 \, \left[ {TIGY} \right]^{2} {-}0.000035 \, CT^{2} \hfill \\ + 0.001584\,{\text{ pH}} \times {\text{AD}}{-}0.001296\,{\text{ pH}} \times \left[ {{\text{TIGY}}} \right] - 0.000909 \, \,{\text{pH}} \times {\text{CT}}{-}0.000424 \, \,{\text{AD}} \times \left[ {{\text{TIGY}}} \right] \hfill \\ {-}0.000010\,{\text{ AD}} \times {\text{CT}}{-}0.000010 \, \left[ {{\text{TIGY}}} \right] \times {\text{CT}} \hfill \\ \end{gathered}$$
(13)

Table 5 displays summaries of the four models. Every model was evaluated considering three parameters: the coefficient of determination (R2), the R2 adjusted (R2-adj), and the R2 predicted (R2-pred). The model’s linearity was assessed using the values of R2 and R2-adj. As per Table 5, both parameters had high values, suggesting that both models were linear. The R2-pred measures the model’s capacity to predict the response to new trials. The high values of R2-pred indicate stronger model capability. The %Er was used to analyze the difference between experimental and theoretical (predicted) values. The %Er values were relatively minimal, indicating that the experimental and the theoretical values agreed well (Table 2). Following this step, the ANOVA test at a confidence level of 95.0 was used—tables are not presented. A factor with a p-value of ˃ 0.05 was deemed statistically insignificant. The ANOVA results aligned well with the findings drawn from the regression equations and Pareto charts.

Table 5 Parameters used to assess the regression equations for the removal of the single drug solutes, Eqs. (1013), and the optimum conditions

Optimization of the individual responses

Following the screening phase, an optimization step was contemplated utilizing the 2D contour and 3D surface plots. Figure 2a–d presents the contour and the surface plots considering the %R as a response. Figure 2a, b depicts the contour plots in the case of DAYN and TIGY, respectively. The dark gray (Fig. 2a) and dark blue (Fig. 2b) regions represent the zone where the joint effect of both variables reaches the highest %RDAYN and %RTIGY, respectively. The 2D plot and as could be deduced from Fig. 2a, b relates two variables to %R. As shown, the interaction of the most significant variables (AD, [Drug]) was depicted. In general, increasing the AD is accompanied by a better removal performance, however, dependent on [Drug]. In the case of TIGY, for example, a 60 ppm of TIGY could be removed with an efficiency > 60% using a dose of ~  > 45–80 mg of Ni-SCBC. Figure 2c, d illustrates the surface plots of the same two variables investigated and the %R. The elevated edges shown in both figures represent the point of the maximum %R. For both drugs, as the dose of Ni-SCBC increases, the removal increases, however, dependent on the [Drug]. For example, a low uptake of TIGY could be noted at the very low and the very high [TIGY]. Other tools such as the individual desirability value (d)—figures are not shown (Table 5)—were utilized as a signal for the best factorial blend, where the greater the value of d, the better the specified blend and the higher the response.

Fig. 2
figure 2

Two-dimensional contour plot; a %R vs AD, [DAYN], b %R vs AD, [TIGY], three-dimensional surface plot; c %R vs AD, [DAYN], and d %R vs AD, [TIGY]

Multi-response optimization: Multi-component drug solution

Figure S1 is utilized to determine the ideal parameters that would maximize the observed responses simultaneously in the case of the bicomponent drug solution. Similar to the individual desirability value (d), the value of the composite desirability function (D) was used to indicate the suitability of the shown factorial blend for boosting the %R of both drugs concurrently. The D-function obtained for %RDAYN and %RTIGY simultaneously is shown in Fig. S1. The optimum parameters (denoted as ‘Curr’) with a D-value of 0.9899 were obtained using pH 5.0, AD of 80 mg, [DAYN] of 83.03 ppm, and CT of 51.11 min. Considering these optimum conditions, the removal efficiencies of DAYN and TIGY are 94.4%, and 65.6%, respectively. Therefore, in a binary mixture, the removal of DAYN is better than TIGY.

Characterization of the prepared adsorbents

SEM, EDX, and TEM analyses

The surface morphology, porosity, and microscopic features of SCBC and Ni-SCBC were examined using SEM, EDX, and TEM analyses. For SCBC, at various magnifications 5000 × and 10,000 × , SEM micrographs are shown in Fig. 3a, b, respectively. As could be observed, the surface looks comparatively smooth with the presence of carbon layers. Moreover, there are pores and cavities suggesting a high surface area and porosity. On the other hand, upon impregnation with NiO nanoparticles (Fig. 3c, d), the surface of Ni-SCBC becomes rough with many pits and holes, which in turn helps increase the surface area and positively affects the adsorption of TIGY and DAYN (Tejada-Tovar et al. 2021).

Fig. 3
figure 3

SEM micrographs of a, b SCBC, c, d Ni-SCBC at various magnifications 5,000 × and 10,000 × , and b, d the inset tables represent the EDX analysis data of SCBC and Ni-SCBC, respectively

EDX analysis is shown as inset tables in Fig. 3b, d. Analysis results indicated a considerable concentration of carbon (95.50%) and oxygen (4.50%) in the SCBC sample and confirmed the carbonaceous nature of the adsorbent following the treatment of the SC grounds thermally, justifying the removal efficiency of SCBC toward both drugs. On the other hand, a noticeable decrease of the % carbon (78.15%) in the case of Ni-SCBC, an increase in % oxygen (18.37%), and the appearance of Ni (3.48%) conform to the formation of NiO nanoparticles on the surface of the adsorbent, which also could explain the superior performance of Ni-SCBC compared to pristine biochar, SCBC. Further evidence of the successful loading of NiO nanoparticles on the surface of the biochar was quantitatively measured employing the inductively coupled plasma–optical emission spectrometry (ICP-OES). The amount of Ni (II) loaded on the biochar was found to be 6.30 ± 1.12 wt%, implying that more than 94% of Ni (II) was successfully loaded on the biochar surface.

Figure 4 shows the microstructural characterization of SCBC and Ni-SCBC using TEM analysis. The findings of the TEM analysis agreed well with the SEM micrographs. The SCBC surface is smooth and even with no particles on the surface (Fig. 4a, b). Conversely, the surface of the Ni-SCBC is rough, with NiO nanoparticles visible on the surface like tiny spheres (Fig. 4c, d). The average particle size of NiO nanoparticles was 16.04 ± 3.30 nm (Fig. 4e). A small particle size distribution (PSD) of 3.30 nm confirms the creation of uniform-sized NiO nanoparticles on the surface of the SCBC.

Fig. 4
figure 4

TEM pictures of a, b SCBC, c, d Ni-SCBC, and e PSD of NiO nanoparticles in Ni-SCBC

Analysis of surface area and pore size

Figure 5a–d reveals the N2 adsorption/desorption isotherms as well as the pore volume of SCBC and Ni-SCBC. According to the results, the Langmuir surface area has increased from 49.23 m2/g in SCBC to 86.06 m2/g in the case of Ni-SCBC. This substantial increase in the surface area in the case of Ni-SCBC could be ascribed to the existence of NiO nanoparticles on the surface, which in turn positively affects the removal of DAYN and TIGY compared to the pristine biochar. Furthermore, SCBC and Ni-SCBC showed two types of pores based on the pore diameter: mesopores (2–50 nm) and macropores (˃ 50 nm). This mesoporous–macroporous structure enhances the drug uptake by the tested adsorbents. Moreover, the isotherm for both adsorbents was of type IV, suggesting monolayer and multilayer adsorption followed by capillary condensation. The hysteresis loop was of H3-type (Salunkhe et al. 2020), which is common in materials with a broad range of pore widths and indicate loose masses of platelike particles generating slit-like pores.

Fig. 5
figure 5

N2 adsorption–desorption isotherms and pore diameter for a, b SCBC, and c, d Ni-SCBC

Thermal stability of the prepared adsorbents

TGA/dTA was used to assess the stability of both SCBC and Ni-SCBC under different temperatures (Fig. 6). In the case of Ni-SCBC, it could be observed that the %weight loss upon heating in the range of 50–350 °C was significant implying that the sample disintegrated entirely at 350 °C to produce NiO. The weight loss between 50 and 100 °C in the case of SCBC and Ni-SCBC was 11.78% and 10.34%, respectively, and could be ascribed to the evaporation of the physically adsorbed impurities and the thermal dehydration of Ni(OH)2 in the case of Ni-SCBC (Deshpande et al. 2016). The results show that both samples are thermally stable in the temperature range of 350–450 °C. However, in the range of 550–800 °C, weight loss of 26.98% and 31.35% could be found in case of SCBC and Ni-SCBC, respectively. It could be observed that the weight loss of Ni-SCBC was higher than that of SCBC, between 550 and 800 °C. This behavior aligns with the previous studies (Du et al. 2019; Richardson et al. 2010; Silva et al. 2001) where nickel nitrate decomposes at high temperature to form HNO3 and NOx by-products. These compounds can oxidize SCBC biomass, producing CO and CO2, leading to higher weight loss.

Fig. 6
figure 6

TGA/dTA graphs of SCBC and Ni-SCBC

Raman spectroscopic analysis

Raman spectroscopy is commonly used to identify the vibrational modes of the studied molecules and to verify the rotational and other low-frequency modes of the studied systems (Adya and Canetta 2020). The Raman spectra of both adsorbents are shown in Fig. 7. At 1362 cm−1 (D-band) and 1597 cm−1 (G-band), two distinct bands that are commonly indicative of the formation of carbonaceous materials were spotted. For the sp2 system, the D-band represents carbon lattice characteristics such as defects and sizes, whereas the G-band signifies the C–C stretching. The increase in the Raman intensity in case of Ni-SCBC confirms the successful loading of NiO nanoparticles on the surface. Additionally, the peaks between 400 and 1110 cm−1 elucidate the NiO spinel structure. The Raman mode of one-phonon (1P) first-order transverse TO, first-order longitudinal LO modes (at 571 cm−1), two-phonon (2P) second-order transverse 2TO modes (at 725 cm−1), and a mixture of TO + LO phonon excitation modes (at 950 cm−1), and second-order longitudinal 2LO modes (at 1110 cm−1) are illustrated in the inset spectrum. These excitation modes represent the vibration of Ni bonded to oxygen and confirm the presence of NiO on the surface (Mironova-Ulmane et al. 2007; Salunkhe et al. 2020). The presence of the NiO enhanced the removal of both TIGY and DAYN. This enhancement is attributed to the increase in the number of adsorption sites on the SCBC surface and possibly the formation of bonds between NiO and the two drugs.

Fig. 7
figure 7

Raman spectra for SCBC and Ni-SCBC

Surface functionalities: FT-IR spectroscopic analysis

Functional groups on the surface of SCBC and Ni-SCBC were identified using FT-IR spectroscopic analysis (Fig. 8a). With slight variations in the peak positions, obtained results revealed that both SCBC and Ni-SCBC possess similar functionalities. The absence of an absorption peak at 3300 cm−1 which is associated with hydrogen-bonded O − H from water in the spectra of both adsorbents indicates complete dehydration throughout the carbonization process (El-Azazy et al. 2022). Typical peaks can also be identified in the spectra of SCBC and Ni-SCBC. For instance, the peaks at 2921 cm−1 and 2852 cm−1 could be attributed to the aliphatic C − H and the C − C stretching vibrations for the alkyne. The peak at 1381 cm−1 represents the N − H stretching, at 1174 cm−1 is due to C − N stretching in SCBC, and other peaks such as 1448 cm−1 and 1285 cm−1 represent the alkene C − H bending. The presence of NiO nanoparticles on the surface was confirmed. This could be elucidated by the peak at 1576 cm−1 in SCBC and attributed to the carboxylic C = O and the aromatic C = C stretching, and this peak has slightly shifted to 1571 cm−1 in the Ni-SCBC because of the bond formation between NiO and the pristine SCBC (El-Azazy et al. 2021a; Sertoli et al. 2019). Another evidence of the presence of NiO nanoparticles on SCBC is the peak at 717 cm−1, which could be assigned to the Ni − O stretching vibration (Baig et al. 2020; Sharma et al. 2014).

Fig. 8
figure 8

FT-IR spectra of a SCBC and Ni-SCBC, b, c Ni-SCBC before and after adsorption of b DAYN and c TIGY, chemical structure with the pKa values for d DAYN and e TIGY, f pHPZC for both adsorbents

Figure 8b, c demonstrates the FT-IR spectra of DAYN and TIGY before and after adsorption onto Ni-SCBC. In Fig. 8b, the peaks between 815 cm−1 and 984 cm−1 correspond to the C = O and C − OH stretching vibrations of DAYN. The peaks at 1204 cm−1 and 1403 cm−1 represent the C − C = O bending vibrations and the aromatic C − H, respectively. The peaks at 1288 cm−1 and 1574 cm−1 attributed to the C − N stretching of the aromatic amine and the aromatic C = C stretching, respectively, were slightly shifted to 1285 cm−1 and 1578 cm−1 following the adsorption of DAYN, confirming the successful adsorption of DAYN onto Ni-SCBC (Kaczmarek et al. 2013; Lian and Meng 2017; Szafraniec et al. 2016). In Fig. 8c, the peaks between 1119 and 1276 cm−1 could be ascribed to the C − N and CH3 stretching, respectively. The peaks at 1514 cm−1 and 3636 cm−1 represent the CH3 bending vibrations. A slight shift in peaks of TIGY after adsorption onto Ni-SCBC was observed. For example, the peak at 1589 cm−1, which is related to aromatic C − H bending, was shifted to 1582 cm−1. Moreover, the peak at 2932 cm−1 that could be related to CH3 stretching has shifted to 2919 cm−1, confirming the adsorption of TIGY onto the Ni-SCBC (Menazea et al. 2020; Sabitha and Rajiv 2015; Trivedi et al. 2015). The changes and the shifts in the peak positions could be used to propose the adsorption mechanism together with the Box–Behnken design findings.

Proposed adsorption mechanism

Several mechanisms could be proposed to interpret the adsorption of DAYN and TIGY onto Ni-SCBC from their single and binary mixtures, including hydrogen bonding, electrostatic attraction, coordination interaction, intra-particle, and surface diffusion (Abdel-Hady et al. 2022). The structure of either drug (with several benzene or other aromatic rings) has electron-rich or electron-deficient groups that might cause interactions in aqueous solutions. Hydrogen bonding might take place between the nitrogen and oxygen atoms (H-acceptors) of the prepared adsorbents and the hydrogen of the hydroxyl groups (H-donors) of the drug molecule. Non-covalent ππ interactions between DAYN or TIGY aromatic rings and the aromatic backbone of the adsorbent is another mechanism (El-Azazy et al. 2021b). The same mechanism (ππ stacking, however, between the two drug molecules) could explain the decrease in adsorption from the binary mixture compared to the single solutions.

The electrostatic attraction mechanisms are often explained considering the interaction between the positively charged adsorbent and the negatively charged sites of the pollutant molecules (Fig. 8d–f). It is noteworthy to mention that the removal of DAYN and TIGY was negatively impacted by increasing the pH which could be further explained based on the analysis of the relationship between pH, pHPZC, and pKa of the target drugs. The pHPZC for the prepared adsorbents, shown in Fig. 8f, demonstrated that SCBC had a pHPZC of 4.8 ± 0.2 before being impregnated with NiO nanoparticles, compared to 5.9 ± 0.2, following the impregnation. These results are similar to the previously reported pHPZC for SCBC (Franca et al. 2009; Lafi et al. 2014). As a result, the surface of the adsorbent might be positively charged at a pH value less than 4.8 ± 0.2 and 5.9 ± 0.2 for SCBC and Ni-SCBC, respectively. Therefore, at a pH value of 5.0 ± 0.2 (Box–Behnken design lower bound, and the optimum pH value as per the design analysis findings), the surface of the Ni-SCBC will be positively charged while that of SCBC is almost neutral. Occurrence of electrostatic interaction between the drug and the adsorbent is therefore more probable to occur with Ni-SCBC compared to SCBC, justifying the superior adsorption capacity of the former compared to the latter. The difference in the removal efficiency of Ni-SCBC toward DAYN and TIGY, could be related to the impact of their pKa values (Fig. 8d, e). As shown, the pKa of DAYN is 10.0 and 13.7, while TIGY has pKa values of 2.8, 4.4, 7.4, 8.9, and 9.5 (El-Azazy et al. 2021a; Kiraly and Martin 1982). As such, DAYN will be therefore positively charged at the optimum pH value, suggesting that the electrostatic interaction between DAYN and the positively charged Ni-SCBC surface might not be the reason for DAYN uptake. In this case, the surface area of the adsorbent could rationalize the high uptake of DAYN via the formation of multilayers on the adsorbent’s surface. On the other hand, the pKa of TIGY shows an amphoteric state. Therefore, there is a probability of occurrence of repulsion between TIGY and the positively charged surface of Ni-SCBC adsorbent if pH is lower than the pKa and the occurrence of electrostatic attraction if the pH is higher than the pKa. In the latter case, formation of a monolayer of TIGY on the adsorbent’s surface limits the uptake of TIGY.

Isotherm study

Most of the adsorption research is mainly focused on the removal of a single pollutant by various adsorbents. In contrast to this ideal situation, wastewater usually contains a mixture of pollutants. Another fact is that multi-component adsorption equilibrium modelling, which is critical in the design of a treatment system, is frequently overlooked. Therefore, it would be more realistic to look at the effects of binary combinations than to study the single-component systems. The existence of many drugs simultaneously is one of the most critical issues, and consequently, the interactions and competition between various drugs on the adsorption sites justify the need for further investigations. Adsorption equilibria that describe the competition between molecules on the adsorption sites are commonly utilized to better understand the behavior of the binary system components. As a result, many isotherms have been devised to represent equilibrium in such systems, such as the extended Langmuir isotherm model (Farajpourlar et al. 2013; Febrianto et al. 2009; Foo and Hameed 2010; Jebali et al. 2015).

Adsorption isotherms are usually applied to calculate the amount of adsorbate accumulated on the surface in addition to the adsorbent–adsorbate interactions. In this rehearsal, the adsorption of DAYN and TIGY from a single solution was investigated using four models: Langmuir, Freundlich, Temkin, and Dubinin–Radushkevich (D–R) (Dubinin 1947; Freundlich 1907; Langmuir 1918; Temkin 1940) (Table 6). These four models were utilized, together with the extended Langmuir isotherm, to investigate the adsorption of DAYN and TIGY from their binary mixture (El-Azazy et al. 2023).

Table 6 Isotherm model equations

Statistical error indices were employed to evaluate the accuracy of the studied isotherms. Employed functions included the root mean square error (RMSE), average relative error (ARE), mean absolute error (MAE), and mean square error (MSE) (Table S2). The RMSE was used to evaluate the average adsorption capacity of the collected data from the fitted regression nonlinear equation. In addition, the ARE and MAE error values were used to assess the variance between the predicted adsorption capacity and the observed values. The MSE was used to estimate the average square difference between the predicted adsorption capacity and the observed responses.

Applying the Langmuir isotherm model, the following assumptions could be comprehended: (I) all adsorption sites on the Ni-SCBC surface are equivalent, (II) no interaction between the adsorbed species, and (III) adsorption results in the formation of a uni-molecular layer. The Langmuir isotherm model is depicted in Fig. 9a, b for the individual drug solutions, and Fig. 9c, d for their binary mixture. The value of the separation factor, RL, can establish the type of adsorption. In the current approach, the value of RL was < 1, suggesting that the process was favorable. Furthermore, at higher drug concentrations, the adsorption became irreversible, with a qm value of 136.62 and 73.15 mg/g for DAYN and TIGY in their single solutions, respectively. The qm value in the binary mixture, on the other hand, was reduced to 54.85 mg/g for DAYN and 51.84 mg/g for TIGY (Table 7), which could be attributed to the competition between the two drugs on the adsorption sites. The obtained results conform to the findings of the Box–Behnken design.

Fig. 9
figure 9

Adsorption isotherms for the adsorption of TIGY and DAYN onto Ni-SCBC from a, b single solutions and c, d binary mixtures

Table 7 Calculated parameters for the adsorption equilibrium models used for the adsorption of both DAYN and TIGY onto Ni-SCBC nanosorbent from single solution (sin) and binary mixture (bin). Findings of the error functions’ analysis are shown next to each model

Values of the Freundlich model parameters are displayed in Table 7. The data collected for single drug solutions (Fig. 9a, b) demonstrate that the adsorption of DAYN(sin) matches well with the Freundlich isotherm. This could be comprehended from the highest R2-value (0.9758) and the lowest RMSE%, ARE%, MAE%, and MSE% error values compared to the other models. Adsorption of TIGY(sin), however, matches the Langmuir isotherm (highest R2-value of 0.9884 and lowest error values). The DAYN(sin) has a 1/n = 0.65, n = 1.54, while the TIGY (sin) has a 1/n = 0.73, n = 1.37. Therefore, the adsorption potential for DAYN(sin) will be higher compared to TIGY(sin). Furthermore, the obtained data for both DAYN and TIGY in the binary mixture fitted well to the Langmuir isotherm, as confirmed by lowest error and highest R2 (0.9217 and 0.9369 for DAYN(bin) and TIGY(bin), respectively).

Temkin isotherm is used to depict the adsorbate–adsorbent interactions. DAYN(sin) has an adsorption energy of 231.12 J/mol, while TIGY(sin) has an adsorption energy of 268.24 J/mol, as shown in Fig. 9a–d and Table 7. These results show that DAYN and TIGY are effectively adsorbed onto the surface of the Ni-SCBC nanosorbent from their single solution and agree with the Langmuir and Freundlich models' findings. The same conclusions were obtained for the binary mixture, with adsorption energies of 216.74 and 395.42 J/mol for DAYN and TIGY, respectively.

Dubinin–Radushkevich (D–R) model was utilized to find out the adsorption mechanisms of both drugs onto Ni-SCBC (Fig. 9a–d, Table 7). The obtained results indicated that the adsorption energy of DAYN(sin) is 3.00 kJ/mol compared to 1.96 kJ/mol in the case of TIGY(sin), implying that the adsorption of both drugs from their single solutions is physisorption with sorption energy < 8 kJ/mol. The physisorption mechanism could be mainly related to the higher surface area of Ni-SCBC as confirmed by the surface area and pore size analysis findings. The binary mixture data, however, showed a different pattern, with adsorption energies of 8.45 and 6.98 kJ/mol for DAYN(bin) and TIGY(bin), respectively, suggesting chemisorption in the case of DAYN and physisorption for TIGY from their binary mixture.

The adsorption of a DAYN and TIGY in their binary mixture solutions was studied using the extended Langmuir isotherm model (Table 7). The obtained data show that R2-values for DAYN(bin) and TIGY(bin) are 0.6862 and 0.8886, respectively, which are quite low compared to the previous isotherms. These data were also confirmed by the error function values (Table 7). Therefore, the extended Langmuir isotherm might not be sufficient to describe the adsorption equilibrium of both drugs onto Ni-SCBC in a binary system. Table 7 shows that the qm value of Ni-SCBC in a multi-component solution was reduced for both drugs, 58.42 and 23.50 mg/g, for DAYN and TIGY, respectively. Obtained data, therefore, confirm the competition of both drugs for the active sorption sites as reflected by reduced qm values (Issa et al. 2014).

Kinetic models

Four kinetic models were used to investigate the adsorption of DAYN and TIGY onto Ni-SCBC: pseudo-first-order (PFO), pseudo-second-order (PSO), Elovich, and Weber–Morris (WM) (Ho and McKay 1999; Lagergren 1898; Weber and Morris 1963; Wu et al. 2009) (Fig. 10a, b). Table 8 displays the estimated parameters for the examined models. According to the findings, the R2 -value for the PSO model is in a good match for the adsorption of both drugs onto Ni-SCBC (0.7878 and 0.9748, respectively). The obtained data can be further confirmed by the low value of the error functions. Based on these findings, the drug and the adsorbent concentrations control the rate of the adsorption interaction between both TIGY, DAYN, and the Ni-SCBC nanosorbent.

Fig. 10
figure 10

Kinetic models for the adsorption of a DAYN and b TIGY onto Ni-SCBC

Table 8 Calculated parameters for the four kinetic models used to investigate the adsorption of DAYN and TIGY onto Ni-SCBC. Findings of the analysis of the error functions are shown following each model

In general, the PFO and PSO are not capable of outlining the diffusion mechanisms. On the other hand, as per Elovich model, the rate of drug adsorption initially rises quickly but eventually it reaches a maximum point when the available surface area becomes saturated with the adsorbed molecules. This model also provides the Elovich constant, which is associated with the activation energy of the adsorption process, and it can be used to measure the strength of the interaction between the drug molecules and the Ni-SCBC surface. Obtained data show that DAYN adsorption conforms well to the Elovich model (as well as the PSO model), with the highest R2 value of 0.9773 and the lowest RMSE, ARE, MAE, and MSE % error (1.05%, 0.02%, 0.84%, and 1.10%, respectively). Furthermore, the initial adsorption rate of DAYN was obtained using the Elovich model. The initial adsorption rate in case of DAYN was much higher, 26,324 mg/(g min), compared to TIGY (101.69 (mg/g min)).

Finally, compared to the other kinetic models, the R2-value of WM model was too low, and the error was very high for both drugs, and it could not be utilized to explain their adsorption onto the Ni-SCBC nanosorbent.

Adsorption selectivity of Ni-SCBC

To test the adsorbent selectivity, the adsorption efficiency of Ni-SCBC toward DAYN and TIGY was compared to that of eight other drugs and dyes with varying chemical structures and pharmacological properties. Figure 11 shows that Ni-SCBC exhibited a significant adsorption efficiency of 94.30% and 67.06% toward DAYN and TIGY, respectively. Conversely, the adsorption efficiency for the other drugs and dyes was relatively lower compared to that of DAYN and TIGY. The adsorption efficiency toward the tested compounds was between 8.81% and up to 36.01%, indicating a low affinity of Ni-SCBC toward these compounds. This can be attributed to several factors, such as the effectiveness of the factorial blend used during adsorption for each pollutant, the relationship between the adsorbent's pHPZC and the adsorbate's pKa, and the chemical structure of the pollutant. The highest pollutant uptake was observed for methylene blue, with a %R of 36.01%. Notably, the pKa of methylene blue is 3.8 (Sen 2023). Since the pHPZC of the adsorbent Ni-SCBC is 5.9, the surface becomes positively charged at pH 5. Therefore, methylene blue carries a negative charge, resulting in an effective interaction with the surface and subsequent removal of the dye. On the other hand, rifampicin showed a lower %R of 17.87% as a result of the difference between the pHPZC and the pKa of the drug, which is 1.7 and 7.9, respectively (Howes et al. 2007). These pKa values suggest a zwitterionic structure, which negatively affects the removal efficiency at pH 5.

Fig. 11
figure 11

Adsorption selectivity of Ni-SCBC toward DAYN and TIGY compared to different drugs and dyes. The measurements were taken in triplicate, and the results were presented as the mean value ± SD

Desorption and Ni-SCBC recovery studies

The economic applicability of any adsorbent is crucial, and it is mostly determined by adsorbent regeneration. A desorption investigation study was conducted for this purpose using five distinct eluents, followed by six sequential adsorption–desorption cycles. Five eluents were evaluated for the desorption of both DAYN and TIGY from loaded Ni-SCBC, including 0.1 M solutions of hydrochloric acid, sulfuric acid, and sodium carbonate, in addition to 10% ethanol and water. Figure 12a depicts the relationship between the tested eluents and the desorption efficiency (%). The obtained data for the single solution revealed that 0.1 M sulfuric acid was the best eluent for DAYN, compared to 0.1 M hydrochloric acid in case of TIGY, with desorption efficiency of 93.97% and 91.63%, respectively. In case of the binary mixture, the optimal eluent was 0.1 M sulfuric acid for both drugs, with a desorption efficiency of 84.59% and 83.29% for DAYN and TIGY, respectively. As a result, 0.1 M sulfuric and hydrochloric acids were chosen as the best eluents for desorbing DAYN and TIGY from loaded Ni-SCBC.

Fig. 12
figure 12

a Effect of different eluents on desorption of both DAYN and TIGY from single and binary mixtures from Ni-SCBC, and b regeneration studies of the studied adsorbent Ni-SCBC toward the removal of both DAYN and TIGY from single and binary mixture

Cyclic adsorption–desorption studies were carried out for the adsorbent regeneration studies, and the results are presented in Fig. 12b. The acquired findings show that DAYN removal effectiveness from both single solution and binary mixture using Ni-SCBC adsorbent was decreased slightly from 95.42% (cycle 1) to 90.91% (cycle 6) for a single solution and decreased from 92.70% (cycle 1) to 83.65% (cycle 6). Besides, the same results were also obtained for the TIGY single solution and primary mixture. These data demonstrate that the investigated adsorbent is stable and can be effectively regenerated and utilized for more than six cycles with more than 80% removal effectiveness.

Cost analysis of the prepared adsorbents

To assess the economic feasibility of the prepared adsorbents, it is essential to consider the cost of all chemicals as well as the energy used. Compared to commercial adsorbents, food wastes (spent coffee grounds in this case) are available at no cost. Additionally, converting waste materials into value-added products can reduce the burden on the environment by properly recycling and reusing the waste (Ahmed et al. 2016). The estimated energy consumption for producing 1 kg of SCBC is 175.65 KWh/kg with an electricity tariff of 0.168 $/KWh (as of 2023, Qatar), which includes energy consumed by the oven and furnace. The total cost per kg of the SCBC is therefore 15.28 $. The reagents used in preparing 11 g of Ni-SCBC were oleylamine, n-propanol, Ni(NO3)2·6H2O, and ammonia solution, with a cost of 0.168 $, 1.015 $, 4.05 $, and 0.207 $, respectively. Therefore, the whole cost per g of Ni-SCBC is 0.556 $. Despite the higher cost of producing nickel-loaded biochar compared to the pristine SCBC, the higher adsorption capacity of Ni-SCBC should be considered.

Conclusions

This study aimed to remove two antibiotics, TIGY and DAYN, from synthetic wastewater samples. In this regard, two adsorbents were successfully produced using a readily abundant waste material: spent coffee grounds. A comparison between the performances of the pristine biochar (SCBC) and the nickel (II) oxide-impregnated candidate (Ni-SCBC) was convened. Ni-SCBC performed better toward both TIGY and DAYN, either from the single solutions or the binary mixture. To structure a green and sustainable, Box–Behnken design was operated to exert control over the variables impacting the adsorption process. In the same itinerary, the composite desirability function was used to decide upon the variables that could achieve the highest uptake of both DAYN and TIGY, simultaneously. Pareto charts confirmed that pH and [Drug] are the most significant variables. The highest removal efficiency of DAYN and TIGY from their single solutions was 94.30% and 67.06%, respectively. Comprehending the adsorbent behavior was attempted using different characterization techniques. The TGA/dTA analysis confirmed the thermal stability of both adsorbents in the range of 350–450 °C. FT-IR analysis obtained before and after impregnation with NiO revealed a shift in some peaks and the appearance of new peaks, confirming the presence of NiO nanoparticles. BET analysis showed that NiO impregnation increased the surface area (86.06 m2/g) of the prepared nanosorbent. Nonlinear equilibrium studies revealed that DAYN(sin) adsorption fits well with the Freundlich isotherm, while TIGY(sin) matches the Langmuir model. On the other hand, Langmuir isotherm was of choice for both drugs in their binary mixture. Kinetic studies indicated that the PSO model better described the adsorption of both TIGY and DAYN onto Ni-SCBC. Selectivity of Ni-SCBC toward DAYN and TIGY was substantiated versus an array of other potential pollutants. Reusability of Ni-SCBC was confirmed for more than 6 cycles with more than 80% removal effectiveness.

The results of our investigation can be summed up as critical, hopeful, and novel. Our findings suggest that SCBC and Ni-SCBC could be used as effective and affordable adsorbents for the remediation of drug residues. For the elimination of organic contaminants in wastewater, carbon-based materials hold out a great deal of promise. The transition from the lab scale to the industry, more research must be done on SCBC and Ni-SCBC for drug reside removal, as determined in this work.