1 Introduction

Antibiotics are one class of the most prevalent contaminants, which have been widely used in the pharmaceutical, medical and aquacultural industries (Martucci et al. 2014; Zheng et al. 2013). These contaminants have given rise to serious environmental problems due to their refractory and toxicity (Bougnom and Piddock 2017). Sulfonamides (SAs) have a high detection rate in the sewage, water, soil, surface water all over the world because of their large amount of application (Kummerer 2002; Nakata et al. 2005; Yan et al. 2018). They would induce the generation of drug-resistant bacteria (Bai et al. 2014; Davies and Davies 2010; Kim et al. 2014), and cause hypoimmunity and dysbacteriosis after entering the human bodies through food chain (Lange and Dietrich 2002; Poloni et al. 2017). Therefore, it is urgent to search for advanced technologies to remove these refractory antibiotics from water.

Many effective technologies, such as chemical remediation, advanced oxidation, photocatalysis and adsorption have been developed and applied to remove antibiotics (Zessel et al. 2014). Among these approaches, adsorption has become one of the most widely accepted technologies due to its economy, feasibility and environmental–friendliness (Gao et al. 2012; Hu et al. 2020; Kim et al. 2020; Ling et al. 2016; Xiao et al. 2018). Based on the characteristics of high porosity, hydrophobicity and aromaticity (Peiris et al. 2017), biochars (BCs) have attracted extensive attention as an excellent adsorbent for removing organic contaminants (Dai et al. 2020; Hopkins and Hawboldt 2020; Ndoun et al. 2020; Tan et al. 2015; Yao et al. 2020). BCs are the pyrolysis products of biomasses at low  temperatures (< 800 °C) in the oxygen-limited environment (Tripathi et al. 2016). Among those raw materials from agriculture for the preparation of BCs, coffee is one of the world’s most traded products with an annual output of more than 8.0 billion kg per year (Vardon et al. 2013). The solid residues (coffee grounds, denoted as CGs) containing 40% lignin (Jeguirim et al. 2014) are easy to polycondensate to form a polycyclic aromatic hydrocarbon structure, and thus are believed to be the potential to exhibit a higher fixed carbon content under hyperthermal conditions (Ma et al. 2015).

On top of all the factors that might affect the physicochemical properties of BCs (Antonangelo et al. 2019; Suliman et al. 2016), the pyrolysis temperature is a key parameter that would affect the quantity of functional groups, porosity and aromaticity level of biochar (Choi and Kan 2019). The dissociation energy required to decompose the functional groups is different owing to the distinct functionalities contained in biomass (Angin and Sensoz 2014; Gao et al. 2021; Li et al. 2019). It remains a challenge to reveal the relationship between the temperature and the biochar quality because of the various nature and composition of biomasses.

Furthermore, various modification strategies including acid and alkaline activation (Bashir et al. 2018; Guo et al. 2017; Vithanage et al. 2015; Wang and Kaskel 2012), electrochemical modification (Yang et al. 2019a), magnetic modification (Quah et al. 2020), mineral modification (Oginni et al. 2020), and oxidant modification (Huff and Lee 2016), have been applied to improve the adsorption performance of biochar. The combined alkali-acid modification can significantly improve the adsorption capacity of BCs, because the former alkali treatment could help to produce more activated sites for the latter acid modification (Tang et al. 2018), and thus not only expand the porosity of the original biochar, but also increase the number of acid binding sites and oxygen functional groups (Wang and Wang 2019). In particularly, H3PO4 acidification after the alkali treatment could optimize pore size distribution, and would be beneficial for the specific surface area increasing as well as the pore volume (Liu et al. 2012). Moreover, the enriched functional groups, P=O and P=OOH for example, could impact the charge distribution of the adsorbent and the H-bonding formation thanks to the lone pair electrons, and therefore tend to lead to the stronger surface complexation for adsorption (Peng et al. 2017). Compared to sulfuric acid, nitric acid, zinc chloride and other modification methods, phosphoric acid modification can protect the carbon skeleton and exhibit greater advantages in micropore formation (Chen et al. 2018; Kang et al. 2018; Liu et al. 2020a). Moreover, considering their environmental effect, equipment corrosion and chemical recovery, phosphoric acid is most preferred (Chu et al. 2018; Prahas et al. 2008). To our knowledge, there has been no report on the synergistic modification of biochar through combined alkaline and phosphorous acid treatment.

