The utilization of optical directional couplers has emerged as a viable alternative to conventional systems for the execution of error detection using optical signals. The proposed circuit efficiently converts 4-bit binary input signals to gray code representation in the optical domain, reducing errors during transmission and computation. An even/odd parity checker module is also included in the circuit, which improves data integrity and detects single-bit errors in transmitted data. The theoretical basis for the electro-optic effect and its use in directional couplers (EODC) for optical signal transmission inside the proposed circuit. The framework for sophisticated efficient photonic circuit designs with improved error detection and correction capabilities is laid by using EODC, which simplify design and enable seamless integration with existing optical communication technologies. The proposed device layout is made of \(GaAlAs\) material produced from a \(3\mu m\times 3um\) modulator. The coupling length \({(L}_{C})\) of the device is set to \({L}_{C}=1\text{ cm}\). The EODC performs perfect switching with a light wavelength of \(900\text{ nm}\) by creating a refractive index change \((\Delta n)\) of approximately \(\Delta n\cong 1\times {10}^{-4}\). An electric field magnitude of approximately \(3\times {10}^{4}\text{ V}/\text{cm}\) is required to achieve this switching, which corresponds to a voltage of 10 V applied across the electrodes of an EODC over a \(3 \mu \text{m}\) channel.