Introduction

Water’s unique properties make it an essential and irreplaceable component for the survival and functioning of all living organisms. Therefore, any pollution of water resources would make it harder for people and other living things to maintain their health [1, 2]. Heavy metals are a significant threat to our water supply and a major contributor to the broad problem of environmental contamination caused by sources of pollution from industrial operations [3]. There is a growing trend of discharging these metals into environmental water, particularly in developing countries. One of the most significant environmental issues is pollution caused by these metals because of their toxicity and various negative consequences. Also, due to their solubility in water, they can be absorbed by organisms on Earth. [4, 5]. Large amounts of heavy metal ions may build in the human body once they reach the food chain. Intake of metal ions above the safe concentration can result in significant health problems [6]. One of the most dangerous heavy metal ions is cadmium (Cd2+) because it can cause considerable damage to the central nervous system and other essential organs in humans and animals when taken at more than safe levels [7]. Welding, electroplating, cadmium (Cd) and nickel (Ni) batteries, nuclear energy plants, paints, plastics, and fertilizers are all contributors to cadmium (Cd) pollution in both natural water bodies [8]. The rising global demand for most metals, the degradation of accessible ores, and severe environmental restrictions make it intriguing to identify effective and efficient ways for processing waste solutions containing metal ions, even at low concentrations. Most techniques for separating inorganic species from dissolved matrices, industrial fluids, and natural waters [8] involve liquid–liquid extraction, sorption, precipitation [9], coagulation-flocculation surface absorption, ions-exchanger [10], membrane filtration [11], and other two-phase distribution methods. Some issues might arise from using these strategies despite the fact that many of them have been created and used effectively. Certain complications may arise in relation to interphase transfer and heterogeneous reactions. Additional issues may develop if organic solvents or solid concentrates are selected for the following operations over aqueous solutions. When this happens, further steps such as reverse extraction, desorption, dissolving solid concentrates, etc., are required, which makes analysis more difficult and increases the risk of sample contamination from the added reagent [9, 10]. There has been a lot of research into and use of insoluble polymeric supports for recovering metals from weak solutions. Finding effective, low-tech solutions to the problem of heavy metal contamination in water samples is an area worthy of study. Selecting an effective adsorbent material is crucial to purify water containing heavy metals. One example of an ion exchanger is the organic resins. Superior mechanical and chemical stability, as well as a high ion exchange capacity and rate, are the primary benefits. Many organic and inorganic materials [11,12,13,14] have been investigated for their potential application in wastewater purification. However, polymeric materials with donor atoms in their skeletal structures have been influential as adsorbents and represent a class of polymers that have found considerable use in environmental applications [15]. The ability to tailor the crosslinking degree and fixed ligand groups is a further benefit. It is possible to differentiate chelating polymers (polychelatogens) from polyelectrolytes. The former can create coordination bonds due to their functional groups, whereas the latter may be readily ionizable in water. The ligands found in polychelatogens that have been studied the most include amines, carboxylic acids, amides, alcohols, amino acids, pyridines, thioureas, iminos, and so on. Structures containing carboxylic acid, phosphoric acid, sulfonic acid, or ammonium groups are the most researched polyelectrolytes [16,17,18,19]. Copolymerization is a flexible method for synthesizing various polymers. It is feasible to enhance characteristics like water-solubility, metal ion binding capacity, and selectivity by carefully selecting both comonomers. These materials can coordinate with various metal ions due to their structural assembly [20,21,22].

Polypyrrole (PPy) has received much attention as a novel conducting polymer because of its high electric conductivity, excellent thermal stability, and beneficial environmental impact [23]. Using the Paal–Knorr reaction to add pyrrole rings to the backbone of functional alternating 1,4-polyketones has proven to be a promising way to produce functional polymers [24,25,26,27,28]. Under mild experimental conditions, the Paal–Knorr reaction can be performed without using catalysts and solvents [29,30,31,32]. The use of such a reaction to prepare polymeric amines is fascinating. Among the many uses for amine functional polymers are metal ions chelating agents [33].

This article's primary objective is to enhance the prepared alternating 1,4-polyarylidene ketone (PAK) performance in its capacity to adsorb (Cd2+) metal by increasing the number of chelating groups in the polymer structure. Thus, this research presents the synthesis and characteristics of two new functionalized amine polymers with pyrrole units along the backbone, derived from the (PAK) through its reaction with hexylamine and P-Phenylenediamine via Paal–Knorr reaction, and evaluates the (Cd) metal uptake behaviour of the newly prepared polymers in comparison to the original polymer.

Experimental

Chemicals and reagents

2,5-Hexane dione (97%), hexylamine (99%), and terepthaldehyde (98%) are from Alfa Aesar. Ethanol absolute EtOH (99.9%), methanol MeOH (99.9%), and p-phenylenediamine (99.5%) are from Sigma-Aldrich. Silica Gel (60–80) mesh pore size, hydrochloric acid HCl (35%), sodium hydroxide NaOH, acetone (99.9%), potassium hydroxide KOH, and cadmium chloride; dihydrate CdCl2.2H2O. All of the chemicals and organic solvents that are used are highly pure.