Herein, we aim to prepare a series of H3PO4-modified coffee grounds-derived activated biochar (PABC) materials for removing sulfadiazine (SDZ) in aqueous solutions. The effects of pyrolysis temperature and phosphoric acid modification on the adsorption performance of biochar were systematically explored in the first place.

2 Materials and methods

2.1 Chemicals and reagents

Chemicals used in this work were of reagent-grade and were dissolved in deionized water. SDZ (98%), KOH, HCl and H3PO4 were purchased from Aladdin (Shanghai, China).

2.2 Adsorbents preparation

Coffee grounds (CGs) were collected from the Starbucks located in Fuzhou City, Fujian Province, China. CGs were washed with 75% ethanol and then dried in an oven at 60 °C for 12 h. After being dried, CGs were screened by 100 mesh sieve. The pre-treated CGs were calcined in a tube furnace (GSL-1500X, China) for 1 h under N2. CGs pyrolyzed at 500 °C, 600 °C and 700 °C were labelled as CBC-500, CBC-600 and CBC-700, respectively. Then, the CBCs were activated with two equivalents of KOH at 700 °C for 1 h to obtain activated carbon ABC-500, ABC-600 and ABC-700. The ABCs were washed with hydrochloric acid (0.1 M) and deionized water until the pH of the filtrate equaled 7.0.

PABCs were prepared as follows: ABCs were firstly mixed with 35.0 wt% phosphoric acid at a mass ratio of 1:2, and then immersed for 30 min before being sonicated for 10 min. This process was repeated for 6 times. After that, the H3PO4-modified sample was repeatedly washed with deionized water until the pH value of the eluate was about 7.0. After being dried overnight at 60 °C in an oven, PABCs were prepared and denoted as PABC-500, PABC-600 and PABC-700, respectively.

2.3 Characterization

The surface morphology was obtained by scanning electron microscope (SEM, ProX Premium, Phenom, Netherlands). Powder X-ray diffraction (PXRD) was carried out on a diffractometer (Miniflex 600, Rigaku, Japan) with Cu Kα radiation (λ = 0.154 nm). The Raman spectra were measured on a Raman spectrometer (LabRAM HR800, HORIBA Jobin Yvon, France) using 633 nm laser. The N2 adsorption/desorption isotherms, surface area and porous properties were determined by the Brunauer–Emmett–Teller method (BET, ASAP2460, Micromeritics, USA) at liquid nitrogen temperature (77 K). The carbon (C), hydrogen (H), and nitrogen (N) contents of each biochar sample were evaluatedusing an Elemental Analyzer (Vario max cube, Elementar, Germany). X-ray photoelectron spectroscopy (XPS, ESCALAB 250Xi, Thermo Fisher, USA) served for the element composition determination with Al Kα x-ray source (15 kV, 10 mA). The functional group analysis of ABC-700 and PABC-700 was carried out by the Fourier transform infrared spectrometer (Nicolet iS50, Thermo, USA), with a spectral range of 400–4000 cm−1. The zeta potential was determined using a high sensitivity Zeta potential analyzer (NanoBrook Omni, Brookhaven, USA). Thermogravimetric analysis was performed using a thermogravimetric analyzer (TG 8120, Rigaku, Japan) at a heating rate of 10 °C/min, and a nitrogen flow rate of 100 mL/min. A drop shape analyzer (DSA100, Krüss GmbH, Germany) was employed to observe the contact angle (CA) of biochar samples.

2.4 Batch adsorption experiments

In a typical batch adsorption experiment, 5.0 mg adsorbent was added to 50 mL SDZ solution (10 mg/L) shaking in a water bath thermostatic oscillator (25 °C, 130 r/min), and sampled for the determination of SDZ concentration using a UV–vis absorbance (UV-2600, Shimadzu, Japan) at 246 nm. The standard curves of SDZ determined at various pH values were demonstrated in Fig. S1.

Similarly, the adsorption isotherms were measured by adding 5.0 mg adsorbent to a range of concentrations (1–20 mg/L) of SDZ solutions and shaking in a water bath thermostatic oscillator (25 °C, 130 r/min) for 720 min.

The amount of SDZ adsorbed at equilibrium (qe (mg/g)) was calculated by the following equation (Eq. (1)):

$$q_{e} = (C_{0} - C_{e} )V/W,$$
(1)

where qe (mg/g) is the adsorption capacity of an antibiotic. C0 (mg/L) and Ce (mg/L) indicate the initial concentration and equilibrium concentration, respectively. V (L) is the volume of reaction solution and W (g) is the mass of the adsorbent.

