Introduction

In recent decades, conducting polymers have garnered significant interest [1], owing to their diverse applications ranging from clinical diagnostics [2] to fuel cells and energy devices [3]. Particularly notable are their promising roles in biosensor development [4, 5], leveraging a myriad of advantageous properties that amalgamate the characteristics of organic polymers with the electronic attributes of semiconductors. The distinct electronic conductivity of these polymers stems from the presence of alternating single and double bonds within their chemical structures, facilitating π electron delocalization and resonant behavior [6] to which is added a good stability to environmental factors similar to that of metal-based systems [7,8,9,10,11,12].

Since their initial discovery in 1977 [13], numerous conducting polymers have been identified, including the widely studied polyacetylene (PAc), polypyrrole (PPy), polythiophenes (PTh), and polyaniline (PANI). Among these, PANI stands out for its exceptional environmental stability, facile doping-dedoping capabilities, and high electroactivity, all of which arise from the oxidation and protonation of its chemical structure. Notably, PANI exhibits various oxidation states, with emeraldine salt being the sole conductive state. Despite its cost-effectiveness, PANI grapples with a notable hurdle in terms of processability, attributed to the inherent poor solubility of polyaniline owing to its rigid backbone [14]. To enhance its processability, diverse approaches have been explored, with two notable strategies being chemical modification, such as doped PANI, and the development of substituted derivatives of PANI. Consequently, substantial endeavors are underway to explore alternative synthesis methodologies [15,16,17].

Several researchers [18,19,20,21] have explored the electrochemical synthesis of PANI layers on electrode surfaces. Integration of PANI onto electrodes, alone [18, 20, 21] or in combination with other materials [22,23,24,25], offers numerous advantages for electrochemical applications. Firstly, it enhances the conductivity of the electrode system, facilitating efficient electron transfer processes due to PANI’s inherent redox activity. Consequently, functionalized electrodes demonstrate improved sensitivity and response times, enabling precise analyte detection and quantification [14, 26, 27].

Moreover, PANI contributes to the formation of robust and stable films on electrode surfaces, acting as protective layers against chemical degradation and mechanical stress. This enhances the stability and reliability of functionalized electrodes, critical for long-term electrochemical measurements and device operation [28, 29].

However, PANI’s properties such as conductivity, electrochemical activity, stability and morfology can vary dramatically on the basis of the synthesis conditions [30,31,32]. While this versatility is advantageous, optimizing the synthesis procedure and monitoring resulting material properties are necessary to achieve desired characteristics.

Electropolymerization offers a versatile approach for synthesizing polymer films directly on electrode surfaces [33,34,35], allowing adjustment of their features by simply manipulating parameters of the electrochemical techniques used for polymer synthesis. Among these, cyclic voltammetry [31, 34, 36] is widely employed due to its ease of application and possibility to control experimental conditions such as scan rate, number of cycles, applied potential, and thus circulating charge density, enabling modulation of thickness, density, molecular weight, and morphological characteristics of the final polymer [37]. Additionally, electrosynthesis offers remarkable versatility, allowing functionalization of variously shaped electrodes, including micro-structured ones [38,39,40,41,42].

Computational chemistry (CC) plays a pivotal role in monitoring/describing material properties, through diverse methodologies such as electronic structure calculations, molecular dynamics simulations, and structural optimization [43, 44]. By correlating molecular descriptors with experimental data, computational models prognosticate key properties encompassing conductivity, mechanical behavior and stability. An exemplary technique is the Extended Hückel Method (EHM) [45, 46], a quantum chemical approach employed to predict molecular orbital energies and electron densities, shedding light on bonding patterns and aromaticity and then material properties. In the same way, energy refinement methods like Molecular Mechanics 2 (MM2) and Assisted Model Building and Energy Refinement (AMBER) leverage classical and quantum mechanics to simulate molecular systems comprehensively [47]. MM2 calculates molecular energies, encompassing interatomic interactions, bond stretching, bending, and torsion, facilitating the study of molecular conformations and dynamics. Conversely, AMBER combines classical and quantum mechanical approaches to model the molecular systems, thereby enabling the analysis of physical and mechanical properties along with conformational changes. These computational tools significantly enhance the comprehension of material structure–property relationships, thereby guiding the design and optimization of materials. All this information can be extrapolated without further experimental activity, apart from material synthesis, by leveraging available data.

Here, we present a simple and rapid electrosynthesis protocol to obtain PANI films on inexpensive pencil graphite electrode (PGE) surfaces. Indeed, among carbon-based electrodes, PGEs stand out for their low cost and ready availability [48, 49], making them particularly suitable for the development of disposable sensing systems. Moreover, PGEs overcome the challenges associated with renewing the surface of reusable electrodes like glassy carbon electrodes (GCEs), simplifying the experimental setup. We investigated the physicochemical aspects of aniline polymerization through electrochemical, spectroscopic, and computational approaches. Utilizing computational chemistry, we gained insights into PANI’s electronic structure, molecular dynamics, mechanical behavior, and stability. Raman spectroscopy and electrochemical characterization of PANI films confirmed what was deduced through computational models.

