1 Introduction

Biomass-derived porous carbons (BDPCs) have been regarded as promising electrode materials of supercapacitors owing to their rich source, low cost, and diverse structures [1]. Till now, numerous BDPCs have been synthesized by direct carbonization of biomass, such as porous layer-stacking carbon derived from fungus [2], porous graphitic carbon form bamboo [3], sponge-like carbonaceous hydrogel from watermelon [4], and 3D hierarchical porous carbon from corn husk [5]. These BDPCs exhibit large specific surface area (A), which can store considerable electrostatic charge on the electrode/electrolyte interface, and thus achieve high specific capacitances (CS) as electrode materials of supercapacitors [6]. In addition, the pore size and distribution also can essentially determine the capacitance and rate performance of supercapacitors. Many references have confirmed that micropores (< 2 nm) can not only contribute a large value of A, but also narrow the interspace (d) between the electrolyte ion and the carbon electrode surface, enhancing the CS of supercapacitors, according to the equation CS= εA/d [7]. Nevertheless, the micropores would restrict the ions diffusion during the rapid charge/discharge process, resulting in low rate performance especially at high power densities. In comparison, BDPCs containing mesopores are desired to buffer electrolyte for accelerating ions transportation and increasing the power density of supercapacitor [8]. Therefore, it is urgent to develop novel BDPCs with optimized pore size distribution, because a well-defined hierarchical porosity can effectively concert each pore level during the electrochemical process, resulting in high capacitive performances [9]. For example, a salt-template method was used to prepare hierarchically porous carbons containing both micropores (< 1 nm) and mesopores (around 5 ~ 30 nm), which show a much better supercapacitive performance (75 F g−1 at 10 mV s−1) than the control sample containing only micropores (17 F g−1 at 10 mV s−1) [10]. However, the practical capacitance is still far below from the theoretical value, due to the low utilization efficiency.

It is well known that the surface chemistry property of BDPCs impacts more on the electrochemical performances than the porous structure. In recent years, the incorporation of specific heteroatoms (such as N, S, P, B) on the surface of BDPCs has been proven to be a promising way to improve the surface wettability, available surface area, and utilization efficiency of BDPCs. Meanwhile, the heteroatom containing functional groups can further introduce faradaic pseudocapacitance, resulting in a greatly enhanced specific capacitance for the electrodes. Chitosan, as one of the most abundant and renewable biopolymers, is a kind of N-deacetylated derivative of chitin with the presence of primary amino and hydroxyl groups, and the high nitrogen element content in chitosan makes it a favorable precursor for the synthesis of N-doped carbon materials [11, 12], without the use of time-consuming and costly methods. Hao et al. [13] synthesized N-doped hierarchical porous carbon aerogels through carbonization of chitosan aerogel followed by activation with KOH, this material showed a high specific capacitance of 197 F g−1 at 0.2 A g−1 due to its high specific surface area and N-doping. Specifically, multiple heteroatoms co-doped BDPCs have also been developed owing to the verified synergistic effects, which can not only increase the content of heteroatoms to enlarge pseudocapacitance, but also promote the conjugation of carbon backbone for high electric conductivity, and thus enhancing the overall electrochemical performances of supercapacitor [14]. Among the co-doping combination, N/S co-doping are particularly interested due to similar electronegativity and Van der Waals radius to carbon [15]. Many references have been reported to synthesize N/S co-doped porous carbons, which shown enhanced capacitive behaviors compared to undoped or single-doped materials [16, 17]. For example, Yan et al. [18] synthesized an N/S co-doped porous carbon by a methanesulfonic acid-assisted carbonization of freeze-dried chitosan/urea mixture, the material achieved a high specific capacitance of 272 F g−1 at 1.0 A g−1, which is significantly higher than that of S-doped carbon (174.8 F g−1) and undoped carbon (133 F g−1). However, those strategies usually involve tedious steps and strict control on treatment conditions; therefore, novel and simple strategies for large-scale production of N/S co-doped porous carbons are still highly desired, and the pore structure and size distribution are also should be well designed simultaneously.

Here, we develop a molten-salt templated method to synthesize N/S co-doped porous carbon (NSHPC) with hierarchically micro/mesoporous structures for high-performance supercapacitors. In this method, chitosan was used as carbon/nitrogen source, K2SO4 as sulfur source, and KCl/LiCl eutectic mixture as a hierarchical template. These materials were uniformly mixed via solid-state ball-milling and treated at a high-temperature carbonization process. Benefiting from the high specific surface area, hierarchically porous structure, and N/S co-doping, the as-prepared NSHPC exhibited a high capacitance, excellent rate performance, and long-term stability as the electrode material of supercapacitors.