Synthesis of polyarylidene ketone (PAK)

According to our previous work, the polymer (PAK) is synthesized by reacting terephthaldehyde with 2,5-hexane dione in an ethanolic solution [34].

Synthesis of polyarylidene N-hexane pyrrole (PAPh)

In a flask (100 ml) fitted with a condenser and a magnetic stirrer, 1 g of prepared polymer (PAK) was first dispersed in about 50 ml absolute ethanol by stirring it for one hour. About 3 g (0.03 mol) of hexylamine was dissolved in 10 ml absolute ethanol and added to the previous solution until all were mixed. The reaction was performed under continuous stirring at ambient temperature for (24 h). Filtering, followed by water and ethanol washing and drying under decreased pressure at 80 °C for 24 h, separated the produced polymer with a dark orange colour from the original polymer.

Synthesis of crosslinked polyarylidene N-phenyl pyrrole (PAPD)

In a flask (100 ml), about 1 g of PAK was dispersed and stirred in 50 ml absolute ethanol for one hour. The initial solution mixture was supplemented with 3.2 g of p-phenylenediamine (0.03 mol) that had been dissolved in 10 ml of absolute ethanol. The reaction was carried out at room temperature with constant stirring for 24 h. A brown-coloured polymer that had been produced was separated by filtering, washed with ethanol and water, and dried for 24 h under decreased pressure at 80 °C.

Preparation of heavy metal Cd (II) solution

At room temperature, a stock solution of the heavy metal Cd2+ was made at a concentration of 20 ppm in distilled water [35].

Measurements

Infrared spectra are measured with a Shimadzu 2110 PC Scanning Spectrophotometer. A Buck version 210 VGP Inc., East Norwalk, Connecticut, flame and graphite atomization methods (USA) is used as the atomic absorption apparatus for metal concentration detection. The Bruker D8 Advance, which is a copper tube that houses an X-ray device, is used to analyse polymer X-ray diffractograms. The X-ray source, which has a wavelength of 1.5406 nm, is powered by a generator that operates at 40 kV and 40 mA. The scanning range for the Coupled TwoTheta (2Ɵ) is 5° to 60°, and the scanning rate is 0.02°/0.60 s. The samples are heated at 10 °C/min in an N2 atmosphere in a TA 2000 thermal analyzer and a Shimadzu DTG-60, respectively. Polymer morphology is studied using a scanning electron microscope (SEM), specifically a Joel- JSM-5400 LV. The Nova 3200 surface area instrument collects BET data in the N2 atmosphere. The UV–Vis spectra are measured with a Perkins-Elmer spectrophotometer using a 1-mm quartz cell.

Results and discussion

Alternating 1,4-dicarbonyl groups along the polymer chain can be easily transformed into polythiophene, furan, or polypyrrole [36]. The ‘‘Paal–Knorr’’ synthesis yields functional groups retained along the main chain of N-substituted pyrrolic units with an aliphatic or aromatic substituent [37]. It is especially fascinating when used with molecules that alternate between polyketone and amine-substituted compounds. The Paal–Knorr reaction can be carried out without a catalyst or solvent and produces water as a byproduct under particular experimental circumstances. The Paal–Knorr mechanism is a unique example of a functionalization reaction in which both the level of functionalization and the aromatic density along the backbone can be modified at the same time.

The functionality of alternating polyketone emphasizes its unique characteristics compared to other functional polymers, such as polyolefins, polystyrene, and acrylates [38]. The increased backbone aromaticity may also have further applications, particularly in the hydrophobic interactions needed to disperse dyes, which hardens the polymer backbone. A quick, simple, and inexpensive Paal–Knorr reaction binds the primary amines hexylamine and p-phenylene to the previously synthesized 1,4-polyketone (PAK) core, yielding N-substituted pyrroles (Scheme 1). The amine solution is added after the polymer has been thoroughly mixed in an ethanolic solution, and the mixture stays for 24 h with continuous stirring at room temperature. The resultant improved polymers are examined for pyrrole units in the modified polymers using several studies.

Scheme 1
scheme 1

Synthesis of PAK, PAPh, and PAPD

The structure of polypyrrole PPy in the literature is consistent with the FT-IR analysis data in Fig. 1, which also demonstrates the distinction between the resultant polymers (PAPh, PAPD, and PAK). [39,40,41,42,43]. In contrast to the PAK spectrum, the C–N pyrrole stretching bands are visible in the polyamine spectrum at 1172 cm−1 and 1379 cm−1 for PAPh and 1167 cm−1 and 1365 cm−1 for PAPD. The stretching vibration of the aliphatic hexyl chain appears more clearly in the PAPh spectrum than in the PAK or PAPD spectra. The spectrum of PAPh demonstrates that the stretching vibration of C = C pyrrole ring bands at 1510 cm−1, aromatic stretching vibrations at 1610 cm−1, and peak at 1422 cm−1 is due to the bending vibration of the C–H aliphatic bond [40, 44]. The stretching vibration of C = C pyrrole rings is visible in the spectrum of PAPD at 1511 cm−1, and the stretching vibration of aromatic bonds is at 1607 cm−1. The C–H aliphatic bond's bending vibration appears at 1414 cm−1 [39, 40, 43].

