Unveiling the potential of a functionalized pyrrole-based polymer for efficient cadmium ion removal from wastewater: synthesis, characterization, and performance evaluation

Cadmium ion Cd 2+ contamination is a major environmental issue caused by industry. Polyarylidene N‑hexane pyrrole (PAP h ) and crosslinked polyarylidene N‑phenyl pyrrole (PAP D ) were prepared from the previously synthesized polymer (polyarylidene ketone (PAK)) by using the advantage of repeating carbonyl groups at the 1,4 position and reacting it with hexylamine and P‑phenylenediamine via the Paal–Knorr reaction. Various methods were used to characterize polymers, such as FT‑IR spectroscopy, X‑ray diffraction (XRD), thermogravimetry analysis (TGA), UV–visible spectros‑ copy, scanning electron microscope (SEM), zeta potential, and surface area measurements (BET), revealing success‑ ful fabrication, good thermostability, and well‑defined microporous structures useful for Cd 2+ adsorption. Optimal adsorption capacities of 55.8 mg g −1 for PAP h and 86.95 mg g −1 for PAP D indicate a significant enhancement in Cd 2+ adsorption via their microporous structures, Cd 2+ adsorption was also investigated in terms of contact time, initial concentration, and pH. A total input concentration of 30 ppm Cd ions, may yield an 84.3% removal rate for PAP h and an 89.2% removal rate for PAP D . The experimental results were well‑fit by many models, including pseudo‑sec‑ ond‑order kinetics (PSO), Freundlich isotherms, intraparticle diffusion, and Langmuir. The varying adsorption per‑ formances of the two polymers studied, (PAP h ) and (PAP D ), were found to be derived from their respective chemical structures, which include various functional groups, according to studies conducted on Cd 2+ in an aqueous solution. Cd 2+ adsorption on polymers was considered physisorption; π –cation interactions and surface complexation played significant roles in adsorption. The PAP polymers may be considered promising substitutes and innovative adsorbents to remove Cd 2+ ions from a water solution.


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 (Cd 2+ ) 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 (Cd 2+ ) 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.

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 Cd 2+ 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.60s.The samples are heated at 10 °C/min in an N 2 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 N 2 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.
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 (PAP h , PAP D , 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 PAP h and 1167 cm −1 and 1365 cm −1 for PAP D .The stretching vibration of the aliphatic hexyl chain appears more clearly in the PAP h spectrum than in the PAK or PAP D spectra.The spectrum of PAP h 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 PAP D 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].
Additionally, the PAP D spectrum shows a lower stretching vibration of the aliphatic chain than the PAK or PAP h spectra, indicating that the polymer backbone is more aromatic than PAK.C = O stretching in the FT-IR spectra of PAP h and PAP D is seen at 1691 cm −1 and 1699 cm −1 , respectively.That peak is due to the conjugation of a nonreactant 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 PAP h , the hexyl chain has an electron-donating action that would increase the electron density on the N and make cyclization easier.According to PAP D , 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 PAP h has 42.8% crystallinity and PAP D Scheme 1 Synthesis of PAK, PAP h , and PAP D Fig. 1 FT-IR spectra of PAK, PAP h, and PAP D has 39.3% crystallinity.In PAP h , 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 PAP D 's flexibility and mobility, affecting the physical characteristics of polymeric materials and increasing the proportion of amorphous areas in the polymer.
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 PAP h , and 305 °C for PAP D ).The PAK polymer is more stable and yields higher char than the modified polymers.PAP D 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 PAP D 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 PAP h 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.
As shown in Fig. 3, microstructural analyses of produced polymers provide further evidence that the chain reaction has succeeded.Compared to PAK, PAP h 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 PAP D , the spherical particles aggregate into stacked blocks with unequal shapes and a rough surface by further smoothing and linking the particles [50,51].PAP D '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 PAP h 's structure, which lacks this crosslinking.The results showed that pyrrole rings were synthesized along PAK chains [51].
The development of pyrrole rings throughout the PAK chain was investigated using UV-visible spectroscopy, with absorbance recorded for a partially soluble solution of PAP h , PAP D (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, PAP h 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 PAP D 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 (PAP h 4.1 eV, PAP D 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].
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), PAP h (0.120, 0.248), and PAP D (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 PAP D makes this interaction particularly strong [57].The colour change indicates pyrrole ring development along PAK chains.
Figure 5 and Table 2 provide N 2 adsorption-desorption isotherms and pore size distribution curves for The polymers' pore sizes also altered, increased in PAP h at 1.83 nm and shrank in PAP D 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.PAP h 's improved specific surface area to PAP D 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].
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 PAP h adsorbed ions more strongly than PAP D and PAK at low pH, suggesting that PAP h possesses a considerable positive zeta potential

