An automatic railway gate control system is designed to prevent accidents at unattended railway crossings. It uses two pairs of infrared transmitter-receivers placed on either side of the railway crossing. When a train is detected by a receiver, a buzzer sounds for five seconds and the gates close using a DC motor. The gates reopen once the train has passed through the second receiver pair. An 8051 microcontroller and L293 motor driver circuitry are used to automate the opening and closing of the gates based on the infrared sensor signals.