Fig. 1
figure 1

FT-IR spectra of PAK, PAPh, and PAPD

Additionally, the PAPD spectrum shows a lower stretching vibration of the aliphatic chain than the PAK or PAPh spectra, indicating that the polymer backbone is more aromatic than PAK. C = O stretching in the FT-IR spectra of PAPh and PAPD is seen at 1691 cm−1 and 1699 cm−1, respectively. That peak is due to the conjugation of a non-reactant carbonyl group along the chain. The stretching vibration peak of C–O showed at 1294 cm−1 in the spectrum of PAK, indicating the presence of the keto-enol form in the chains [45]. As a regioselective reaction, the Paal–Knorr reaction is inhibited by steric hindrance, making primary amine groups attached to secondary or tertiary carbons less reactive than those connected to primary carbons [36]. In the case of PAPh, the hexyl chain has an electron-donating action that would increase the electron density on the N and make cyclization easier. According to PAPD, the phenyl ring's terminal group has an amino group, which promotes cyclization by acting as an electron donor; the reaction proceeds at room temperature [46].

According to the XRD data in Fig. 2a, the modified polymers have X-ray graphs extending to greater angles around 19.9–20.1ο compared to the original PAK [47], which has a peak at 13ο. These peaks demonstrate that the pyrrole rings are formed in the polymer chain at this location. It can be deduced from the patterns that the amorphous areas in the polymer backbone make the produced polymers less crystalline than PAK (56.7% crystallinity), as PAPh has 42.8% crystallinity and PAPD has 39.3% crystallinity. In PAPh, the aliphatic chain that is present in hexyl amine provides some flexibility to the mobility of the chains, which ultimately results in less space or distance between polymer chain molecules. The introduction of crosslinking through p-phenylene molecules reduces PAPD’s flexibility and mobility, affecting the physical characteristics of polymeric materials and increasing the proportion of amorphous areas in the polymer.

Fig. 2
figure 2

a XRD graphs, b TGA curves of PAK, PAPh, and PAPD

Figure 2b shows the results of a thermogravimetric analysis (TGA) that demonstrates the thermal stability of the prepared polymers; Table 1 provides data on the initial degradation temperature and char yield at 600 °C of the prepared polymers. According to the results, the synthesized polymers are stable, with the initial degradations occurring at higher temperatures (4% weight loss for PAK 421 °C, 388 °C for PAPh, and 305 °C for PAPD). The PAK polymer is more stable and yields higher char than the modified polymers. PAPD shows more rapid degradation than the other polymers. After reaching 302 °C, a rapid decrease in mass continues, which may be attributable to the systemic thermal breakdown of the polymer chains that contain pyrrole rings. These findings demonstrate the formation of pyrrole rings in the polymer chains with a great percentage. Also, they are carbonized to create graphitic structures and cannot entirely decompose completely in a nitrogen atmosphere [48]. X-ray results suggest that the crosslinked polymer PAPD has an amorphous structure and, hence amorphously arrangement of chains containing pyrrole rings, which may explain why the degradation of the produced crosslinked polyamine is accompanied by a faster weight loss than that of PAPh and PAK [43]. The thermal conductivity and stability increase with increasing crystallinity; polymers show significant anisotropy in their thermally conductive qualities since heat transfers more readily along the direction of the polymer chains rather than perpendicular to them and hence retard the heat transfer between the chains [49]. Since PAK has the finest packing of the chains and has a more significant crystallinity percent, it is more thermally stable than the other polymers.

Table 1 Temperature (°C) for various decomposition levels in N2 at a heating rate of 10 °C/min

As shown in Fig. 3, microstructural analyses of produced polymers provide further evidence that the chain reaction has succeeded. Compared to PAK, PAPh has a more aggregated structure; its particles are more uniform in size and shape, prefer to aggregate, and take on a spherical shape. In contrast, in PAPD, the spherical particles aggregate into stacked blocks with unequal shapes and a rough surface by further smoothing and linking the particles [50, 51]. PAPD’s structure results from crosslinking in the structure and distribution of pyrrole rings between chains in its three-dimensional structure, resulting in an amorphous structure as opposed to PAPh’s structure, which lacks this crosslinking. The results showed that pyrrole rings were synthesized along PAK chains [51].

Fig. 3
figure 3

SEM images at different magnifications of PAK, PAPh, and PAPD