2 Experimental section

2.1 Materials

Chitosan (90% deacetylation degree) was purchased from RuJi Chemicals. Sucrose, potassium sulfate (K2SO4), potassium chloride (KCl), and hydrochloric acid (HCl, 36.5 wt%) were obtained from Sinopharm Chemical Reagent Co., all of these materials were used as received.

2.2 Synthesis of NSHPC

The N/S co-doped hierarchically porous carbon (NSHPC) was synthesized by a molten-salt templated method. Typically, chitosan (0.5 g), K2SO4 (0.5 g), KCl (55 g), and LiCl (4.5 g) were pre-blended and transformed into an agate jar with graded agate balls (the ball to powder ratio was 5:1), these materials were ball-milled in solid state at a speed of 200 rpm for 3 h, the generated homogeneous mixture was then annealed at 700 °C under a N2 atmosphere for 5 h with a heating rate of 5 °C min−1. After that, the as-prepared product was washed several times with diluted HCl (5 wt%) and deionized water, and finally vacuum dried at 60 °C for 24 h.

Since sucrose has a similar chemical structure to chitosan, for comparison, a control sample was also prepared using sucrose as the N-free carbon source through the same procedure. As a result, S-doped hierarchically porous carbon was synthesized, named as SHPC.

2.3 Materials characterization

The morphologies of the samples were examined on a field-emission scanning electron microscope (SEM, Hitachi SU8010) and a transmission electron microscope (TEM, FEI Tecnai G220). The specific surface area and pore size distribution were conducted from nitrogen sorption isotherms carried out on ASAP 2020 Plus HD88 physisorption. The molecular structures were characterized by X-ray diffractometer (XRD, Bruker Advanced D8) equipped with a CuKα radiation source, confocal micro-Raman spectrometer (DXR2 XI) with Ar+ laser emitting a wavelength of 514.5 nm as the excitation source, and X-ray photoelectron spectroscope (XPS, VG Multilab 2000) with a monochromatic AlΚα X-ray source.

2.4 Electrochemical measurements

The electrochemical performances of the samples were tested in a three-electrode system using a CHI760E electrochemical workstation (Chenhua Instrument Company, Shanghai). The working electrodes were prepared by grinding the active materials with acetylene black, polytetrafluoroethylene (8: 1: 1 in mass), and a small amount of isopropanol into a homogeneous slurry, which was then pressed onto carbon papers (1 cm2), dried in vacuum at 80 °C for 12 h, and finally infiltrated in 6 M KOH aqueous electrolyte over night before used as the working electrode. Notably, the active material on each carbon paper was about 2 ~ 5 mg. Platinum foil was served as the counter electrode, and saturated calomel electrode (SCE) was employed as the reference electrode, respectively. The cyclic voltammetry (CV) tests were carried out with scan rates ranging from 20 to 500 mV s− 1 in a voltage window of −0.3 ~ 0.7 V. Galvanostatic charge–discharge (GCD) curves were measured with different current densities varying from 1 to 50 A g−1. Electrochemical impedance spectroscopies (EIS) were conducted from 0.01 to 105 Hz with an amplitude of 5 mV referring to the open-circuit potential.

3 Results and discussion

3.1 Structural characteristics

The NSHPC was synthesized through a molten-salt templated method, as shown in Fig. 1. Chitosan was first dispersed into K2SO4, KCl, and LiCl salts by solid-state ball-milling to generate a homogeneous mixture. Since no solvent was employed in this process, the mixture can be heat-treated directly at 700 °C for 5 h, without having to freeze-drying in advance. During the heat-treatment process, the eutectic mixture of molten KCl/LiCl (with a melting point of 353 °C) [19] was used as the solvent to dilute chitosan and K2SO4, it allowed the simultaneous carbonation and functionalization of chitosan to generate N/S co-doped carbon in a mild condition. Meanwhile, the KCl/LiCl eutectic mixture can also act as a template to create hierarchical structures, and consequently form micro/mesopores after removing the salts. The process was also successfully extended for the synthesis of SHPC by replacing chitosan with sucrose.

Fig. 1
figure 1

Schematic illustration for the fabrication of NSHPC

Fig. 2
figure 2

Typical SEM images of NSHPC (a, b), TEM images of NSHPC (c, d) and SHPC (e, f)

