1 Introduction

Conducting polymers (CPs) are polymers having highly conjugated polymeric chains with properties such as electrical, magnetic, and optical properties like metallic regime. They are the materials that have attracted attention of many researchers in the field of energy storage [1], catalyst [2], sensors [3], membranes [4], corrosion protection [5,6,7], giant magnetoresistance [8], etc. owing to their unique and adjustable properties. They have semiconducting characteristics that can be tuned by the process called “doping.” Doping involves oxidizing or reducing the conducting polymers that increases the charge carriers in the polymer; thus, its electrical property is modified. Many conducting polymers, such as polypyrrole (PPy) [9], polyaniline (PANI) [10], and poly(3,4-ethylenedioxythiophene) (PEDOT) [11], have been studied for their outstanding electrochemical performances. Among them, PANI has attracted extensive attention than other conducting polymers due to its highly adjustable electronic and electrochemical properties, ease of synthesis, environmental friendliness, low toxicity, and cost [12, 13], as well as good redox reversibility [14]. Although PANI has been considered as one of the most promising conducting polymers, the poor solubility and difficulty to process PANI remain a major challenge for mass-production. In this study, ionic liquids are used for the synthesis of PANI, in order to improve its solubility.

Ionic liquids (ILs) are the organic salts with low melting point (below room temperature). They have been extensively studied due to their low volatility, good thermal stability at elevated temperature, ionic conductivity, and controlled hydrophilicity [15]. Ionic liquids are becoming more popular in the field of electrochemistry as it provides excellent electrochemical stability over wide range of potential due to absence of water [16,17,18,19,20]. They have been used in various applications, such as the extraction of common organic compounds [21], increasing the solubility of organic compounds [22], as well as applied as electrolytes in electropolymerization [23]. The use of ionic liquids has been reported for variety of electrochemical devices [24,25,26]; however, their investigation in electrochemical synthesis of conducting polymer is limited. Ionic liquids facilitate in enhancing the conductivity and solubility of conducting polymer by forming hydrogen bond with the polymer chains [27, 28]. However, aprotic ionic liquid is a poor medium for the electropolymerization of aniline, as compared with the aqueous solution system [29]; so we select 1-methylimidazole ([Hmim]) as a starting material to synthesize ionic liquid with high proton activity [30].

In this work, we synthesized two new type of ionic liquids using ([Hmim]) [31] as a starting material which can be used as doping agent and in situ oxidizing agent in the polymerization of aniline, respectively. Two ionic liquids, [Hmim]HSO4 and [C4mim]2S2O8, were synthesized and used as dopant and initiator, respectively, regulating the nanofiber structure of PANI. The mechanism follows the interactions of the hydrogen and nitrogen atoms in ionic liquid and the imine structures in PANI chains, which form hydrogen bonds. The addition of the ionic liquid to conducting polymers, not only enhances the ionic transport properties, but also retains the high electronic mobility in the conductive polymers. The chemical structure of PANI was characterized by Fourier transform infrared spectrometer (FTIR) and ultraviolet spectrometer (UV–Vis). The morphology of PANI fibers formed was confirmed by scanning electron microscopy (SEM) and X-ray diffraction (XRD). The electrochemical properties of ionic liquid polyaniline (IL-PANI) electrodes were investigated by electrochemical impedance spectroscopy (EIS), cyclic voltammetry (CV), and galvanostatic charge–discharge (GCD). IL-PANI showed excellent rate capability and cyclability with specific capacitance as high as 489 F g−1. The results showed that the mixing characteristics of ions and electrons in PANI and ionic liquid enhance the electrochemical performance of the electrode and also improve the solubility and processability of PANI; therefore, the nanoporous PANI film with good performances is obtained facilely due to the high proton activity of [Hmim]HSO4.

2 Experimental

2.1 Materials

Aniline, 1-methylimidazole, and 1-chlorobutane were purchased from BEHRINGER Technology Company. Ammonium persulfate (APS), potassium persulfate (KPS), hydrochloric acid (HCl), and sulfuric acid (H2SO4) were purchased from Tianjin Fuchen Chemical Reagent Factory. Polyvinylidene difluoride (PVDF) and 1-methyl-2-pyrrolidinone (NMP) were purchased from Aladdin Company (Shanghai, China).