The development of pyrrole rings throughout the PAK chain was investigated using UV–visible spectroscopy, with absorbance recorded for a partially soluble solution of PAPh, PAPD (1 mg in 10 ml DMF). The polymers created by reacting PAK with various amines showed lower absorbance intensity in their spectra of absorbed light. Based on what we see in Fig. 4, like the original polymer PAK, PAPh has an absorbance peak at λmax 269 nm and a shoulder peak at a longer wavelength at λmax 276 nm. However, the peak at 269 nm in PAK polymer is also present in the PAPD spectrum with a noticeable broadening that does not exist in the other spectra [39]. As the data show, these results may be due to the increased chain conjugation, causing the additional peak and broadening to appear at a longer wavelength. One approach to learning about the structure and effects of the synthesized polymers due to interactions with other molecules is to measure their optical energy gap. It is influenced by conjugation in polymer molecules or semiconducting materials and measures the minimal energy necessary for electron excitation from the valence band to the conduction band. One may use Tauc’s equation to determine the optical energy gap and optical transition from the absorption spectra [52]. Even though the optical energy gap has been measured, Tauc’s equations can be used directly to determine its transition. The absorbance maximum is increased by the presence of pure enone groups in the PAK transition, as opposed to double bonds with C–N bonds [53]. From Tauc’s equation, the energy band gaps are calculated to notice the difference between the prepared polymers, compared to PAK (Eg 3.83 eV), the band gaps of the resultant polymers (PAPh 4.1 eV, PAPD 4.33 eV) are increased [54]. This increase in band gap is attributed to the formation of pyrrole rings between the aromatic rings of PAK, which increases the number of defect locations present among PAK’s HUMO and LUMO states [47].

Fig. 4
figure 4

a UV–visible spectra, the inset graphs show energy bang gap. b Emission spectra at λexc. 280 nm, and the inset photo shows the CIE diagram of PAK, PAPh, and PAPD

Solid-state PL spectra of polymers exhibit an emission peak at 377 nm with an excitation wavelength λexc. of 280 nm; the polymers emit blue light. The Commission International de L’Eclairage (CIE) coordinate values for polymers are as follows: PAK (0.113,0.297) (blue-green colour), PAPh (0.120, 0.248), and PAPD (0.124, 0.223) (greenish blue) the blue colour emission is increased gradually, as it known that the increase in the blue degree has occurred when the (y) coordinate is decreased [55, 56]. The ππ interaction between polymer molecules is largely responsible for the colour produced; the crosslinking of PAPD makes this interaction particularly strong [57]. The colour change indicates pyrrole ring development along PAK chains.

Figure 5 and Table 2 provide N2 adsorption–desorption isotherms and pore size distribution curves for PAK, PAPh, and PAPD, respectively. All the curves show sorption patterns, indicating the microporous structure's presence. Compared to PAK’s surface area of 76.72 m2 g−1, the results show that PAPh’s specific surface area increases to 141.3 m2 g−1, and that of PAPD decreases to 74 m2 g−1. The polymers’ pore sizes also altered, increased in PAPh at 1.83 nm and shrank in PAPD at 1.7 nm compared to PAK at 1.7911 nm. The results suggest that the polymer has pores that are near to being microporous. PAPh’s improved specific surface area to PAPD may be related to the presence of an aliphatic hexyl chain in the nitrogen of the produced pyrrole rings, which prevents the aggregation of the pyrrole rings and polymer chains [58,59,60].

Fig. 5
figure 5

BET nitrogen adsorption isotherms (inset plots), pore size distribution, and BET surface area of PAK, PAPh, and PAPD

Table 2 The surface area data for the prepared polymers

In contrast to p-phenylene, the specific surface area decreases because pyrrole rings tend to aggregate. The overall area may be proportionate to the coiled portions of chains that keep them from gathering and creating permeable parts when the chains are rigid and unable to compress and versatile chain integration. It would be difficult for the probe to contact the contact surface because neighbouring chains would rub against one another due to the packing. The phenyl ring connecting the pyrrole rings between chains and moieties reduces the surface area. Under these circumstances, the phenyl rings effectively fill a concave space on the molecule’s surface. Simultaneously, the surface area rises because the hexyl chain extends far from the surface [61, 62].

Any particles on the surface of a macromolecule or substance have a property called zeta potential, which is a physical feature. Film and coating production may be optimized, and surface interactions predicted with this approach. Particles in suspension with a negative zeta potential tend to become even more negatively charged when additional alkali is added to the mixture. Sometimes, the acid added to this solution will neutralize the charge. If the acid is added in large enough quantities, the ions may be selectively adsorbed, leading to a buildup of positive charge. For this reason, the slope of a zeta potential vs. pH curve will be positive in acidic conditions and negative in basic ones [63].

Figure 6 depicts typical zeta potential curves of polymers. The results showed that PAPh adsorbed ions more strongly than PAPD and PAK at low pH, suggesting that PAPh possesses a considerable positive zeta potential at low pH. Isoelectric points, where molecules do not carry a net electrical charge on average, occur at about pH 3, 3.6, and 4.2 for PAK, PAPh, and PAPD, respectively. In contrast to PAPD and PAPh, which have pyrrole rings in their chain and other phenyl rings in PAPD that increase the stacking effect and electrostatic attraction, PAK has more electron charge (carbonyl groups) on its surface, needs to be neutralized, and requires a strong acid medium. Therefore, the ion adsorption responses of PAPh and PAPD are distinct, as is the PAK polymer structure [64, 65].

Fig. 6
figure 6

Plots of zeta potential vs. pH showing the position of the isoelectric point of PAK, PAPh, and PAPD

Studying the adsorption of Cd2+ from wastewater through the produced polymers

Adsorption study

Determination of optimum pH, polymer dose, and initial ion concentration:

The effectiveness of the produced polymers in removing Cd2+ ions from an aqueous solution was investigated through a batch adsorption method. Experiments on adsorption in batches were performed at 700 rpm using a magnetic stirrer, and the pH of the Cd2+ solution was monitored using a pH meter. CdCl2.2H2O was dissolved in purified water to produce Cd2+ ion-loaded solutions. Then, at room temperature and for one hour, multiple adsorption tests were conducted to determine the optimal pH, polymer doses, initial cadmium concentration, and contact time.

The adsorption study was investigated by adding optimal amounts of PAPh and PAPD in powder form to the flasks containing Cd2+ feed solutions (200 ml each) ranging in concentration from 5 to 30 ppm at the optimal pH. The polymer samples were left in the cadmium solution and stirred until a stable state was reached. Adsorbed cadmium levels on the polymers were determined using the mass balance Eq. (1):

$${Q}_{e}=\frac{\left({C}_{0}-{C}_{e}\right)V}{W}$$
(1)

In this equation, V represents the volume of the solution, W represents the weight of PAPh and PAPD, C0 is the starting concentration of cadmium ions in the solution, and Ce is the equilibrium concentration. For approximately 1 h, 5 ml aliquots of the solution were collected, and the remaining concentration of Cd2+ ions was determined by atomic absorption analysis. The amount of Cd2+ adsorbed by polymer molecules during a certain exposure period, qt (mg g−1), was calculated as follows [66]:

$${q}_{t}=\frac{\left({C}_{i}-{C}_{t}\right)V}{m}$$
(2)

The notation referred as: Ci = initial Cd2+ concentration (mg l−1), Ct = concentration at time t (mg l−1), V = volume of solution (L), and m = mass of the polymer sample (g).

Figure 7a-d displays adsorption studies with varying contact times, pH values, polymer doses, and initial Cd2+ concentration. The influence of contact time between polymers and metal ion solution at a pH of the solution was investigated by measuring the absorption of adsorbate (Cd2+) per mass of adsorbent across contact durations t (qt) ranging from 5 min to 1 h. Figure 7a shows that the probability of polymer removal rises with the increase in the contact time between the polymer and the solution. Within 60 min, all the polymers had attained equilibrium regarding their adsorption ability for cadmium ions. After 30 min, the capacity of both polymers is quite comparable and gradually rises until they approach equilibrium; however, in the first 30 min, the adsorption capacity of PAPD is larger than that achieved by the PAPh by roughly 10%. PAPD showed around 90.2% effectiveness in adsorbing metal ions at equilibrium, making it the most effective adsorbent. The increased performance in PAPD adsorption results from the larger available surface area.

Fig. 7
figure 7

Study the effect of a contact time (pH = 7, polymer dose = 0.1 g, initial Cd2+ concentration = 20 ppm, T = 293.15 K); b pH (polymer dose = 0.1 g, initial Cd2+ concentration = 20 ppm, contact time = 60, T = 293.15 K); c polymer dose (initial Cd2+concentration = 20 ppm, T = 293.15 K, contact time = 60 min, pH = 7); and d initial Cd2+ concentration (pH = 7, polymer dose = 0.1 g, contact time = 60 min, T = 293.15 K) on Cd2+ adsorption efficiency of PAPh, and PAPD

The pH of the solution may significantly impact the adsorption characteristics of metal ions [14]. This study analysed the effects of pH on cadmium removal efficiency from acidic to basic solutions. The HCl and NaOH were used to make the acidic and basic solutions. At ambient temperature, a 0.1 gm sample of the polymers was submerged for 60 min in a 15 ppm cadmium solution. Figure 7b shows how the pH level affects the polymers' ability to remove metal ions; adsorption effectiveness is lower at acidic pH levels (3 and 4) and begins to rise from pH 5 and after for PAPD, while the removal efficiency for PAPh is almost the same at acidic pH (from 1 to 5) and begins to increase after pH 5. Saturation was obtained at a pH of 7.0 for all polymers tested regarding cadmium ion elimination. Apparent patterns and unfavourable adsorption of cadmium at low pH can be explained because of the repulsive electrostatic interaction between the positively charged cadmium ions and the protonated surface sites or may be due to the hydronium ions (H3O+) competing with Cd2+ ions for adsorption sites at more acidic pHs, which limits the availability of cadmium ions. As the pH rises, the surface becomes more reactive to deprotonation, which favours the attachment of metal ions. Also, we can observe from the chart that the efficiency of PAPD is higher than that of PAPh at all pH levels except for pH levels (after 2.5 to 4). The results agree with zeta measurements of increased stacking in PAPD, leading to decreased electrostatic attraction and increased zeta potential in the positive range before reaching the neutralization point in that range of pH values. Adsorption of Cd2+ ions occurs by physical adsorption between counter-charged particles; this is facilitated by the material’s charge, which increases when the pH rises above 5. All the adsorption studies were performed at a pH of 7, where the removal effectiveness for PAPh is about 90% and around 97% for PAPD, as in solutions with a pH greater than 7, cadmium ions precipitate as cadmium hydroxides [67].