Determination of optimum pH, polymer dose, and initial ion concentration:
The effectiveness of the produced polymers in removing Cd 2+ 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 Cd 2+ solution was monitored using a pH meter.CdCl 2. 2H 2 O was dissolved in purified water to produce Cd 2+ ionloaded 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 PAP h and PAP D in powder form to the flasks containing Cd 2+ 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): In this equation, V represents the volume of the solution, W represents the weight of PAP h and PAP D , C 0 is the starting concentration of cadmium ions in the solution, and C e is the equilibrium concentration.For approximately 1 h, 5 ml aliquots of the solution were collected, and the remaining concentration of Cd 2+ ions was determined by atomic absorption analysis.The amount of Cd 2+ adsorbed by polymer molecules during a certain exposure period, q t (mg g −1 ), was calculated as follows [66]: The notation referred as: C i = initial Cd 2+ concentration (mg l −1 ), C t = 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 Cd 2+ concentration.The influence of contact time between ( 1) polymers and metal ion solution at a pH of the solution was investigated by measuring the absorption of adsorbate (Cd 2+ ) per mass of adsorbent across contact durations t (q t ) 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 PAP D is larger than that achieved by the PAP h by roughly 10%.PAP D showed around 90.2% effectiveness in adsorbing metal ions at equilibrium, making it the most effective adsorbent.The increased performance in PAP D adsorption results from the larger available surface area.
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 PAP D , while the removal efficiency for PAP h 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 (H 3 O + ) competing with Cd 2+ 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 PAP D is higher than that of PAP h at all pH levels except for pH levels (after 2.5 to 4).The results agree with zeta measurements of increased stacking in PAP D , 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 Cd 2+ 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 PAP h is about 90% and around 97% for PAP D , as in solutions with a pH greater than 7, cadmium ions precipitate as cadmium hydroxides [67].
For detecting the optimal PAP h and PAP D 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 PAP h and 89.2% for PAP D 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 PAP h and PAP D , 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): The equilibrium cadmium ion concentration (C e , in ppm), the quantity of Cd 2+ adsorbed per unit mass of polymers (q e , mg g −1 ), the adsorption capacity (q m , mg g −1 ), and the adsorption equilibrium constant (K l , L mg −1 ).Non-ideal sorption on heterogeneous surfaces is assumed in the Freundlich model, which may be stated in this way (4): K f 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 (q max , K l , K f , 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 Cd 2+ to PAP D in this investigation, while the Langmuir model fits better with the PAP h data, and PAP D was shown to have a higher sorption capacity than PAP h . (3) The agreement is probably because a monolayer forms on the PAP h 's surface, and intermolecular forces diminish as Cd 2+ ions move away from the adsorption site.Additionally, the adsorbent surface is probably more uniform than PAP D and comprised adsorption sites that have the same energy potential [68].Larger values of n for PAP D than PAP h (lower values of 1/n) validate the high heterogeneity of the PAP D adsorbent and suggest a greater interaction between the adsorbent and the adsorbate.Two polymers have n values (7.16 for PAP h , 7.11 for PAP D ) that point to adsorption heterogeneity on the surface [69][70][71].
The adsorption capabilities of synthesized PAP h and PAP D 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].  3 Isotherm parameters for cadmium adsorption by PAP h and PAP D according to the Langmuir and Freundlich isotherm models

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]: The following linear equation is obtained when this kinetic expression is integrated with the starting condition q t : where q e and q t are the quantities of the amount adsorbed at equilibrium (e) and time t (mg g −1 ), and k 1 is the equilibrium rate constant in the PFO model (L min −1 ).The linear graphs of log(q e− q t ) with time (t) provide the value of k 1 .
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): The PSO model's equilibrium rate constant is denoted by k 2 (g mg −1 min −1 ).Table 5 approximates the parameters of the above-mentioned kinetic models based on the slope and intercept values.The R 2 values of the PFO kinetic model (0.996 for PAP h , and 0.988 for PAP D ) are greater than that of the PSO kinetic model (0.755 for PAP h , and 0.756 for PAP D ), suggesting that the former provides a more accurate description of the reaction.The theoretical values of q e (PAP h 645.06 and PAP D 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 PAP h and 50 for PAP D 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 (5) dq t dt = K 1 (q e − q t ).
(6) log(q e − q t ) = log(q e ) − K 1 2.303 t, Table 5 Kinetic parameters for the adsorption of Cd 2+ ions adsorption using PAP h and PAP D