Pseudo-second-order kinetic model (Eq. (2)) (Ho 2006) was represented asfollows:

$$t/q_{t} = 1/k_{2} q_{e}^{2} + t/q_{e} = 1/h + t/q_{e} ,$$
(2)

where qt (mg/g) is the adsorption amount at time t. k2 (g/(mg min)) is the rate constant determined by the t/qt versus t, and hindicates the initial adsorption rate.

The Langmuir (Eq. (3)) (Yang et al. 2017) and Freundlich (Eq. (4)) (Yao et al. 2011) isotherm models are shown below:

$$q_{e} = q_{m} K_{L} C_{e} /\left( {1 \, + K_{L} C_{e} } \right),$$
(3)
$$q_{e} = K_{F} C_{e}^{1/n} ,$$
(4)

where qm (mg/g) is the maximum adsorption capacity. Ce (mg/L) is the solution equilibrium concentration. KL is the Langmuir constant; KF and n are the Freundlich constant.

3 Results and discussion

3.1 Physical and chemical properties of the synthetic carbonaceous materials

SEM (Fig. 1a–i) illustrated the morphology changes of the biochars under different treatments. It could be clearly seen that initial biochars possessed smooth surface, and limited pore structures were observed. After KOH activation, the surface of ABCs became rough and collapsed which should be ascribed to the etching effect of alkali vapor. Furthermore, it was obvious that roughly porous structures were revealed on the surface of PABCs after the modification by H3PO4.

Fig. 1
figure 1

SEM patterns of a CBC-500; b ABC-500; c PABC-500; d CBC-600; e ABC-600; f PABC-600; g CBC-700; h ABC-700; and i PABC-700 (×15,000 magnification)

As depicted in the XRD pattern (Fig. 2a), two obvious broad peaks were discovered at 2θ = 24.2° and 43.4° for PABCs prepared at various pyrolysis temperatures. These two peaks were supposed to be assigned to the (002) and (100) crystal planes of graphite carbon. The intensity of the peak at 24.2° decreased along with the rise of the temperature, which was an implication of the increase of the disordered carbon along withthe reduced degree of graphitization (Zhang et al. 2019).

Fig. 2
figure 2

a XRD data of ABC-700 and PABCs; b Raman spectra with band ratio (ID/IG) for ABC-700, and PABC-700 before and after adsorption of SDZ

Moreover, the PABC-700 showed a relatively weak intensity at 24.2° compared to ABC-700. It was evident that the H3PO4 modification was propitious to form disordered carbon at the fixed pyrolysis temperature. In addition, the decrease of ID/IG from 1.502 for ABC-700 to 1.460 for PABC-700 as calculated from the Raman shift (as shown in Fig. 2b) conveyed that abundant functional groups existed on the external surface and some surface defects were occupied after phosphorous acid modification (Deng et al. 2015).

A type I adsorption isotherm was discovered as shown in Fig. 3 based on the analysis from the adsorption/desorption of the N2. According to Table 1, both the BET surface areas and pore volume of PABCs were enlarged compared with ABCs prepared at related pyrolysis temperatures, and thus PABCs showed a superior porosity to ABCs. Notably, ABC-600 had smallest C content, BET surface area and pore volume compared with those obtained at 500 and 700℃. It was deduced that the volatiles, tars and other products produced by the pyrolysis of coffee residue at about 600 °C would block part of biochar channels (Sakhiya et al. 2020). With the further increase of pyrolysis temperature, these products would eventually decompose into volatile gases and escape, which resulted in more microporous structures, leading to an increase in pore volume (Angin et al. 2013). It should be noted that, biochar prepared at 700 °C had specific pore structures, especially the ratio of the micropore volume. As shown in Table 1, the surface area and volume of the micropore in PABC-700 obtained from the BET and DFT models are approximately 1.6 times those of PABC-500, respectively. In addition, the mesoporous surface area decreased rapidly from 705 m2/g for PABC-500 to 185 m2/g for PABC-700, indicating the transition from mesoporous to microporous structure with the temperature increase.

Fig. 3
figure 3

Pore size distribution of a ABCs and b PABCs. Inset: N2 adsorption/desorption isotherms

Table 1 Physical parameters of ABCs and PABCs