For detecting the optimal PAPh and PAPD doses, adsorption studies were performed at neutral pH and dosages ranging from 0.0125 to 0.1 g/ 200 ml. According to the results shown in Fig. 7c, a concentration of 0.1 g/ 200 ml is sufficient to achieve about 84.3% Cd ion removal for PAPh and 89.2% for PAPD when the total feed concentration of Cd ion is 30 ppm. Therefore, the best initial cadmium concentration that gives high efficiency of removal can be determined by using these adsorbents doses and pH 7; the chart demonstrates that 92.3 and 93.4% of Cd ion can be removed at an initial concentration of 5 ppm with doses of 0.1 g/ 200 ml PAPh and PAPD, respectively (Fig. 7d).

Adsorption isotherm

The most popular models, the Freundlich and Langmuir isotherms [19], were utilized to fit the equilibrium data in this investigation. The Langmuir model presumes monolayer surface absorption with little interaction between neighbouring molecules and that all adsorption sites have the same energy. The linear version of the Langmuir model is as follows (Eq. 3):

$$\frac{{C}_{e}}{{q}_{e}}=\frac{{C}_{e}}{{q}_{m}}+\frac{1}{({K}_{l}*{q}_{m})}$$
(3)

The equilibrium cadmium ion concentration (Ce, in ppm), the quantity of Cd2+ adsorbed per unit mass of polymers (qe, mg g−1), the adsorption capacity (qm, mg g−1), and the adsorption equilibrium constant (Kl, L mg−1). Non-ideal sorption on heterogeneous surfaces is assumed in the Freundlich model, which may be stated in this way (4):

$${\text{ln}}{q}_{e}={\text{ln}}{K}_{f}+\frac{{\text{ln}}{C}_{e}}{n}.$$
(4)

Kf represents the Freundlich constants, and n represents the Freundlich adsorption strength exponent linked to heterogeneity. Linear regression utilizing the proper linear plot for each isotherm model is widely used to extract the values of the model parameters (qmax, Kl, Kf, and n).

Linear plots of the Langmuir model and the Freundlich model for each polymer's adsorption by metal ions are displayed in Fig. 8a, b, respectively. The model parameters' regression values are shown in Table 3. The Freundlich model best describes the adsorption of Cd2+ to PAPD in this investigation, while the Langmuir model fits better with the PAPh data, and PAPD was shown to have a higher sorption capacity than PAPh. The agreement is probably because a monolayer forms on the PAPh's surface, and intermolecular forces diminish as Cd2+ ions move away from the adsorption site. Additionally, the adsorbent surface is probably more uniform than PAPD and comprised adsorption sites that have the same energy potential [68]. Larger values of n for PAPD than PAPh (lower values of 1/n) validate the high heterogeneity of the PAPD adsorbent and suggest a greater interaction between the adsorbent and the adsorbate. Two polymers have n values (7.16 for PAPh, 7.11 for PAPD) that point to adsorption heterogeneity on the surface [69,70,71].

Fig. 8
figure 8

The PAPh and PAPD isotherm model for cadmium ion adsorption a Langmuir and b Freundlich

Table 3 Isotherm parameters for cadmium adsorption by PAPh and PAPD according to the Langmuir and Freundlich isotherm models

The adsorption capabilities of synthesized PAPh and PAPD are compared to other polypyrroles, as shown in Table 4. Compared to other polymers that have been examined, PAP polymers are superior in terms of their adsorption capability [67, 72,73,74,75,76,77,78].

Table 4 The prepared polymers and various fabricated AC materials compare adsorption capacity

Adsorption kinetics

The pseudo-first-order model (PFO), the pseudo-second-order model (PSO), the intraparticle diffusion model, and the Weber–Morris model are typical kinetic models used to describe the adsorption processes. Adsorption is a multi-step process that begins with the movement of the adsorbate from the fluid bulk to the adsorbent surface, continues with the movement of the adsorbate within the porous adsorbent (internal diffusion), and finally, involves physical or chemical binding of the adsorbate to the adsorbent surface. Accordingly, the first three models postulate that the binding rate controls the total adsorption process rate, while the final two postulate that the mass transport rate controls the total process rate. One of these two assumptions has to be adopted, or more complex models that include the adsorption process are needed in some way. Alternatively, one could use one of these two assumptions. In the case of external diffusion, factors such as surface area, surface reactivity, and liquid layer thickness had a role; in the case of internal diffusion, factors such as surface reaction and pore shape impacted both diffusion and adsorption on the activated site [75]. A specific system controls film diffusion when there is poor mixing, low concentration, small adsorbent particle sizes, and a high affinity for the adsorbate. Intraparticle diffusion is used to control when there is good mixing, large adsorbent particle sizes, high adsorbate concentration, and a low affinity for the adsorbate [76, 77]. Determining and describing the mechanisms involved in metal adsorption processes and the key factors influencing adsorption kinetics will help expand our knowledge of the adsorption process. The PFO and PSO models are popular kinetic models many researchers use. The Lagergren PFO is valid during the initial phase of an adsorption process, in which the adsorption occurs by diffusion over the contact, and the kinetics often follow the PFO rate equation. Based on Lagergren's PFO equation, it is recognized by the adsorption Eq. (5) [78]:

$$\frac{{dq}_{t}}{{\text{dt}}}={K}_{1}\left({q}_{e}-{q}_{t}\right).$$
(5)

The following linear equation is obtained when this kinetic expression is integrated with the starting condition qt:

$${\text{log}}\left({q}_{e}-{q}_{t}\right)={\text{log}}\left({q}_{e}\right)-\frac{{K}_{1}}{2.303}t,$$
(6)

where qe and qt are the quantities of the amount adsorbed at equilibrium (e) and time t (mg g−1), and k1 is the equilibrium rate constant in the PFO model (L min−1). The linear graphs of log(qe−qt) with time (t) provide the value of k1.

The PSO provides predictions throughout the adsorption isotherm by assuming that chemical sorption or chemisorption is the rate-limiting phase. The adsorption rate under these circumstances is independent of adsorbate concentration and is proportional to adsorbent capacity. The following expression represents the PSO Eq. (7):

$$\frac{t}{{q}_{t}}=\frac{1}{{K}_{2} {{q}_{e}}^{2}}+\frac{t}{{q}_{e}}.$$
(7)

The PSO model's equilibrium rate constant is denoted by k2 (g mg−1 min−1). Table 5 approximates the parameters of the above-mentioned kinetic models based on the slope and intercept values. The R2 values of the PFO kinetic model (0.996 for PAPh, and 0.988 for PAPD) are greater than that of the PSO kinetic model (0.755 for PAPh, and 0.756 for PAPD), suggesting that the former provides a more accurate description of the reaction. The theoretical values of qe (PAPh 645.06 and PAPD 663.05 mg g−1) by the PFO kinetic model are closer to this experimental value of 600 mg g−1 than the PSO kinetic model (47.85 for PAPh and 50 for PAPD mg g−1), suggesting that the adsorption occurs primarily through diffusion across the interface. Adsorption at the solid–liquid interface involves transporting adsorbent to the material's perimeter and molecule diffusion via the liquid layer surrounding the absorbing particles. Adsorbed molecules diffuse into the adsorbent's intraparticle gaps and pores and then fix on its sites. Thus, one or both stages may control the whole procedure [79,80,81,82]. PFO assumes that sorption only occurs on localized sites, that the degree of occupation of locations for sorption is proportional to the total number of empty locations, and that sorbed ions do not interact, resulting in a single layer of adsorbates on the outside of the adsorbent. PSO model depicts the fast adsorption of divalent metal ions onto solid samples, resulting in inconsistencies between experimental and calculated results. We found that the PSO model's linearization includes inappropriate data due to the inability to capture kinetics and the initial adsorption period.

Table 5 Kinetic parameters for the adsorption of Cd2+ ions adsorption using PAPh and PAPD

Weber and Morris proposed the intraparticle diffusion model, which considers pore diffusion. It is the most used intraparticle diffusion equation for sorption systems. By plotting characteristic curves, one can obtain different initial adsorption factors (Ri), and then three zones of sorption can be determined, with Ri values ranging from 1 to 0. They identified three distinct stages of adsorption: (i) powerful, (ii) intermediate, and (iii) poor [83, 84]. The formula for the diffusion of intraparticle is as follows:

$${q}_{t}={K}_{i}{t}^{0.5}+C.$$
(8)

The intercept C is found by extending the straight line portion of the plot of qt against t0.5, and ki represents the intraparticle diffusion rate constant (mg g−1 min−0.5).

Figure 9c shows the relationship between adsorbate uptake and the square root of time (t0.5), which was determined using Eq. (8). Table 6 contains the values of the parameters that were calculated. Different theoretical frameworks provide different explanations for the intraparticle diffusion equation. A thicker boundary layer is represented by a bigger value of the arbitrary constant C, which denotes barrier layer thickness. Without boundary layers, when C = 0, the linear line should pass the origin [85]. Hence, intraparticle diffusion would continue to be the rate-controlling step during the whole adsorption kinetic process, and film diffusion could be disregarded because of no or significantly reduced thickness. According to several studies, the rate-limiting stage in most adsorption processes comprises intraparticle and film diffusion, as shown by the nonzero intercepts [86]. Additional research has shown intraparticle diffusion follows a three-step regression model with a horizontal line representing equilibrium in the macro, meso, and micropores. Researchers found three distinct linear phases in a different investigation: fast surface loading, pore diffusion, and horizontal equilibrium.

Fig. 9
figure 9

a Pseudo-first-order (PFO), b pseudo-second-order (PSO), and c, d Weber and Morris intraparticle diffusion model for Cd2+adsorpation using PAPh and PAPD as adsorbents

Table 6 Diffusion parameters for the Weber and Morris intraparticle model of Cd2+ ions adsorption using PAPh and PAPD

The intraparticle diffusion plots reveal a multi-linear sorption mechanism in this investigation, suggesting the presence of three functional stages (Fig. 9d). Diffusion of sorbate molecules over the boundary layer or from the solution to the sorbent's exterior surface (PAPh, PAPD) is responsible for the first, more distinct stage. While intraparticle diffusion is the rate-limiting mechanism in the second stage of the progressive sorption process, it begins to slow down in the third stage, which is linked to the ultimate equilibrium when sorbate concentration in the solution is exceedingly low [83].