As a proof of concept, a PANI-based molecularly imprinted polymer for chloramphenicol (CAP) has been developed on PGEs. CAP is a broad-spectrum antibiotic used to treat various bacterial infections by inhibiting protein synthesis in bacteria. It is effective against both Gram-positive and Gram-negative bacteria, making it valuable in treating respiratory tract infections, skin infections, and meningitis [50]. However, its use is associated with potential side effects such as bone marrow suppression and the development of bacterial resistance [50]. For these reasons, chloramphenicol monitoring is crucial. Here, PANI-based molecularly imprinted polymers (MIPs) were directly integrated on PGEs surface by electro-deposition. MIPs are synthetic materials with recognition capabilities similar to those of natural recognition systems [33,34,35, 37, 51]. In contrast to the latter, MIPs are stable to adverse conditions and over time, are low cost, and easy to synthesize [37, 52]. The proposed MIP-based sensor allows for the determination of CAP in aqueous solutions within a concentration range between 0.15 and 17.5 nM, showcasing its potential application in real-world contexts. All the obtained results suggest huge potential PANI application, even in low-resource settings, including biosensor development.

Materials and methods

Chemicals

All the reagents were of analytical grade and used as received. The reagents used included potassium hexacyanoferrate (III), K3[Fe(CN)6], potassium hexacyanoferrate (II) K4[Fe(CN)6], potassium chloride, KCl, potassium hydroxide, NaOH, sodium chloride, NaCl, monosodium phosphate (MSP), NaH2PO4, and disodium phosphate (DSP), Na2HPO4, were provided from Honeywell Fluka (College Park, GA, USA). Aniline, ≥ 99.0%, and chloramphenicol, ≥ 98.0%, were provided by Sigma-Aldrich (St. Louis, MO, USA).

All solutions were prepared in ultra-pure water (conductivity ≤ 0.1 μScm−1) (Millipore S. A., Molsheim, France).

PANI electrosynthesis and electrochemical measurements

In this work aniline was used as functional monomer. The electro-polymerization procedures were performed in potentiodynamic conditions using monomer solution (0.15 M) prepared in 0.5 mol l−1 H2SO4.

The electro-deposition was performed using a portable potentiostat/galvanostat, PalmSens, EmStat4 Blue model. The software was PSTrace version 5.8 (PalmSens, Houten, Netherlands). The electrochemical cell consisted of a saturated calomel reference electrode (SCE), a counter platinum electrode and a Ø = 2 mm pencil graphite electrode of hardness HB. The reference and counter electrodes were purchased from CH Instruments (Tennison Hill Drive, AU, USA), and the working electrode underwent thorough cleaning with 0.5 µm alumina before each analysis, being blank assays performed in PBS solution pH 7.4 to check adequate cleaning. Alternatively, PANI-film were obtained on glassy carbon slide (1.5 cm × 0.5 cm), using same experimental conditions for polymer characterization by Raman spectroscopy. All electrochemical experiments were performed without deaeration. Furthermore, a potassium ferrocyanide solution at 5 mM was prepared in 50 mM PBS at pH 7.4 containing 0.1 mol l−1 of KCl and used as a redox probe to monitor changes in permeability toward surface electrode.

Cyclic voltammetry (CV) was used for potentiodynamic PANI electrosynthesis and was performed at 20 mV s−1 for five consecutive cycles in the electric potential interval of − 0.2 to + 1.2 V in 0.15 M aniline solution, which was prepared in 0.5 M H2SO4. In addition to the voltammograms, the cumulative charge associated to the surface coverage was calculated using Cottrell’s equation[53], which defines the dependence of charge versus time (Eq. 1). This approach was selected to gather comprehensive information of the change transfer processes taking place at the working electrode surface.

$$Q\left( t \right) = {\raise0.7ex\hbox{${\left( {2nFAD^{\frac{1}{2}} Ct^{\frac{1}{2}} } \right)}$} \!\mathord{\left/ {\vphantom {{\left( {2nFAD^{\frac{1}{2}} Ct^{\frac{1}{2}} } \right)} {\pi^{\frac{1}{2}} }}}\right.\kern-0pt} \!\lower0.7ex\hbox{${\pi^{\frac{1}{2}} }$}} + Q_{dl} + nFA\Gamma$$
(1)

wherein: Q stands for the charge, t stands for time, F is the Faraday constant, A stands for the area of the working electrode, C is the concentration of electroactive species in the solution, Qdl is the capacitive charge, and nFAΓ is the faradaic component of absorbed species (i.e., surface coverage), which is defined according to Eq. 2.

$$nFA\Gamma = Q_{\int C }$$
(2)

wherein QC stands for the integrated area of chronocoulometric plot yielded by each voltametric scan.

Extended Hückel Method (EHM) and determination of molecular orbital energies