Interestingly, the introduction of phosphoric acid activation (PABC-700) could further improve the Smic and Vmic by 10% and 13% compared with ABC-700. The H/C atomic ratio (as shown in Table 1) reinforced the fact that PABC-700 exhibited the highest aromaticity among all the prepared biochar samples (Xiao et al. 2016).

The pyrolysis behaviors of PABCs were further investigated through TGA as shown in Fig. S2. The weight loss that happened before 120 °C was mainly because of the water removal. After that, PABC-500 and PABC-600 showed relatively good thermal stability until an obvious weight loss at higher temperatures that ascribed to the decomposition of lignin was detected (Reza et al. 2020). What’s more, only small amount of weight loss was detected during the whole duration for PABC-700 ,showing an extremely high thermal stability.

The expatiatory XPS spectra of major elements, including C1s and P2p were exhibited in Fig. 4b, c. Peaks at 284.8 eV, 285.8 eV and 286.8 eV were contributed by C–C, C–O and C=O, testifying the hydrophobic surface of PABC-700 (Wei et al. 2017; Zhao et al. 2016), which would be beneficial to the conductive of adsorption (Tomczyk et al. 2020). As for P2p, two peaks at 134.1 eV and 135.8 eV, attributed to P–O and P=O (Liu et al. 2017; Pan et al. 2021), were separated as an evidence for the successful introduction of phosphorus-containing groups to the surface of PABC-700 by means of phosphoric acid modification. Obviously, phosphoric acid modification made PABCs possess diversified surface functional groups. As shown in the FT-IR spectra (Fig. 4d), there was a broad band around 800–1500 cm−1, and a new peak was observed at 1080 cm−1 for PABC-700. This band is caused by the symmetric vibration of ionized link P–O in P–phosphate ester and the symmetrical vibration of the polyphosphate chain P–O–P (Zeng et al. 2021).

Fig. 4
figure 4

XPS survey spectra of a PABC-700; b C1s spectra of PABC-700; c P2p spectra of PABC-700; and d FTIR spectra of ABC-700 and PABC-700

Based on the above characterizations, the mechanism for the construction of micropore dominated functional biochar was speculated as follows: the lignin is the main component of coffee residue (Jeguirim et al. 2014), and high temperature is helpful for the cross-linking of aromatic ring structure and the change of internal microcrystalline structure of lignin, which reduces the degree of graphitization (in accordance with the XRD analysis as shown in Fig. 2a). Activation of phosphoric acid can catalyze the fracture of the functional groups of lignin side chains and their monomers (Xie et al. 2019). At the same time, phosphate derivatives (pyrophosphoric acid and metaphosphoric acid) embedded in lignin structure acted as cross-linking agent of the aromatic ring lamellae of lignin through phosphate ester bond. Thus, the pore structure collapsed due to the thermal shrinkage of aromatic ring condensation at high temperature can be restored and prone to promote the micropore transformation (Pu et al. 2020).

3.2 Adsorption study

As presented in Fig. 5a, c, the initial adsorption rate (h) of PABCs was remarkably accelerated compared with that of ABCs, and PABCs reached adsorption equilibrium within 180 min, while it was 720 min for ABCs. The obtained results analyzed by pseudo-second-order model were shown in Table 2. Pseudo-second-order model resulted in high fit degree for all biochars, and attested that the adsorption process was mainly controlled by chemical process rather than the mass transfer step (Liu et al. 2020b). According to the pseudo-second-order kinetic fitting parameters, the equilibrium adsorption capacity (qe) of PABCs was about 10% higher than that of ABCs. Significantly, the adsorption rate constant (k2) and initial adsorption rate (h) of PABCs were about twicethose of ABCs, and the adsorption half-life (t1/2) of PABCs was greatly shortened. The initial adsorption rate of SDZ followed the sequence of PABC-700 > PABC-500 > PABC-600, ABC-700 > ABC-500 > ABC-600. This phenomenon was speculated to be caused by their surface characteristics and specific adsorptive interactions. PABCs possessed excellent porosity (as shown in Table 1), which could provide more adsorption sites.

Fig. 5
figure 5

The SDZ adsorption kinetics and linear fitting plots of a ABCs and c PABCs; and adsorption isotherm fittings of b ABCs and d PABCs

Table 2 The pseudo-second-order kinetic curve fitting parameters and adsorption isotherm parameters of ABCs and PABCs

