A polypyrrole-chitosan-calcium ferrite nanocomposite was prepared using the electrodeposition method. The prepared layer was characterized by using Fourier transform infrared spectroscopy, the X-ray diffraction technique, and field emission electron microscopy. The thickness of the thin layers was in the range of 2.8 nm to 59.5 nm, and the refractive index of the composite layer was in the range of 1.66131 + 0.156 i to 1.62734 + 0.167 i . Detection and removal of cationic and anionic dyes, such as methylene blue and methylene orange, are subject of great interest for protecting environmental water. The layer composite was used to detect methylene orange and methylene blue using the surface plasmon resonance technique. Consequently, the polypyrrole-chitosan-calcium-ferrite composite layer interacted with the anionic and cationic dyes. The resonance angle shift for the detection of the cationic dye was larger than the resonance angle shift for the anionic dye. The sensor limit was achieved from a sensogram at about 0.01 ppm.