2.2 Preparation of IL-PANI

Firstly, 1-methylimidazole sulfate ([Hmim]HSO4) (in Appendix Reference 1) was formulated into a solution with a concentration of 1 M. Then, 0.0015 mol of aniline was completely dissolved in 5 ml of 1 M [Hmim]HSO4, and 0.0005 mol of [C4mim]2S2O8 (in Appendix Reference 2) was mixed into the previous solution at room temperature. After stirring for 10 min, the solution was changed from colorless to dark green obtaining a PANI solution, and the product was dialyzed and freeze-dried to obtain a dark green powder. For comparison, the other parallel tests were performed in the same initiator [C4mim]2S2O8 using different dopants (HCl and H2SO4) to synthesize HCl–PANI and H2SO4–PANI. After that, the products were purified by dialysis (dialysis tube, 1000 MW cutoff, Fisher Scientific) for 2 days. Finally, the products were dried for 48 h by a freeze dryer.

2.3 Characterization

Vector22 FTIR spectrometer was used to measure the infrared spectra of PANI active materials in the range of 400–4000 cm−1 with KBr pellets. A nuclear magnetic resonance (NMR) spectrometer (Bruker, AVANCE III 600 MHz) was used to characterize the chemical structure of ionic liquids at room temperature. The change in absorption wavelength of different PANI samples was tested by ultraviolet spectrometer (UV-3600). The size and morphology of PANI samples were inspected using cold field emission scanning electron microscope (JSM-7500 F). The crystal structure and size of PANI were characterized by X-ray diffraction (Bruker D8 ADVANCE) with Cu Kα radiation (λ = 0.15405 nm).

All electrochemical studies were conducted by an electrochemical analyzer (IVIUM Vertex) at room temperature. For evaluating the electrochemical behavior of the individual electrode in a three-electrode configuration, 1 M HmimHSO4, 1 M H2SO4, and 1 M HCl aqueous solutions were used as electrolytes with a saturated calomel electrode (SCE) and a Pt wire employed as the reference and counter electrode, respectively. In order to make the PANI-C-clothes (PANI-CC) electrode, we mixed thoroughly the PANI active materials, PVDF and super P at a weight ratio of 8:1:1 in NMP, and the obtained slurry was uniformly supported on a carbon cloth by blade coating. Finally, the electrodes were vacuum dried at 60 °C in an oven for 24 h to ensure complete evaporation of the NMP solvent. The loading mass of active materials was controlled at 1–3 mg cm−2.

3 Results and discussion

3.1 Structure and morphology

The synthesis mechanism of the ionic liquid polyaniline (IL-PANI) sample is illustrated in Fig. 1. As described in Fig. 1, highly soluble [Hmim]HSO4 and [C4mim]2S2O8 were used for synthesizing IL-PANI. The high solubility is mainly because (1) [Hmim]HSO4 forms hydrogen bond with PANI and (2) [Hmim]HSO4 and [C4mim]2S2O8 have similar imidazolium ions, which interact with imine nitrogen in PANI, resulting electron rearrangement in the polymer chain [32]. Because of above reasons IL-PANI has high solubility, for example, 25 mg of IL-PANI can be fully dissolved in 1 mL DMSO. It should be mentioned that the role of imidazolium ions in the synthesis of ionic polyaniline is mainly due to the unique structure of [Hmim]HSO4; it has the properties of both Bronsted and Lewis acid in the form of imidazolium ions and hydrogen ions, respectively [33]; therefore, the formation mechanism of IL-PANI utilizes a single hydrogen ion to react with PANI through a nitrogen group when protonated, as well as the use of its own imidazolium ion forms an interaction with the nitrogen atom in the imine group, resulting in electron rearrangement in the PANI chain. Certainly, the characteristics of the ionic liquid itself cannot be ignored, and hydrogen bonding with PANI acts as a cross-linked agent, which is more advantageous for the formation of a cross-linked porous structure.

Fig. 1
figure 1

Reaction mechanism of IL-PANI formation