The adsorption isotherms for SDZ in both ABCs and PABCs are shown in Fig. 5b, d. It was obvious that the data could be better fitting the Langmuir model (Table 2),indicating a monolayer adsorption (Zhou et al. 2017). The maximum adsorption capacities (qm) of biochar to sulfadiazine followed the order of PABC-700 > PABC-500 > PABC-600, ABC-700 > ABC-500 > ABC-600.

3.3 Comparisons of the sulfadiazine adsorption performance

The adsorption performance of various adsorbents for SDZ was compared (Table 3). The adsorption capacity of PABC-700 prepared in this work was 46–80% higher than that of the reported activated biochars (He et al. 2021; Zhang et al. 2021a; Wang et al. 2019; Meng et al. 2020), exceeding that of carbon nanotubes (Liu et al. 2020c) and commercially available activated carbon (Berges et al. 2021). Besides, PABC-700 demonstrated higher adsorption affinity (as indicated from KL) compared to other adsorbents with similar adsorption capacity. And the KL of PABC-700 was even 10 times that of multi-walled carbon nanotubes (Liu et al. 2020c). It was of great importance to find that the phosphoric acid modified coffee grounds-based biochar had both high adsorption capacity and adsorption affinity.

Table 3 The adsorption capacity of sulfadiazine with various adsorbents

The large adsorption capacity and affinity should be ascribed to the micropore structure of the PABC-700 and the physicochemical properties of biochars and antibiotics. The contact angles (CA) were determined and the results are shown in Fig. S3. The improvement of surface hydrophobicity after phosphoric acid modification was confirmed lying on the fact that the CA values of PABC-500, PABC-600 and PABC-700 were raised to 138.8°, 139.9° and 141.7°, respectively. The hydrophobic amide structure of sulfadiazine would have great affinity with the hydrophobic groups on the surface of biochar through hydrophobic partition (Ovung and Bhattacharyya 2021). In addition, as the micropores represented almost 85% of the pore volume, the hydrophobic cavities of these micropores exhibited a confinement effects for the adsorption of SDZ (Luo et al. 2020) to illustrate an accelerated initial adsorption rate. The ID/IG of PABC-700 further dropped to 1.290 after use (as shown in Fig. 2b), indicating more defect sites were taken by the adsorbents. Furthermore, the gathering of the surface functional groups played a crucial role in the adsorption process. In particular, phosphorus-containing functional groups were successfully introduced to the PABC-700 surface through phosphoric acid modification (as shown in Fig. 4d), which allowed the adsorbent to bind to the surface of the adsorbent faster (Ahmed et al. 2017). On one hand, SDZ molecules acted as π–electron acceptors due totheir amino functional groups. On the other hand, the biochar surface was rich in C=C, C–O, and –OH functional groups (as shown in Fig. 4d) to demonstrate a strong ability to donate electrons. In addition, biochars prepared at high temperatures possessed high content of electron rich aromatic rings, which presented strong electron donating ability to form the cation–π interaction with SDZ (Ahmed et al. 2017; Peiris et al. 2017). Therefore, the surface hydrophobicity together with the π–π electron–donor–acceptor (EDA) interaction was speculated to play the leading role for binding SDZ (Teixido et al. 2011; Zhang et al. 2016).

3.4 Effect of pH

The points of zero charge (pHPZC) of ABC-700 and PABC-700 were then determined to explain the surface charge alteration at a wide pH range as shown in Fig. 6. The results showed that the pHPZC for ABC-700 and PABC-700 were 4.5 and 1.2, respectively. The acidic migration for isoelectric point of PABC-700 was ascribed to the abundant acidic functional groups on the biochar surface after H3PO4 modification. Moreover, according to the dissociation constants of SDZ, when pH < 1.57, most of SDZ existed in the form of cations (SDZ+) (Yang et al. 2019b), which supported the phenomenon that modified biochars were more favorable for the adsorption of SDZ at low pH driven by electrostatic forces (Table 4). Contrarily, when pH > 6.5, SDZ mostly existed in the form of anions (SDZ), at which the negative surface zeta potential value of biochars resulted in electrostatic repulsion with the SDZ molecule, causing a decrease of equilibrium adsorption capacity (qe) and initial adsorption rates (h) as shown in Fig. 7c, d.

Fig. 6
figure 6

The Zeta potential plots of ABC-700 and PABC-700

Table 4 The pseudo-second-order kinetic curve fitting parameters of ABC-700 and PABC-700 at different pH
Fig. 7
figure 7