The following equations are used to calculate the initial sorption behavior as follow [87]:

$${q}_{ref}={{K}_{iref}}^{0.5}+C,$$
(9)
$${R}_{i}=\left(\frac{{K}_{i}{{t}_{ref}}^{0.5}}{{q}_{ref}}\right).$$
(10)

Regarding the intraparticle diffusion model, the characteristics curve Ri may be obtained using the following equation []:

$${R}_{i}=1-\left(\frac{C}{{q}_{ref}}\right).$$
(11)

Concerning the initial fast adsorption associated with film diffusion, it was noted that PAPD had a lower Ki value than PAPh, suggesting a lower surface adsorption reaction with an active site, creating an electrostatic interaction between Cd2+ and PAPh's adsorption sites. Following the same pattern as the PSO model, the PAPh rapidly achieved equilibrium, whereas the PAPD took longer. An early sorption process of significant strength was seen where 0.5 > Ri > 0.1 and 0.5 < C/qref < 0.9, as indicated in analogous prior research [84].

Adsorption mechanism between polymers and Cd2+ metal ion

Mechanisms for Cd2+ adsorption on the synthesized polymers include surface complexation and Cd–π interaction. FT-IR spectra after Cd2+ adsorption were collected to identify the key functional groups of polymers responsible for the adsorption (Fig. 10 and Table 7). After adsorption, the peaks associated with some functional groups, those which contain oxygen C = O or nitrogen atoms C–N and C = C, either diminished or shifted to another wavenumber, suggesting that these groups play a role in the binding of Cd2+ ion through complexation. An additional mechanism for metal sorption by polymers was π–cation interaction. Since PAPD contains more aromatic rings than PAPh, It is evident that the cyclic aromatic system may function as the π-donor and that the electron-donating increased stronger with the increasing number of aromatic connected rings [88, 89]. Figure 10 shows the XRD analysis of the polymers with Cd ions adsorbed on them. Indicating that metal adsorption on the polymers' surface caused a new crystal peak to form at 2θ = 40 ͦ [90].

Fig. 10
figure 10

a, b Represent FT-IR. c and d are XRD before and after adsorption of Cd2+ metal. e Depiction of adsorption mechanism in polymers. f Regeneration cycle of PAPh and PAPD

Table 7 Comparison of the FT-IR spectrum properties of PAPh and PAPD before and after adsorption of Cd2+ ions

Recycling performance of functionalized pyrrole-based polymer

One popular and easy way to test an adsorbent's recycling ability in heavy metal ion removal is to use the desorbing solution technique [91, 92]. Sodium hydroxide (NaOH), sodium, and hydrochloric acid (HCl) are the typical desorbing agents used in this recycling process. Sodium hydroxide and hydrochloric acid in water are powerful complexing agents for metal ion desorption and have shown promising regeneration outcomes; nevertheless, their high cost makes them unattractive for use in recycling. Aqueous solutions of them are considered to be the most cost-effective and efficient desorbents for use in recycling processes. The polymer's adsorption properties were examined across four cycles of desorption testing utilizing 0.1M concentrations of sodium hydroxide (NaOH), sodium, and hydrochloric acid (HCl) to renew the adsorbent that was used. The results are shown in Fig. 10f. Cd2+ adsorption capacities decreased fast across the board as the regeneration cycles increased; PAPD was more efficient than PAPh in this regard. The adsorbent’s poor adsorption capability after regeneration is due to its inefficient regeneration sites. The adsorption efficiency for Cd2+ decreased after four reuse cycles, going from 94 to 84% for PAPD and 92% to 82% for PAPh; adsorption and desorption also did not change the adsorbent's mass much. Thus, polymers are reusable and possess a high adsorption capability for removing metal ions.

Conclusion

The Paal–Knorr reaction of PAK with hexylamine and 1,4- phenylene diamine resulted in the effective preparation of two novel polymers (PAPh and PAPD). Several analytical techniques validated structure completion, such as FT-IR spectroscopy, XRD, UV spectroscopy, and thermogravimetric (TGA) investigations, proved that PAP polymers could withstand high temperatures. SEM revealed a distinct morphology and microstructure, and according to BET’s specifications, the crosslinking reaction boosted PAPD’s specific surface area. Adsorption studies revealed that PAPh had a maximum adsorption capacity for Cd2+ of 55.86 mg g−1, and PAPD had a capacity of 86.95 mg g−1, indicating that the crosslinking ability effectively increased the PAPD’s adsorption capacity. It was discovered that increasing both the contact duration and the pH of the solution increased the amount of Cd2+ ions adsorbed. The number of Cd2+ ions adsorbed rises as the dosage of PAP polymers increases, and the adsorbent's chemical structure is related to the adsorbent's capacity and adsorption rate. Results from the experiments' pseudo-second-order kinetic (PSO) and Freundlich isotherm models match the data well for both materials. The above findings suggested that the produced polymers PAP may be useful adsorbents in Cd2+ adsorption from wastewater.