In the present investigation, the acidic ionic liquid [Hmim]HSO4 was used as a dopant and the oxidized ionic liquid [C4mim]2S2O8 as an oxidizing agent [34, 35]. This is because [C4mim]2S2O8 (comparing to ammonium persulfate, [NH4]2S2O8) slows down the reaction, which can control the size and morphology of nanoparticles. This is due to its high solubility in water, and the formed IL-PANI chain has a small surface tension which is difficult to break down, and the phenomenon of agglomeration in water is not obvious. Additionally, the imidazolium ions present in the oxidized ionic liquids cater to the formation mechanism of PANI.

The chemical structure of as produced IL-PANI was analyzed by FTIR and UV–vis spectroscopy and was observed to be similar to that of other acid-doped PANI. The FTIR spectra of [Hmim]HSO4-doped PANI indicate that it is emeraldine salt of PANI corroborated by two characteristic peaks located at 1577 and 1498 cm−1, corresponding to the stretching vibration of the quinoid ring and benzenoid ring (Fig. 2b), respectively [36, 37]. Compared to the 1570 and 1480 cm−1 of the pure PANI in Fig. 2a, a certain chemical shift to the right occurs for IL-PANI. Additionally, compared to 1592 and 1542 cm−1 in [Hmim]HSO4 (Fig. 2c), chemical left shift occurs for IL-PANI. This explains the formation of the benzene ring, and the anthracene ring in the IL-PANI is affected by the imidazolium ion. The state of IL-PANI products indicates emeraldine rather than solely leucoemeraldine or pernigraniline. The UV–Vis spectrum (Appendix Fig. 2a) of IL-PANI shows two characteristic bands of 365 nm and 650 nm consistent with the emeraldine salt [38].

Fig. 2
figure 2

FTIR of spectroscopy: (a) Pure PANI, (b) IL-PANI, and (c) [Hmim]HSO4

Figure 3 and 4 show the SEM images of different PANI samples. Figure 3a shows the nanorod-like structure of the pure PANI. Figures 3 and 4 indicate that different PANI nanostructures and their aspect ratio of produced nanofibers were affected by doping acid used ([Hmim]HSO4, HCl, H2SO4, respectively) [39]. The main difference is between Bronsted acid and Lewis acid, especially the interaction between the imidazolium ion and the hydrogen ion. This creates an electron rearrangement, and a hydrogen ion forms a hydrogen bond with PANI chains. Additionally, the molar amount of functional oxidized ionic liquid, type of oxidants, metal cations, and imidazolium ions influences the size of PANI fibers that results in different spatial morphologies. As a result, coral-like fibers with a uniform diameter of 10–50 nm were formed as shown in Fig. 4b [40].

Fig. 3
figure 3

SEM images of pure PANI and different acid-doped PANI samples: the scale bar of a, b, and c is 5 nm and d is 3.5 nm. a Pure PANI. b HCl–PANI. c H2SO4–PANI. d IL-PANI

Fig. 4
figure 4

IL-PANI synthesized using different molar ratios of aniline and oxidant: the scale bar of a and c is 5 nm and b is 3.5 nm. a IL-PANI-1-0.5. b IL-PANI-1-0.34. c IL-PANI-1-0.25

The facile synthesis route of our IL-PANI provides a detailed method for synthesizing porous fibers. The resulting nanostructure is more effective than electrochemical sensing device as it provides large effective surface areas due to its porosity. Besides, the interconnected network provides accessible channel for easy transport of electron and ions. This is the result of electron rearrangement in PANI chain during synthesis process. Moreover, the interaction between ionic liquid and PANI results in hydrogen bond that acts as a cross-linking agent, which virtually reduces the dissociation in ionic liquids by reducing the inter-layer spacing between PANI chains. This decreases the path for ion and electron to transport and thus increases the conductivity.