The SDZ adsorption kineticsof a ABC-700 and b PABC-700; and the comparison of c qe and d h of both materials at pH of 3.0–11.0

As pH had significant effects on the existing forms of SDZ as well as the functional groups located on biochars, its influence on SDZ adsorption process was investigated. At low pH, the protonated amino groups (–NH3+) on sulfadiazine and the hydroxyl group on the biochars formed strong EDA interaction. The amino groups (–NH2) of sulfadiazine were presented as protonated amino groups (–NH3+) at low pH. Hence, hydrogen bonding was likely to exist between the –NH3+ groups in SDZ and the oxygenated groups on the surface of PABCs (Chen et al. 2019; Wang et al. 2020). Sulfadiazine behaved as neutral species that consisted of sulfonamide groups and lone pair electron rich N atoms when the pH valueranged from 1.57 to 6.5. Thus, Lewis acid–base interactions could contribute to the adsorption affinities due to the extra interaction between the lone pair electron on the SDZ and protons from carboxylic and hydroxyl groups on the PABCs surface (Yang et al. 2019b). As pH increased to 7 and 9, the surface of ABC-700 and PABC-700 became negatively charged while sulfadiazine also existed in negative species [> pKa2 (6.5)]. Within this range, ABC-700 and PABC-700 maintained good qe even though the electrostatic repulsion emerged. This was an indication as π–π electron–donor–acceptor (EDA) interaction and surface hydrophobicity still played the leading role. However, at pH up to 11.0, the adsorption of sulfadiazine by ABCs and PABCs significantly decreased due to the strong electrostatic repulsion between SDZ species and the negative surface of ABCs and PABCs.

3.5 Effect of ionic strength, cations and anions on sorption

The impacts of coexisting ions in water on the adsorption effects of SDZ were fully revealed according to the results obtained from the systematical examinations of the cationic and anionic species, valences, and concentrations (as shown in Fig. 8). The SDZ removal efficiency was slightly improved with respect to the addition of monovalent cations, such as Na+ and K+. This could be explained with the salting-out effects which lead to the hydrophobic SDZ less dissolved in water while adsorbed more on the PABC surfaces. However, this phenomenon did not simply occur when divalent cations, such as Ca2+ and Mg2+ were under consideration. Interestingly, there was a game relationship between the salting-out and squeezing-out effects (Zhang et al. 2010). In other words, the salting-out effect dominated for cations at low concentrations and thus caused the improvement in the removal efficiency. Nevertheless, the squeezing-out effects, inducing the compacting of porous structures, which was against for SDZ adsorption, would play the leading role in keeping  lifting the concentrations, and  inhibiting the adsorption efficiency thereafter (Jiang et al. 2016). Adding Cl or SO42− had negligible effect on SDZ sorption (Fig. 8b). However, HCO3 and HPO42− had negative impact on SDZ removal. The aqueous solutions of NaHCO3 and NaHPO4 were weakly alkaline, and the  electrostatic repulsion between SDZ species and the negative surface of PABC-700 under alkaline conditions was the main reason for the decrease of removal efficiency.

Fig. 8
figure 8

Added cations (Na+, K+, Ca2+, Mg2+using NaCl, KCl, CaCl2 and MgCl2, respectively) (a) and added anions (Cl, HCO3, SO42−, HPO42−, using NaCl, NaHCO3, Na2SO4 and Na2HPO4, respectively) (b) affecting SDZ adsorption on PABC-700

4 Conclusions

The micropore dominated activated carbons with remarkably high adsorption capacity and affinity for SDZ were prepared via alkali/phosphoric acid modification using carbonized coffee grounds. The maximum adsorption capacity of biochars followed the order of PABC-700 > PABC-500 > PABC-600, ABC-700 > ABC-500 > ABC-600. The results demonstrated that phosphoric acid modification and pyrolysis temperatures had significant effects on the properties of the PABCs, and consequently PABC-700 showed optimal SDZ adsorption capacity. In particular, the adsorption affinity was greatly improved to be competitive to the latest boron nitride bundles and multi-walled carbon nanotubes. It is believed that excellent porosity, newly formed phosphate, enriched acidic and carboxyl groups made a significant contribution for increasing the qm of PABC-700. In addition, the effects of temperature should be emphasized during the preparation process of biochar to avoid the blocking of porous structures by tars and volatiles generated during pyrolysis. Overall, this study provides an efficient sulfadiazine removal technology, as well as supplies an economical and environmentally friendly approach for coffee grounds disposal.