## 3 Results and Discussion  
Figure 2 shows the FT-IR spectrum, XRD analysis result, and FE-SEM image. Figure 2a shows the FT-IR spectrum; the main peaks of the FT-IR spectrum appeared at 3257.85, 2930.02, 1630.1, 1525.39, 1428.81, 1283.03, 1021.22, 964.53, 673.36, and 617.05 cm\({}^{-1}\). The peaks at 3257.85, 1525.39, and 1428.81 cm\({}^{-1}\) related to the stretching vibrations of N-H, C-N, and C-C in the pyrrole ring, respectively [27,28]. The peak centered at 2930.02 cm\({}^{-1}\) corresponded to the asymmetric vibration of CH\({}_{2}\), and the peaks that appeared at 1283.03, 1021.22, and 964.53 cm\({}^{-1}\) were assigned to the C-H deformation, C-O-C, and the C-N stretching vibration of PPy, respectively. Moreover, the peaks located at 3257.85 and 2930.02 cm\({}^{-1}\) corresponded to N-H, while the vibration of CH\({}_{2}\) of the chitosan chain overlapped on the vibration of N=H and CH\({}_{2}\) in polypyrrole [28]. The peaks at 1630.1, 673.36, and 617.05 cm\({}^{-1}\) presented a vibration of C=O in the amid band, N-H out of the plane, and O-H out of the plane in chitosan [29]. Figure 2: (**a**) The Fourier transform infrared spectroscopy (FT-IR) spectrum, (**b**) XRD result, and (**c**) FE-SEM image. Figure 2b shows the XRD spectrum of the PPy-Chi-BaFe\({}_{2}\)O\({}_{4}\) nanocomposite layer. Following the literature, the XRD spectrum of PPy-Chi appears at 21.4\({}^{\circ}\)[29], which explains the PPy-Chi that formed in the amorphous form in the thin layer. The main peak of the XRD spectrum for BaFe\({}_{2}\)O\({}_{4}\) appeared at 23.3\({}^{\circ}\), 24.4\({}^{\circ}\), 34.23\({}^{\circ}\), 37.1\({}^{\circ}\), 39.5\({}^{\circ}\), 45.2\({}^{\circ}\), 48.1\({}^{\circ}\), and 59.7\({}^{\circ}\), which related to reflection plane of (110), (200), (112), (202), (420), (104), (202), and (120), respectively. They confirm that BaFe\({}_{2}\)O\({}_{4}\) has a face-centered cubic structure [30]. The XRD pattern of PPy-Chi-BaFe\({}_{2}\)O\({}_{4}\) confirms that the BaFe\({}_{2}\)O\({}_{4}\) also formed in the composite layer in the cubic structure. During the electrodeposition process, monomer molecules and metal ions at the electrode-electrolyte interface deposited on the surface of the working electrode by reaching the proper applied potential, and the mechanism is as follows [28]:  
\[\text{Chi}-\text{Py}^{+}+\text{Ba}^{+}+\text{e}^{-}(\text{applied potential})\rightarrow\text{Chi}-\text{PPy}-\text{Ba} \tag{1}\]  
Figure 2 shows the FE-SEM image of the PPy-Chi-BaFe\({}_{2}\)O\({}_{4}\) nanocomposite layer. The PPy-Chi-BaFe\({}_{2}\)O\({}_{4}\) composite layer was formed during electro-polymerization of pyrrole in the presence of chitosan, LiClO\({}_{4}\) (as a dopant), and BaFe\({}_{2}\)O\({}_{4}\) nanoparticles, and the chitosan agglomerated the polypyrrole and BaFe\({}_{2}\)O\({}_{4}\) nanoparticles during the electro-polymerization of pyrrole. Finally, the PPy-Chi-BaFe\({}_{2}\)O\({}_{4}\) composite layer was formed on the surface of the gold layer [16]. BaFe\({}_{2}\)O\({}_{4}\) nanoparticles (NPs) were scattered on the surface of layer, and it impressed the morphology of the PPy-Chi-BaFe\({}_{2}\)O\({}_{4}\) nanocomposite layer [31]. The essential charges for organizing the PPy were the electrons and anions that LiClO\({}_{4}\) and BaFe\({}_{2}\)O\({}_{4}\) provided them. Therefore, the role of LiClO\({}_{4}\) and BaFe\({}_{2}\)O\({}_{4}\) were as the electron and anions charges to create the counterbalance of the PPy-Chi-BaFe\({}_{2}\)O\({}_{4}\) composite layer. Hence, the polymer electropolymer at the surface of the working electrode, containing BaFe\({}_{2}\)O\({}_{4}\) nanoparticles [32]. The gold/PPy-Chi-BaFe\({}_{2}\)O\({}_{4}\) system layer was prepared in different thickness. The thickness of the gold layer was 48.3 nm, and the thickness of the PPy-Chi-BaFe\({}_{2}\)O\({}_{4}\) composite layers was tested using a profilometer (AMBIOS, XP-200) in the range of 3 \(\pm\) 1 nm to 94 \(\pm\) 1 nm, and Figure 3a shows that the thickness of the layers increased as the cycle increases.