This document describes a solar-powered automatic railway gate control system that uses sensors and a microcontroller to safely operate railway crossing gates. The system includes six obstacle sensors to detect arriving and departing trains. When the first sensor detects a train, the microcontroller signals the gate motor driver to close the gate. When the train passes the second sensor, the gate reopens. This automatic system is designed to prevent accidents at unmanned railway crossings by properly controlling gate operation based on train movement. The goal is to increase safety for both train and road users through an efficient method that replaces human gate operators.