This document describes an automatic gate control system for railway crossings using a PIC controller and IR transmitters and receivers. The IR sensors placed on either side of the tracks will detect approaching trains and send signals to the PIC controller to open or close the gate as needed. When a train is detected, the gate will close to prevent accidents, and will re-open once the train has passed and the IR sensors on the other side detect clear tracks again. The system aims to operate gates safely without human intervention to avoid accidents at unmanned crossings.