The morphology of NSHPC was first characterized using SEM images, as shown in Fig. 2a–b, and NSHPC displays a rough surface with high-density pores. The morphology was further ascertained by TEM image (Fig. 2c), nanosized pores (the bright spots) are homogeneously distributed throughout the carbon sheet, and the high-resolution TEM image (Fig. 2d) shows that the pores present a vermicular configuration with an average diameter of ~ 3 nm, forming an interconnected 3D porous structure. The SHPC has a similar morphology with NSHPC, the TEM images (Fig. 2e–f) clearly reveale the existence of plentiful nanosized pores in SHPC, and the interconnected hierarchically porous structure would offer effective paths for the penetration and transportation of electrolyte ions, resulting in improved electrochemical performances of supercapacitors [20].

The pore structure of the samples was further examined by N2 adsorption/desorption measurements, as shown in Fig. 3a, and the NSHPC and SHPC display typical type IV isotherms with H4-type hysteresis loops in the relative pressure range of 0.4–1.0, indicating the co-existent of micropores and mesopores in the materials [20]. The Brunauer–Emmett–Teller (BET)-specific surface areas were measured to be 994 and 765 m2 g−1 for NSHPC and SHPC, respectively, which are comparable to lots of porous carbons derived from biomaterials, as shown in Table 1 [10, 12, 18, 21,22,23,24], and a large specific surface area is beneficial to contribute electrical double-layer capacitance (EDLC) for supercapacitor [25]. The total pore volumes of NSHPC and SHPC are 0.51 and 0.55 m2 g−1, while the micropore volumes decreased from 0.17 to 0.10 m2 g−1, with the ratios of micropore declined from 33.3 to 18.2%, respectively. Since the micropores are beneficial for improving the specific capacitance, while the mesopores are conducive to the diffusion rate of electrolyte in the hierarchical porous structure, the optimal micropore volume ratio tends to enhance the comprehensive performances of supercapacitor [21]. In addition, the pore size distribution plots were further determined from the adsorption branches of the isotherms using the Barrett–Johner–Halendar (BJH) theories, as shown in Fig. 3b. Evidently, the pore size distribution curves demonstrate the presence of micropores of 1.6 nm as well as mesopores about 2.5 and 3.7 nm in diameter; the micropores can be created by the gas release from the carbonization of chitosan [18], while the mesopores can be derived from the eutectic KCl/LiCl template [19], and these analysis results are constant with the above TEM observations. The hierarchically porous structure can effectively enhance the rate performance of supercapacitor by facilitating the ions diffusion through the vermicular mesopores to the inner micropores, resulting in high utilization efficiency of surface area and large capacitance. Meanwhile, the mesopores can also act as ion-buffering reservoirs for shortening the pathways of ion diffusion during the electrochemical reactions, thus improving the rate capability of supercapacitor [26].

Table 1 A surface area comparison of biomaterial derived porous carbons

XRD patterns were detected to analyze the crystallinity of NSHPC and SHPC, as shown in Fig. 3c, two broad diffraction peaks arise at around 2θ = 24° and 43°, corresponding to the (002) and (100) lattice planes of graphite carbon, respectively [27]. Notably, the diffraction peaks present widened full widths at half maximum (FWHM), reflecting degraded graphitization of NSHPC and SHPC, which can be attributed to their porous structure and heteroatom doping [28]. Raman spectra of NSHPC and SHPC (Fig. 3d) were also used to detect their defect degree of porous carbon, two characteristic peaks located at 1340 and 1588 cm−1 are corresponding to the D band and G band, respectively [29]. The D band represents to the structural defects/disorder of carbon framework, while the G band is attributed to the E2g symmetric vibrational mode of the sp2-bonded carbon materials; therefore, the intensity ratio of D and G bands (ID/IG) is widely used to represent the disorder or defects degree of carbonaceous materials [30]. The calculated ID/IG value for NSHPC (1.11) is slightly higher than that of SHPC (1.02), suggesting higher defects or disorders in the carbon framework of NSHPC due to the increased amount of N and S heteroatoms [31].

Fig. 3
figure 3

a N2 adsorption/desorption isotherms, b pore size distributions, c XRD patterns, and d Raman spectra of NSHPC and SHPC