The semiempirical Extended Hückel Method (EHM) was employed to analyze the functional monomer and its oxidation products, aiming to assess the energy gap between orbitals. This gap can be associated with the thermodynamic feasibility of redox reactions involved in the electrosynthesis of polyaniline (PANI) [54]. EHM calculations rely on the energies of the highest occupied molecular orbitals (HOMO) and lowest unoccupied molecular orbitals (LUMO), where only valence electrons (j) of n-numbered orbitals are computed, and their wavefunctions (ψ) are considered individually as described below.

$$\psi_{valence} = \psi_{j} \left( n \right)$$

The molecular orbital energies were computed following established methodologies outlined in previous literature [55, 56]. This involved summing the energy contributions of individual electrons using an off-diagonal Hamiltonian matrix, while the diagonal of the Fock matrix was populated with parametrized energies. These calculations provided the energy eigenvalues and wavefunction eigenvectors for the valence orbitals. Within the framework of EHM, each molecular orbital was evaluated as a linear combination of atomic orbitals, as detailed below.

$$\psi_{j} = \mathop \sum \limits_{r = 1}^{N} c_{jr} \varphi_{j}$$

wherein φ are valence atomic orbitals; N stands for the molecular orbital; cjr are the weighting coefficients.

The energies of the molecular orbitals are calculated from a single-electron Schrödinger equation using a single-electron Hamiltonian (heff) as described below.

$$h_{eff} \psi_{j} = \epsilon_{j} \psi_{j}$$

wherein: \({\epsilon }_{j}\) is the energy eigenvalue for the \({\psi }_{j}\) eigenfunction of the j-indexed molecular orbital.

In EHM, the total energy of the molecule is a measure of the sum of the energies of each individual electron, and it is calculated as it follows.

For: \(\epsilon = \frac{{\mathop \sum \nolimits_{r = 1}^{N} \mathop \sum \nolimits_{s = 1}^{N} C_{r}^{*} C_{s} \psi_{r} \left| {h_{eff} } \right|\psi_{s} }}{{\mathop \sum \nolimits_{r = 1}^{N} \mathop \sum \nolimits_{s = 1}^{N} C_{r}^{*} C_{s} \psi_{r} |\psi_{s} }} , \epsilon_{j} = \frac{{\psi_{j} \left| {h_{eff} } \right|\psi_{j} }}{{\psi_{r} |\psi_{j} }}\; considering \;\psi_{j} = \mathop \sum \limits_{r = 1}^{N} c_{jr} \varphi_{j}\).

Wherein: \(\epsilon\) is the total energy.

All computations were carried out in silico. The energies of the molecular orbitals (with j = n starting from 0) were quantified as the numerical energy difference between the Highest Occupied Molecular Orbital (HOMO) and the Lowest Unoccupied Molecular Orbital (LUMO), expressed in electronvolts (eV) as per the following equation:

$$\Delta E_{n} = \epsilon_{LUMO\left( n \right)} - \epsilon_{HOMO\left( n \right)}$$

wherein: \({\Delta E}_{n}\) is the energy gap between HOMO and LUMO, n is the coefficient, \(\epsilon\) is the energy.

Graphical representations had their renderization standardized by minimizing steric energy using force field and classic molecular mechanics-based approaches (specifically, molecular mechanics version 2, MM2 and Assisted Model Building, AMBER packages).

Energy refinement by molecular mechanics version 2 (MM2) and assisted model building and energy refinement (AMBER)

To ensure uniform handling of cheminformatic data in this study, all molecules underwent energy refinement using MM2 and AMBER methods.

MM2 is a force field-based approach renowned for accurately reproducing molecular geometries at equilibrium. It achieves this by employing a vast array of continually refined parameters, updated based on comprehensive data pertaining to individual atoms and various classes of organic compounds [55, 56]. This method was chosen to initially minimize the steric energy of the compounds under investigation, complemented by the application of AMBER. The minimum root-mean-square gradient used to optimize the structures was set at 0.010.

AMBER, on the other hand, is an energy minimization technique that considers the summation of all forces acting on the system to estimate its potential energy [47, 55]. The energy refinement process performed by AMBER is outlined in the subsequent description.