The crystalline patterns of different PANI samples were shown in XRD spectra in Fig. 5. Three distinct diffraction features characteristic of PANI chains were three broad peaks with max at 14.9°, 20.5°, and 25.3°. The peaks at 14.9° and 25.3° are attributed to the periodicity, both perpendicular and parallel to the polymer chain, respectively [41, 42], whereas peak at 20.3° is caused by the spacing of the polymer chain layers at alternating distances. Most importantly, the emeraldine group of pure PANI has (Appendix Fig. 4b) almost no peak at 25.3°, while the peak intensity of doped PANI gradually increases with the degree of protonation of the imine nitrogen. From the three typical characteristic peaks of PANI, at 25.3° (Fig. 5a), the peak intensity of IL-PANI is stronger than those of the others. The reason is that, the high proton activity of imidazolium ions is more prone to protonation of imines, resulting in electron rearrangement of PANI chains, producing emeraldine salts. Additionally, the surface tensions of the ionic liquid and PANI are small; the obtained nanostructures have a small agglomeration that results in more of the one-dimensional nanofibers. Therefore, PANI shows a strong crystal phase structure. Figure 5b shows diffraction XRD pattern of IL-PANI synthesized by varying molar ratios of aniline to oxidant ionic liquid. In Appendix Fig. 4a, the type of oxidizing agent is inconsistent, but since the aniline is an alkaline reactant, the characteristic peak of obtained XRD is consistent with Fig. 5a. By analyzing the structural formula of the oxidant, the change in peak intensity is mainly caused by the molar amount of the imidazolium ion and the electron rearrangement of the PANI chain due to the presence of imidazole heterocycle. Of course, it is proved that the surface tension of the functional ionic liquid is small, and the crystallization rate of the polymer is increased. In Fig. 5, in addition to the three characteristic peaks of PANI, there is small peak 8.9°, which may originate from some restacking of sheets during the mixing and polymerization process [43]. The average restacking degree or stacked thickness could be estimated as 14.3 nm using Scherrer equation. This thickness corresponds to restacking limited to several floors. This is due to the decrease in PANI chains and increase in mobility. Compared to the stack heights (20.17 nm and 19.7 nm) caused by the other two doping acids (Fig. 5a), the stack in the IL-PANI is only 14.9 nm. It is well known that co-facially stacked conjugated backbones (the π–π stacking distance) greatly influence electron orbital overlap that results in change in the conductivity [44]. These results indicate that the ordered structure in the PANI chain increases with the increase in aspect ratio of the nanofibers. This indicates that better structural ordering leads to an increase in charge carrier transport efficiency by effectively extending the conjugation length.

Fig. 5
figure 5

XRD diffraction pattern of a PANI synthesized using different doping acids and b IL-PANI synthesized using different molar ratios of aniline and oxidant

3.2 Electrochemical property

PANI has its inherent morphology and its electrochemical properties are greatly affected by the doping and oxidation levels. In order to study the electrochemical performance of IL-PANI, we performed several experiments. The experiments involved to study the effect of different doping acids on electrochemical performance of PANI. Further, performance of produced IL-PANI with molar ratio was investigated. The three-electrode system was used for electrochemical impedance spectroscopy (EIS), cyclic voltammetry (CV), and galvanostatic charge–discharge (GCD) measurements.

Figure 6 shows impedance spectra of IL-PANI electrodes in 1 M H2SO4 and 1 M [Hmim]HSO4. The equivalent series resistances in high-frequency region are estimated to be as low as 0.7 Ohms in both the electrolytes. Both systems have lower slope of the curve obtained at low frequencies, indicating ideal capacitive behavior of IL-PANI. The higher the degree of protonation of the imine, the greater the intensity of the emeraldine is, and the higher the conductivity. This is related to the increase of the ordered structure in the PANI chain, effectively extending the conjugate length and improving the transport efficiency of the charge carriers. In Fig. 6b, the line with slope 45° resulted from diffusion indicates good diffusion of ion in the polymer when ionic liquids are used as electrolyte.

Fig. 6
figure 6

Impedance spectra of IL-PANI a using H2SO4 as electrolyte and b using [Hmim]HSO4 as electrolyte

Since the surface tension of the imidazolium ion in ionic liquid is less than the hydrogen ion in sulfuric acid, the effect on the transport of ions and electrons in PANI is negligible during the test. Among them, [Hmim]HSO4 was used as the electrolyte. Figure 7 shows the cyclic voltammetry curves of PANI synthesized using different doping acids and IL-PANI synthesized with different molar ratios of aniline to oxidant.

Fig. 7
figure 7

Cyclic voltammograms of PANI a doped with different doping acids and b IL-PANI were synthesized with different molar ratios, at scan rate of 200 mV s−1