Pseudo-first-order (PFO) Pseudo-second-order (PSO)
PAP h q e(cal) q e(exp ) mg g −1 mg g −1 K 1 L min −1 q e(cal) q e(exp ) mg g −1 mg g 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.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 (R i ), and then three zones of sorption can be determined, with R i 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: The intercept C is found by extending the straight line portion of the plot of q t against t 0.5 , and k i 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 (t 0.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 (8) q t = K i t 0.5 + C. 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.
The intraparticle diffusion plots reveal a multi-linear sorption mechanism in this investigation, suggesting the presence of three functional stages (Fig. 9d).Diffusion of  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]: Regarding the intraparticle diffusion model, the characteristics curve R i may be obtained using the following equation []: Concerning the initial fast adsorption associated with film diffusion, it was noted that PAP D had a lower K i value than PAP h , suggesting a lower surface adsorption reaction with an active site, creating an electrostatic interaction between Cd 2+ and PAP h 's adsorption sites.Following the same pattern as the PSO model, the PAP h rapidly achieved equilibrium, whereas the PAP D took longer.An early sorption process of significant strength was seen where 0.5 > R i > 0.1 and 0.5 < C/q ref < 0.9, as indicated in analogous prior research [84].

Adsorption mechanism between polymers and Cd 2+ metal ion
Mechanisms for Cd 2+ adsorption on the synthesized polymers include surface complexation and Cd-π interaction.FT-IR spectra after Cd 2+ 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 Cd 2+ ion through complexation.An additional mechanism for metal sorption by polymers was π-cation interaction.Since PAP D contains more aromatic rings than PAP h , 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 (9)  (11) adsorbed on them.Indicating that metal adsorption on the polymers' surface caused a new crystal peak to form at 2θ = 40 ͦ [90].

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.Cd 2+ adsorption capacities decreased fast across the board as the regeneration cycles increased; PAP D was more efficient than PAP h in this regard.The adsorbent's poor adsorption capability after regeneration is due to its inefficient regeneration sites.The adsorption efficiency for Cd 2+ decreased after four reuse cycles, going from 94 to 84% for PAP D and 92% to 82% for PAP h ; 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 (PAP h and PAP D ).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 PAP D 's specific surface area.Adsorption studies revealed that PAP h had a maximum adsorption capacity for Cd 2+ of 55.86 mg g −1 , and PAP D had a capacity of 86.95 mg g −1 , indicating that the crosslinking ability effectively increased the PAP D 's adsorption capacity.It was discovered that increasing both the contact duration and the pH of the solution increased the amount of Cd 2+ ions adsorbed.The number of Cd 2+ 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 Cd 2+ adsorption from wastewater.

Fig. 2 a
Fig. 2 a XRD graphs, b TGA curves of PAK, PAP h, and PAP D

Fig. 6
Fig. 6 Plots of zeta potential vs. pH showing the position of the isoelectric point of PAK, PAP h , and PAP D

Fig. 8
Fig. 8 The PAP h and PAP D isotherm model for cadmium ion adsorption a Langmuir and b Freundlich

Fig. 9 a
Fig. 9 a Pseudo-first-order (PFO), b pseudo-second-order (PSO), and c, d Weber and Morris intraparticle diffusion model for Cd 2+ adsorpation using PAP h and PAP D as adsorbents

Fig. 10 a
Fig. 10 a, b Represent FT-IR.c and d are XRD before and after adsorption of Cd 2+ metal.e Depiction of adsorption mechanism in polymers.f Regeneration cycle of PAP h and PAP D

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

Table 2
The surface area data for the prepared polymers

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

Table 6
Diffusion parameters for the Weber and Morris intraparticle model of Cd 2+ ions adsorption using PAP h and PAP D

Table 7
Comparison of the FT-IR spectrum properties of PAP h and PAP D before and after adsorption of Cd 2+ ions