XPS studies were further preformed to confirm the chemical compositions of samples, Fig. 4a displays the XPS survey spectra of NSHPC and SHPC. Four distinct peaks centered at 164.1, 228.1, 285.1, and 532.1 eV present in the spectrum of SHPC, corresponding to S 2 s, S 2p, C 1 s, and O 1 s, respectively [15]. In comparison, an additional N 1 s peak at 400.1 eV emerges in the curve of NSHPC, and the atomic percentage of S and N heteroatoms in NSHPC is about 10.2% and 4.5%, which can be derived from K2SO4 and chitosan, respectively [19]. Such high contents of N and S heteroatoms and the associated functional groups in the NSHPC can help to improve wettability with the electrolyte, leading to a larger accessible surface area and higher specific capacitance [32]. The high-resolution N 1 s spectrum can be deconvoluted into four major peaks at around 399.3, 399.9, 401.1, and 403.7 eV (Fig. 4b), attributing to the pyridinic-N, pyrrolic-N, graphitic-N, and oxidized-N, respectively. It has been reported that the preponderant pyridinic-N and pyrrolic-N located at the edge of carbon skeleton can effectively enhance the capacitive performance, while the graphitic-N can improve the electric conductivity of carbon materials [33]. The high-resolution C 1 s spectrum of NSHPC (Fig. 4c) can be deconvoluted into four peaks corresponding to C‒C/C = C (284.5 eV), C‒N/C = N (285.9 eV), C‒O/C‒S (286.9 eV), and C = O (288.7 eV), further confirming the successful doping of N and S into NSHPC. Notably, the absence of C‒N/C = N peak in the C 1 s spectrum of SHPC is ascribed to the deficiency of N in sucrose (the raw material) [18]. Figure 4d shows the resolved S 2p spectra of NSHPC and SHPC, the peaks at 163.6 and 165.1 eV are attributed to the spin-orbit coupling 2p 3/2 and 2p 1/2 of thiophene-S (C‒S‒C), respectively, and the weak peak at ~ 168.2 eV corresponds to C‒SOx (x = 2 ~ 4) groups [20]. These results indicate that the S is successfully doped into the carbon framework of NSHPC and SHPC rather than present as residue or impurities.

Fig. 4
figure 4

a XPS spectra of NSHPC and SHPC, high-resolution N 1 s of NSHPC (b), high-resolution C1s (c), and S 2p (d) of NSHPC and SHPC

3.2 Electrochemical performance

In consideration of the unique morphological structure, large specific surface area, hierarchical pore distribution, and high heteroatom doping, the as-prepared NSHPC was expected to be a promising candidate electrode material of supercapacitor. The electrochemical performances of NSHPC and SHPC were first analyzed using CV technology with a three-electrode system in 6 mol L−1 KOH aqueous electrolyte. Figure 5a shows the CV curves of NSHPC electrode at different scan rates ranging from 25 to 500 mV s−1 in the potential window of − 0.3 to 0.7 V, the curves exhibit quasi-rectangular shapes, indicating a typical electrochemical double-layer capacitor characteristic [34]. Meanwhile, there is no obvious distortion in the CV curves of NSHPC even at an extremely high scan rate up to 500 mV s−1, suggesting a satisfactory rate performance. In comparison, distinguishable distortions are observed in the CV curves of SHPC (Fig. 5c) at high scan rates, due to the unresponsive diffusion of electrolyte ion into the interlayer micropores when the scan rate is too high [35, 36]. The excellent rate performance of NSHPC can be attributed to the improved electric conductivity by the graphitic-N in the carbon skeletons, as well as enhanced wettability by the high heteroatom doping [37]. In addition, the NSHPC electrode exhibited a much larger response current than that of SHPC electrode at the same scan rate of 20 mV s−1 (Fig. 5e), representing a higher specific capacitance of NSHPC than SHPC. It’s worth noting that a developed hump rises at around 0–0.4 V in the roughly rectangular-shaped CV curve of NSHPC, indicating the co-existence of pseudocapacitance in addition to the main nature of EDLC [18, 38], and the pseudocapacitance effects of the N and S doping groups can be described by the following equations [9]:

figure a

The specific capacitances of NSHPC and SHPC electrodes (Cs, F g−1) were calculated by using the following equation [39]:

$$C_{{\text{S}}} = \frac{{{\text{I}}dV}}{{mv\Delta V}}$$

where I is the voltammetry current (A), m is the mass of active materials in the electrode (g), v is the scan rate (V s−1), and ∆V is the potential windows (V), respectively. NSHPC presents a high specific capacitance of 277 F g−1 at 25 mV s−1, and still retains 170 F g−1 at 500 mV s−1, which are much higher than that of SHPC (163 F g−1 at 25 mV s−1 and 106 F g−1 at 500 mV s−1), as well as some heteroatom-doped porous carbons, such as N/S co-doped graphene (228 F g−1 at 10 mV s−1) [15] and S-doped mesoporous carbon fiber (221 F g−1 at 10 mV s−1) [40].

The GCD measurements were also carried out to evaluate the capacitive performances of the samples. Figure 5b and d shows the GCD curves of NSHPC and SHPC at various current densities, respectively, the nearly isosceles triangles indicate typical double-layer capacitances, and no distinct potential drops can be observed in the beginning of discharge curves due to the excellent electric conductivity of the electrodes, which are in good agreement with the results of CV curves. The Cs can also be calculated by the following equation [41]:

$$C_{{\text{S}}} = \frac{{I\Delta t}}{{m\Delta V}}$$

where I, ∆t, m, and ∆V represent the discharge current (A), discharge time (s), mass of active material (g), and potential change (V), respectively. The specific capacitance of NSHPC reaches 194 F g−1 at 1 A g− 1, much larger than 119 F g−1 for SHPC. Even though increasing the current density to 50 A g−1, NSHPC still maintains a high specific capacitance of 95 F g−1, with 48.9% retention of its initial capacitance (Fig. 5f). The high capacitance and excellent rate ability of NSHPC can be attributed to the large surface area, optimized pore size distribution, and high heteroatomic doping, which enhanced the utilization ratio of active material, and promoted electron conduction as well as ion diffusion within the electrode during the electrochemical process [42]. Notably, the capacitive performance of NSHPC is also superior or comparable to some other heteroatom-doped porous carbons, such as porous graphitic biomass carbon (PGBC) [3], nitrogen-doped porous carbon nanofibers (N-CNFs) [43], and heteroatom-doped porous carbon from urine (URC) [44], as shown in Fig. 5f.

Fig. 5
figure 5

CV curves of a NSHPC and c SHPC electrodes at various scan rates ranging from 25 to 500 mV s−1, GCD curves of b NSHPC and d SHPC electrodes at different current densities ranging from 1 to 50 A g−1, e CV curves at a scan rate of 20 mV s−1 and f specific capacitances of NSHPC and SHPC electrodes

The capacitive behaviors of these samples were further studied by EIS analysis, and the Nyquist plots of NSHPC and SHPC electrodes are shown in Fig. 6a. Both of the plots contain a quasi-semicircle arc at high-frequency region, a ~ 45° diagonal (Warburg line) at the middle-frequency region, and a quasi-perpendicular at low-frequency region, demonstrating an ideal capacitive behavior [15]. Generally, the intercept at Z’ in the high-frequency region is related to the series resistance (RS) including the electrolyte resistance, electrode resistance, as well as the contact resistance. Meanwhile, the diameter of the semicircle represents the charge transfer resistance (RCT) corresponding to the interfacial charge transfer between the electrode and the electrolyte. The Nyquist plots were fitted with the equivalent circuit model inset of Fig. 6a [45], and the acquired RS of the NSHPC electrode (0.76 Ω) is slightly lower than that of SHPC (1.0 Ω), indicating an enhanced electronic conductivity of NSHPC as a result of graphitic N-doping and low defects/disorders in the carbon framework. Meanwhile, the RCT of NSHPC (0.82 Ω) is also lower than that of SHPC (2.2 Ω), suggesting an enhanced charge transfer ability owing to the incorporation of high-content nitrogen, which facilitates the wettability and ion transport within the NSHPC electrode. In addition, the NSHPC electrode also showed a shorter Warburg line than that of SHPC, indicating a faster ion diffusion and lower frequency dependence in the porous electrode [36]. These observations suggest that the NSHPC electrode exhibits fast electron conduction and ion diffusion, which are favorable for achieving high rate performance of supercapacitor, in good agreement with the above CV and GCD results.

To investigate the cycling stability of the materials, GCD cycling has been carried out at the current density of 10 A g− 1. As shown in Fig. 6b, the capacitances of NSHPC and SHPC electrodes decreased slightly during the cycling process, due to the gradual decomposition of unstable N- and S-containing groups (e.g., pyridinic groups and sulfoacid groups) in the carbon skeletons and hence the partial loss of pseudocapacitance [28]. Nevertheless, the NSHPC and SHPC electrodes still maintained 87.4% and 94.3% of the initial capacitance over 5000 cycles, respectively, indicating their good cycling stabilities.

Fig. 6
figure 6

a Nyquist plots and b cycle-life of NSHPC and SHPC electrodes

4 Conclusion

N/S co-doped hierarchically porous carbons were synthesized by a molten-salt templated method, the as-prepared sample exhibited a high specific capacitance (277 F g−1 at 25 mV s−1), good rate capability (with 48.9% capacitance retention when the current density enhanced 50 times), and excellent cycling stability (remains 87.4% of the initial capacitance after 5000 charge/discharge cycles). The excellent electrochemical performances can be attributed to the large specific surface area, hierarchical porous structure, high doping content of N/S heteroatoms, as well as the synergies of these factors. This work provides a facial, highly efficient, and low-cost method for preparation of heteroatom-doped porous carbon with hierarchically porous structure, which implies promising applications in high-performance supercapacitors and other energy storage devices.