As shown in Figs. 7 and 8, all PANI samples have similar voltammogram with three distinct redox peaks related to different oxidation states of the polymer. This indicates pseudocapacitive behavior of PANI when compared to carbon cloth which showed typical double layer capacitive curve (no redox peaks) [45]. In Fig. 8a, the first redox pair (a–a’) at 0.28 V is attributed to the transformation of leucoemeraldine to emeraldine PANI; this peak position varies with different doping acid being used. The second pair of redox (b–b’) represents PANI degradation into benzoquinone and aminoquinone couple that can be seen at 0.43 V. The last redox pair can be seen at 0.52 V that was attributed to transition of emeraldine salt to pernigraniline salt [46, 47]. Furthermore, PANI nanomaterial has a wider operating potential range of 1.1 V when compared to bulk PANI [48]. It is believed that the electrochemical capacitance is proportional to the area under the CV curve. From Fig. 7a, we can see that the area under the CV curve of IL-PANI is much larger than other doping acid-doped PANI. Additionally, from Fig. 7b, it was found that when molar ratio of 1:0.34 (IL:PANI) was used it exhibited largest capacitive area. The above results indicate that the main capacitive behavior of the PANI is related to the type of doping acid and molar ratio of the functional oxidizing agent ionic liquid used. The IL-PANI showed best capacitive behavior because surface tension of the ionic liquid is small and the produced PANI is highly soluble in water. It is not easy to agglomerate in water; mostly, the formation of a one-dimensional nanofiber structure increases the aspect ratio of the nanofibers, which is consistent with the nanofiber structure obtained in Figs. 3 and 4. The main purpose of adopting the functional oxidized ionic liquid is to control the reaction rate and increase the crystallinity of the structure, which is consistent with the crystal phase structure obtained in Fig. 4b.

Fig. 8
figure 8

Cyclic voltammograms of a PANI-doped different doping acids at a scan rate of 10 mV s−1 and b IL-PANI-1-0.34 at different scan rates

Figure 8b shows the CV curves of IL-PANI-1-0.34 with varying scan rates. The electrodes are stable in [Hmim]HSO4 aqueous solution within the employed potential range (− 0.2 to 0.9 V), and the peaks from Faradic current (current from redox reaction of electrodes, normally accompanied with peaks on both oxidation and reduction curves) were observed. The plots of current density versus the different scan rates for the highest oxidation peaks are given in the inset of Fig. 8b. It is shown that the oxidation and reduction peak currents increase linearly with scan rates, which mean that transport of ions in electrode is mainly due to the redox process occurring at the electrode surface. This indicates that redox process was found to be confined to the electrode surface, which is due to the small dimensions of the polymeric nanostructure. However, Fig. 7 illustrates that the redox reaction occurs in the electrode because of the hydrophilicity of the ionic liquid, which reduces the self-aggregation of the nanofibers and allows the electrolyte ions to diffuse into the electrode material.

Figure 9 shows the galvanostatic discharge curves of PANI formed using different doping acids and of IL-PANI. Their specific capacitance (Cs) can be measured by using Eq. (1) [49]:

$$ {C}_S=\frac{I\cdot \varDelta t}{m\cdot \varDelta V} $$
(1)

where Cs is the specific capacitance (in F g−1), I is the charge–discharge current (in A), Δt is the discharge time (in sec), ΔV is potential drop during discharge (in V), and m is the mass of active material (in g).

Fig. 9
figure 9

a Discharge time of PANI with different dopants at current density of 0.5 A g−1. b Discharge time of IL-PANI with different ratios of IL:PANI. c Rate performance of different acids as dopants. d Rate performance of IL-PANI with different portions of IL

The specific capacitances of the different PANI samples at a current density of 0.5 A g−1 are shown in the inset of Fig. 9a and b. The specific capacitance of IL-PANI-1-0.34 was calculated as high as 489 F g−1 at 0.5 A g−1 (specific capacitance measured at the electrochemical window of 0.1–0.8 V is 530 F g−1). The specific capacitances of HCl–PANI and H2SO4–PANI in Fig. 9a are 174 F g−1 and 201 F g−1, respectively. While the specific capacitances of IL-PANI-1-0.5 and IL-PANI-1-0.25 in Fig. 9b are 239 F g−1 and 404 F g−1, respectively. The ionic liquid in IL-PANI has good compatibility with water, reduces the agglomeration of nanoparticles, and the effective control of the functional oxidized ionic liquid on the morphology which is beneficial to the ordered nanostructure of IL-PANI, which enhances the transport of electrons and ions.