\(\begin{gathered} V\left( {r^{n} } \right)\; = \;\mathop \sum \limits_{i \in bonds}^{{}} k_{bi} \left( {l_{i} - l_{i}^{0} } \right)^{2} + \mathop \sum \limits_{i \in angles}^{{}} k_{ai} \left( {\theta_{i} - \theta_{i}^{0} } \right)^{2} \hfill \\ \quad \quad \quad \quad + \mathop \sum \limits_{i \in torsions}^{{}} \mathop \sum \limits_{n}^{{}} \frac{1}{2}V_{i}^{n} \left[ {1 + \cos (n\omega_{i} - \gamma_{i} } \right] \hfill \\ \quad \quad \quad \quad + \mathop \sum \limits_{j = 1}^{N - 1} \mathop \sum \limits_{i = j + 1}^{N} f_{ij} \left\{ {\int_{ij} \left[ {\left( {\frac{{r_{ij}^{0} }}{{r_{ij} }}} \right)^{12} - 2\left( {\frac{{r_{ij}^{0} }}{{r_{ij} }}} \right)^{6} } \right] + \frac{{q_{i} q_{j} }}{{4\pi \int_{0} r_{ij} }}} \right\} \hfill \\ \end{gathered}\)

The steric energy minimization process involves minimizing the derivative of the system’s potential energy with respect to its position, which encompasses the summation of all forces acting within the system. This summation includes the energies associated with bonds and angles, approximated as harmonic forces in accordance with Hooke’s law (where \({k}_{bi}\) represents the spring constant of bonds and \({k}_{ai}\) of angles). Torsional forces are determined using Fourier series, while non-bonded energy between atom pairs is calculated based on Van der Waals and electrostatic energies, considering the equilibrium distance (\({r}_{ij}^{0}\)) and well depth (\(\epsilon\)).

Analysis of electrostatic interactions

In order to gather insights from the ultrastructural features of PANI and its putative effects on the conductivity of the electro synthesized polymer, the electrostatic interactions of the pro-crystal were mapped by means of Hirschfeld fingerprint plots. Henceforth, a previously published crystallographic model of PANI [57] was submitted to ab initio calculations using Tonto program, HF method and STO-3G basis set [58,59,60]. The software Crystal Explorer version 17 was henceforth used.

Hirschfeld surface analysis allows the quantitative study of molecular interactions and packing in crystal structures by calculating the contact distance of the nearest internal (di) and external (de) nuclei in regards to the Van der Waals radius of atoms (rvdw) [59]. The normalized distance between these nuclei (dnorm) is rendered in a tridimensional surface with a red-white-blue scheme according to the spectrum: red standing for intermolecular contacts less than rvdw, and blue standing for longer than rvdw. The dnorm parameter is calculated according to the following equation:

$$d_\text{norm} = \frac{{d_\text{i} - r_{i}^\text{vdw} }}{{r_{i}^\text{vdw} }} + \frac{{d_\text{e} - r_{e}^\text{vdw} }}{{r_{e}^\text{vdw} }}$$

The fingerprint plots were built upon the calculated de and di, and inform the type of intermolecular interaction in regards to the area of the surface [59]. The points in the fingerprint plots were colored in a red-blue-green-gray spectra, wherein: red stands for the highest contribution to the surface; blue for a high contribution; green for a small contribution and gray for no contribution.

PANI film characterization by Raman spectroscopy

Raman spectroscopy was performed using a microRaman Xplora Horiba and used to obtain information about chemical structure, conductivity and crystallinity of polyaniline films. To this aim, PANI film were electro-synthesized on the surface of glassy carbon (GC) slides by the proposed method. Before the analysis, the samples were washed with water (u.s., 200 rpm), rinsed with ethanol and dried with a gentle stream of nitrogen. For the analysis a 785 nm laser (power 0.125 mW cm−2) was used as source and Raman spectra were recorded using a 10 × objective, acquiring 50 scans with 10 s of integration.

Application of PANI film in the development of MIP-based electrochemical sensor for chloroamphenicol (CAP)

To assess the utility of PANI films in sensor development, a PANI-based molecularly imprinted polymer (MIP) for chloramphenicol was fabricated. The MIP receptor was synthesized on PGE electrodes via electropolymerization of a solution containing 0.15 M aniline and 0.01 M chloramphenicol target, dissolved in 0.5 M H2SO4. Following electrodeposition, the target analyte was extracted from the polymer matrix using a method already proposed [61]. In brief, a working potential of 0.6 V for 240 s is applied to induce the disruption of weak bonds (hydrogen bonds and electrostatic interactions) between chloramphenicol molecules and PANI layer. The fabricated sensor was rinsed with ultra-pure water and ethanol and then dried with a gentle stream of nitrogen. All the functionalization steps were monitored by cyclic voltammetry and impedance spectroscopy (EIS), using [Fe(CN)3]3−/4− as a redox probe to assess changes in permeability toward surface electrode.

During the detection tests the sensor was exposed (30 min) to standard solutions of CAP prepared in water, in a concentration range between 0.1 and 17.5 nM, monitoring the redox probe signal by EIS. The impedance signal was recorded after each concentration tested. The EIS data were acquired by Nyquist plots and fitted to the Randles cell equivalent circuit, using the PSTrace 5.8 software. All the experiments were performed in triplicates (n = 3).

Results

The experimental parameters for the electrodeposition of polyaniline, were determined through an exhaustive literature review, focusing on cyclic voltammetry technique, due to its simple application. Table 1 below presents the most significant findings.

Table 1 Literature research results about electropolymerization of aniline by cyclic voltammetry (CV)

The literature [30,31,32, 61,62,63,64,65,66,67,68,69,70] reveals a wide array of conditions for aniline electropolymerization, often utilized as a precursor for sensor development, where PANI film serve as recognition elements (of a part them), like molecularly imprinted polymers (MIPs), renowned for their molecular recognition capabilities [33,34,35, 37, 51]. In this work, some of the simplest synthesis conditions were chosen to obtain a thin but stable film on the electrode surface (Fig. 1). Indeed, the goal of this paper is to give useful information for those who use PANI films as raw material for sensor and biosensor development at simple conditions and/or low-resource settings.

Figure 1
figure 1

Literature research results. a Applied potential range, b scan-rate, c monomer concentration and d n° of cycles, during cyclic voltammetry for PANI electro-deposition, by different authors (black) vs the conditions adopted in this work (red).

After PANI electrosynthesis on PGEs, the calculations of HOMO and LUMO energies of aniline and its major oxidation products were performed, in order to propose an electrosynthesis mechanism for PANI in accordance to the redox profile exhibited in CV. EHM results are showcased in Fig. 2 and Table 2.

Figure 2
figure 2

EHM output of aniline and its first two dimers based on previously reported PANI electrosynthesis protocols. HOMO and LUMO energies are showcased in eV and HOMO-0 and LUMO-0 rendering is represented for each compound (coefficient therein labeled as “n”). Carbon atoms are colored in gray, hydrogen in white, nitrogen in blue. Furthermore, negative charges are represented in bluish shade while positive are colored in red.

Table 2 EHM output showcasing HOMO and LUMO energies in eV, as well as the energy gap between molecular orbitals (ΔE) according to their coefficient (n), which is also informed in eV

Results showcased that the HOMO-0 surfaces of aniline and its main dimerization products are localized around the nitrogen atoms and p-regions (i.e., 1,4 positions in the aromatic ring). The energy gap/band gap between the HOMO-0 and the LUMO-0 of aniline was of 10.77 eV, which equals to 1039.15 kJ mol-1 or 0.39579 Hartree. The dimer, on the other hand, exhibited an energy gap of 7.6 eV, which equals to 733.3 kJ mol-1 or 0.2793 Hartree. The dimer bearing an unpaired electron (which may be obtainable by single electron stripping) presented an energy gap of 8.939 eV, which equals to 862.482 kJ mol-1 or 0.3285 Hartree (Fig. 2 and Table 2).

Following EHM, the voltametric profile of PANI electrosynthesis was investigated concomitantly with the semi-empirical quantum chemistry method in order to propose an electro-polymerization mechanism and compare it to previous reports. Results are depicted in Fig. 3.

Figure 3
figure 3

a. PANI electrosynthesis pathway according to EHM and voltametric observations. b. Cyclic voltammogram of aniline electro-polymerization at pencil graphite electrode. The redox signals are labeled according to their equivalence in the electro-polymerization mechanism. The voltametric signal herein showcased is sourced from the 2nd scan, as it depicts all faradaic processes from PANI electrosynthesis. The black voltametric signal shows the blank (0.5 M H2SO4 solution) profile.

As seen in the voltametric profile, PANI synthesis from its functional monomer involves one irreversible anodic process at E ~  + 0.85 V, and two seemingly reversible anodic processes at E1 ~  + 0.15 V and E1 ~  + 0.45 V, which are in turn, correlated to cathodic processes E2 ~ − 0.05 V and E2 ~  + 0.38 V, respectively. The anodic peaks are suggestive of the oxidation of electroactive moieties at the electrode surface, while the cathodic peaks suggest reductive processes (Fig. 3 A and B).

Considering the HOMO distribution of aniline and its main oxidation products (Fig. 2 and Table 2), other authors reported similar results using highly refined ab initio approaches such as density-functional theory. In these reports, the electron accumulation was distributed around the nitrogen atoms and p-regions under similar energy gaps at a level of BLYP-D3/6–31 + G(d,p)[71,72,73,74]. In this regard, even though the semiempirical EHM does have limitations in terms of predicting the molecular orbital energies when confronted by ab initio methods, it is nonetheless a reliable and inexpensive tool to explore physicochemical properties; as it does not require strenuous processing power and lengthy computational times [45].

When taking into consideration the redox nature of PANI electrosynthesis and the mapped HOMO-0, it can be suggested that these mapped regions showcase thermodynamic feasibility to undergo oxidation upon shifts in electric potential [46]. Therefore, the amino group and the p-position of the aromatic ring in the studied compounds may be involved in the polymerization process, what is in consonance with literature exploring the electro-oxidation of aniline and its derivatives [75].

The electrosynthesis of PANI was explored by many authors in recent years for the crafting of conductive polymers in material sciences, and hence, the underlying mechanism of this reaction is well-known [76]. In this sense the faradaic processes herein seen were well-defined in the voltammogram and could be correlated with the electrosynthesis of PANI in an acknowledged mechanism (Fig. 3). Nonetheless, results were in consonance with the reported by other authors who used different nanostructured carbon-based composites, metalorganic frameworks and metallic materials in the working electrode composition [77,78,79]; henceforth allowing us to propose the mechanism shown at Fig. 3 to PANI synthesis on pencil graphite working electrodes, what is also corroborated by recent outreaches [80].

PANI formation involves a single-electron oxidation at the amino moiety of aniline (i.e., anodic process α), followed by rearrangement of the unpaired electron to the p position of the aromatic ring [16]. This allows the dimerization of electro-oxidized aniline moieties, leading to the formation of PANI emeraldine base after propagation [16]. The emeraldine base then undergoes a reversible oxidation reaction (i.e., redox process β), thereby yielding an oxidation product with an unpaired electron, which is the emeraldine salt polaron-bipolaron [81]. The polaron-bipolaron showcases thermodynamic feasibility to undergo a reversible redox reaction at ~  + 0.45 V, which involves the transference of one electron and two protons (i.e., redox process γ), henceforth forming pernigraniline [81].

Following the preliminary voltametric evaluation of PANI; the evolution of the voltametric curves from the electrosynthesis process were investigated under the stated by Cottrell’s equation, as described in methods section. Results are depicted in Fig. 4.

Figure 4
figure 4

a. Cyclic voltammograms of PANI electrosynthesis after the first scan. The value “n” stands for the cycle number. Inset. Superimposition of all the CV scans. b. Plot of electric current vs the scan number (i.e., voltametric cycle) of each anodic and cathodic faradaic process associated to PANI electrosynthesis. The r2 of the linear fit of α was of 0.99683; β1 was of 0.96092; β2 was of 0.95837, γ1 was of 0.95206, and γ2 was of 0.99572. c. Plot of charge versus scan number. Inset. chronocoulometric plots of PANI electrosynthesis (r2 = 0.97782).

The findings evidenced that both the irreversible anodic process α, as well as the reversible β and γ processes have their electric current output increased upon successive scans. Moreover, this increase in current as well as the integrated charge from the chronocoulometric plots is proportional to the scan number, what suggests that it follows measurable kinetics, and strongly hints that increasing polymer layers also increase the feasibility of charge transfer on the modified surface (Fig. 4AC). This can be suggested hence new conductible polymer layers are being formed upon each successive scan; thence leading to higher amounts of charge being transferred on the working electrode surface [75].

Considering that the morphological features of PANI may also play a major role in the conductivity of this polymer, the mapping of the electrostatic interactions in the pro-crystal was conducted. Results are depicted in Fig. 5.

Figure 5
figure 5

Hirschfeld surfaces a and fingerprint plots of PANI concerning: b internal H and external N dipole–dipole interactions (4.2% of the observations); c internal N and external H dipole–dipole interactions (5.7% of the observations); d internal C and external H Van der Waals interactions (16% of the observations) and e. internal H and external C Van der Waals interactions (12.6% of the observations). The Hirschfeld surfaces were rendered based on the values of dnorm with a red-white-blue scheme according to the spectrum: red standing for intermolecular contacts less than rvdw, and blue standing for longer than rvdw. The points in the fingerprint plots were colored in a red-blue-green-gray spectra, wherein: red stands for the highest contribution to the surface; blue for a high contribution; green for a small contribution and gray for no contribution.

When analyzing PANI ultrastructure, the first remarkable observation is that the aromatic moieties are seemingly aligned and stacked, what suggests strong involvement of π-π stacking interactions in the packing of the crystal, which are commonly reported in conducing polymers [82]. Moreover, the fingerprint plots of PANI intermolecular interactions evidenced that about 4.2% occurred between internal H and external N (considering the pro-crystal as highly packed PANI dimers). Similarly, external H and internal N interactions account for 5.7%; thereby suggesting that nearly as 10% of electrostatic contribution can be attributed to dipole–dipole interactions. On the other hand, internal C and external H contribution was of 16%, while internal H and external C was of 12.6%; thence highlighting that Van der Walls interactions between C–H account for about 28.6% of the electrostatic forces in PANI (Fig. 5). The different forms of PANI are the underlying basis for the electroactive properties of this polymer, as it can store charge according to the redox transitions between the emeraldine/polaron-bipolaron/pernigraniline, what nonetheless can be associated to the steady increase in electric current and integrated charge according to each voltametric cycle, as showcased in Fig. 4 [75, 83]. In fact, many authors explored the redox transitions undergone by PANI, as well as the possibility of doping this polymer, for crafting supercapacitors, highly conductive thin-films and nanowires for applications in electronics, biotechnology and analytical sciences [84,85,86,87]. Notwithstanding, the wide range of applicability attributable to PANI’s conductivity is further eased by the stacked nature of the polymer chains, which is promoted by the sp2 hybridization of its atom network, whose delocalized π electrons allows the transmission of inductive effects all across the molecule [88,89,90]; as well as might be involved together with other electrostatic forces in the stacking of PANI layers as hinted in Fig. 5, what was explored by other authors through crystallographic analysis [91, 92].

As observed in the fingerprint plots of Hirschfeld analysis at Fig. 5, about 9.9% of the electrostatic interactions in the model can be attributed to the dipole–dipole interactions between nitrogen and hydrogen in PANI crystal structure. In a similar way to the effect of π-π interactions on PANI ultrastructure, dipole–dipole interactions such as hydrogen bonds are regarded to play a pivotal role in the physicochemical and structural properties of PANI. It was observed elsewhere that, when PANI is compared to other substituted PANI structures such as poly(m-aminophenol) and poly(m-nitroaniline), PANI exhibits intermediate crystallinity due to the differences in intra and inter chain hydrogen bonds [91, 92]. Given that this affects the separation of the polymer chains, the property of density is also ultimately affected [91,92,93,94]. Moreover, synthesis method can play a major role in PANI crystallinity, as chemicals such as citric acid haven been shown to induce PANI crystallization into self-assembled nanorods through the effect of intermolecular hydrogen bonds between citric acid and PANI [91, 92]. On the same hand, in an investigation of the rection kinetics and thermodynamics of polypyrrole films oxidation, it was seen that, electrochemically-controlled redox reactions lead to swelling, shrinking and packing due to prevalent interchange of cations and their effect on the establishment of inter and intra chain hydrogen bonds [95]. In this sense, although the effect of π-π stacking interactions is regarded to play a major role in PANI crystal packing and conductivity, the effect of hydrogen bonds is believed to be particularly relevant for morphology hence its effects on intrinsic properties like density [93, 94].

According to literature, PANI electrosynthesis involves extensive conformational movements which encompasses relaxation, swelling, shrinking and compaction [95]. In this regard, it has been reported that anodic scans may induce the release of protons to the solution (i.e., redox process γ), followed by the swelling from the diffusion of conjugated bases from the acidic solution into the polymer matrix, and then, the expulsion of the conjugated bases resulting in conformational packing [95]. Thus, although our work investigated the morphology of a previously published structure of PANI pro-crystal, its ultrastructural features are highly tunable by changing the synthesis protocol as well as its parameters (e.g., chemical or electrochemical synthesis; potentiostatic or potentiodynamic conditions, profile of E versus time curve in the voltametric scan, etc.), what nonetheless highlights how versatile this polymer is.

Further insights into the PANI films obtained stem from their characterization using Raman spectroscopy. For this purpose, PANI films were electro-synthesized on glassy carbon slides and subsequently analyzed. Figure 6A illustrates the comparison between the Raman spectra recorded for the bare GC slide and the PANI film. The spectrum of GC (black line) displays classical Raman-active peaks at 1312 cm−1, assigned to the D mode related to structural defects, and at 1603 cm−1, corresponding to the G mode related to first-order scattering observed for sp2 carbon domains. Following PANI synthesis, there is a noticeable modification of the Raman spectrum, with characteristic peaks of the polymer emerging (blue line), consistent with those reported in the literature, confirming its successful deposition on GC. Specifically, the Raman spectrum of PANI reveals distinct bands at different wavenumbers: 1170 cm−1 for C–H bending vibrations of benzene or quinone type rings, 1230 cm−1 for C–N stretching, 1334 cm−1 for C–N+ polaronic structure, 1510 cm−1 for C=N stretching, and 1600 cm−1 for C=C stretching. This pattern is typically associated with the emeraldine form of PANI [96], that represent the most stable and conductive one [97]. In the spectral range between 400 and 1000 cm−1, information about deformation vibrations of the benzene rings can be extrapolated. For instance, bands at 420, 814, and 870 cm−1 represent in-plane and out-of-plane vibrations of the protonated emeraldine form of PANI [96, 97]. It is widely recognized that the presence of more crystalline regions in the PANI structure corresponds to its higher electrical conductivity [98]. The presence of distinct and prominent peaks at 1170, 1510, and 1613 cm−1, associated with vibrations of benzene and quinone type rings, confirms the presence of a crystalline and condensed PANI layer, rather than amorphous [99]. Indeed, plains of benzinoid and quinoid rings of PANI chain are accountable for crystalline assembly [100].

Figure 6
figure 6

a Raman spectra recorded for bare GC slide (black line) and for polyaniline film (blue line) deposited on GC; b Raman spectra recorded for PANI on GC after its synthesis at room temperature (black line) and after a thermal treatment at 40 °C (blue line), 60 °C (red line), 80 °C (green line) and 150 °C, for 24hs.

Additionally, to obtain information about the thermal stability of polyaniline obtained by the proposed method, PANI-functionalized GC slides were thermally treated at four different temperatures, namely 40, 60, 80, and 150 °C, for 24 h at each explored temperature. Figure 6B illustrates the comparison between the spectrum of PANI recorded after synthesis (at room temperature) and those recorded after thermal treatment. The results highlight that the material is not particularly affected by temperature variation, demonstrating good longevity and resistance.

The proposed method for PANI synthesis was challenged for the development of a new molecularly imprinted polymer (MIP) for chloramphenicol, on the surface of PGEs to obtain an innovative impedimetric sensor. Cyclic voltammetry (CV) and electrochemical impedance spectroscopy (EIS) curves were recorded, during MIP synthesis. CV curves (Fig. 7A) show sensitive changes after each functionalization step. An increase of both anodic and cathodic peak currents with a simultaneous decrease of peak separation is observed after PANI-based MIP deposition. This suggest the conductive character of the obtained polymer film able to increase the current signal, as already observed after PANI electro-deposition on electrodes [99], even on carbon-based transducer [101]. In addition, a current increase is registered, after CAP removal from the polymer matrix suggesting the formation of the imprinted cavities and then a higher permeability of redox probe toward the electrode surface. Indeed, although CAP is electroactive [102], its redox properties manifest at different potentials compared to those used for monitoring the ferrocyanide probe.

Figure 7
figure 7

a Cyclic voltammograms (scan rate 100 mV/s) and b EIS Nyquist plots recorded in 5 mM [Fe(CN)6]3−/4− redox couple prepared in 50 mM phosphate buffer with KCl 0.1 M, to check the electrode functionalization during PANI-based MIP synthesis. c Nyquist impedance plot in 5 mM of [Fe(CN)6]3−/4− recorded during CAP detection tests for different concentration; inset: Randles cell used as equivalent circuit; d calibration curve for CAP detection. Each point of the calibration curve is referred to the average of three replicates on three freshly prepared sensors.

EIS technique was also used to check the fabrication process of PANI-based MIP sensors (Fig. 7b) monitoring changes of RCT after electrode surface modifications [34, 35, 103]. Coherently with CV data, a decrease of impedance values is observed after MIP deposition, further confirming the conductive character of the PANI-based film. Moreover, after CAP template removal from the polymeric layer, a decrease of impedance is observed, due to the formation of imprinted cavities permitting the access of probe to electrode surface and then the electron transfer.

EIS was used for CAP quantification after rebinding with MIPs, due its easy application and fast data aquisition. It is possible to observe (Fig. 7C) a gradual increase of impedance values on the Nyquist plot, presumably due to the successful rebinding of target to the imprinting cavities, resulting in a decrease in redox probe permeability toward the electrode surface. The EIS data were fitted to Randles cell (Fig. 7 C, inset). The Randles cell consists of several circuit elements: solution resistance (Rsol), charge transfer resistance (RCT), constant phase element (CPE), and Warburg impedance (W).

The charge transfer resistance values (RCT) were utilized to calculate the “normalized impedance change” (NIC) [34, 35]:

$${\text{NIC }}\left( \% \right)\; = \;\left[ {\left( {{\text{R}}_{{{\text{CT}}}} - {\text{R}}_{0} } \right)/{\text{R}}_{0} } \right]{\text{x1}}00$$

where RCT is the charge transfer resistance recorded after the exposure of the sensor with the target and R0 is the resistance recorded by the sensor before the exposure with CAP. NIC was used as analytical parameter to construct the calibration curve (Fig. 7 D).

A linear increment in NIC value with the increase in target levels was recorded, as shown by the calibration curve in Fig. 7D, with good linearity (R2 = 0.991) in the whole concentration range. The limit of detection (LOD) and the limit of quantification (LOQ), evaluated as the ratio between the standard deviation of the linear regression (σ) and the slope (S) of the calibration curve (3.3 and 10σ/S), correspond to 0.3 and 0.9 nM, respectively. Sensor reproducibility was evaluated by comparing the sensitivity of three different MIP-based sensor, resulting in a satisfactory variability (RSD% = 13.1%).

Moreover, our sensor performance was compared with that of other CAP sensors that have been found in literature and summarized in Table 3. The comparison shows how our sensor has a narrowed linear range but is able to detect lower CAP concentrations, indeed a lowest limit of detection is reached.

Table 3 Summary of recent electrochemical sensors for the detection of CAP

Conclusions

This work showcased the physicochemical investigation of PANI electrosynthesis on inexpensive pencil graphite electrodes. Results from EHM and voltammetry allowed the proposal of an electro-polymerization mechanism which was in agreeance with literature. Moreover, the conductivity of PANI could be strongly hinted by the dependence of the amplitude of the faradaic peaks with the voltametric scan, the dependence of charge to the scan number, as well as through the analysis of a previously published PANI crystal structures; thereby hinting that inexpensive pencil graphite matrixes may be suitable in the electrosynthesis of PANI. This manuscript sheds light on the possibility of combining electrochemistry, spectroscopy and computational methods in the exploration of polymer formation on inexpensive electrode matrixes. The proposed synthetic method was challenged for the development of a new MIP-based electrochemical sensor for chloramphenicol, an antibiotic. The sensor can detect the target in a dynamic concentration range between 0.1 and 17.5 nM, with a limit of detection (LOD) of 0.03 nM and a limit of quantification (LOQ) of 0.09 nM. The results suggest that PANI film obtained by the proposed method have great potential in sensing applications.