Specific capacitances of the electrodes at different current densities are illustrated in Fig. 9c and d, which clearly showed that IL-PANI has a higher discharge capacity than HCl–PANI and H2SO4–PANI. Notably, IL-PANI displayed excellent cyclability at various current densities. This indicates that electrode possesses a relatively higher energy and power density. However, the specific capacitance decreases with the increase in charge–discharge current density, which is attributed to the fact that the redox reaction rate and the charge diffusion cannot match the rapid increase of the current densities [48].

Energy density (Es) and power density (Ps) of the electrodes can be calculated using Eqs. (2) and (3) [50,51,52,53]:

$$ {E}_S=\frac{C_S\cdot \varDelta {V}^2}{2\times 3.6} $$
(2)
$$ {P}_S=\frac{E_S\times 3600}{\varDelta t} $$
(3)

where Cs is the specific capacitance calculated from charge–discharge curve in Farad per gram, ΔV is the potential drop during discharge in volts, Es is the energy of the electrode in watt-hour per kilogram, Δt is the discharge time in seconds, and Ps is the power of the electrode in watts per kilogram. The Es as a function of Ps and current density is shown in Fig. 10. As shown in Fig. 10b, the Es of IL-PANI-1-0.34 is significantly higher than that of other PANI samples, which is mainly attributed to the better aspect ratio of nanofiber structure of IL-PANI-1-0.34, which allows ions and electrons to diffuse better; besides, the thinner IL-PANI nanofibers provide a shorter diffusion path for electron transport. Thus, compared to IL-PANI-1-0.25 and IL-PANI-1-0.50, IL-PANI-1-0.34 exhibits the best electrochemical properties. The possible reasons are (i) the cation in the initiator is imidazolium ion, which has high proton activity; (ii) more initiator (in IL-PANI-0.34 compared to IL-PANI-1-0.25) enhances the induction of PANI to more regulated microstructures (the fiber structure); and (iii) more initiator led to relatively lower molecular weight of polymer, which was in favor of the arrangement of chains to fiber structure. But for the sample IL-PANI-1-0.50, too much initiators can significantly reduce molecular weight of PANI and further interfere with the formation of nanofibers. More importantly, the IL-PANI-1-0.34/carbon cloth electrode demonstrated much higher-energy density at a similar level Ps than the other PANI samples. Based on the experimental results, ionic liquids have greatly improved the regulation of PANI nanostructures and the electrochemical performance as well. Figure 11 shows the stability of the IL-PANI-1-0.34 electrode at a current density of 2 A g−1 in [Hmim]HSO4 and HCl, respectively. The cycling stability is very good in [Hmim]HSO4 electrolyte, with a capacitance retention of 93% at 2000 cycles and 81% at 4000 cycles. The initial decreased in capacitance is mainly due to the fact that the degree of peroxide of the fiber structure is insufficient, so that partial redox can only occur on the surface of the electrode and cannot diffuse into the electrode material. Then, in order to verify the stability of the IL-PANI in HCl, we measured 50 cycles, and the rate of decrease in capacitance was significantly higher than in the electrolyte of [Hmim]HSO4. This fast decrease can be attributed to the fact that chloride ions attack the quinoid ring in PANI, while hydrogen bonding between ionic liquid dopants with PANI served as a protective film for IL-PANI.

Fig. 10
figure 10

Electrochemical performance of IL-PANI. a Diagram of energy density and power density of IL-PANI, HCl–PANI, and H2SO4–PANI. b The relationship between energy density and power density of IL-PANI with different proportions of aniline and oxidant. c Energy density of PANI with different acid doping. d Energy density curves for the synthesis of IL-PANI in varying molar ratio of aniline and oxidant

Fig. 11
figure 11

Constant current charge and discharge test of IL-PANI-1-0.34 using a HmimmHSO4 and b HCl as electrolyte

4 Conclusion

In this study, we successfully synthesized IL-PANI by in situ polymerization. The introduction of ionic liquid resolved the following issue: (i) improved the solubility of PANI assisted by the polarity of the ionic liquid, (ii) the use of functional oxidizing ionic liquids improved the nanofiber formation of PANI and controlled the reaction rate, and (iii) enhanced the electrochemical performance (energy and power densities, cycling stability) of the ionic liquid–doped PANI.