The aim of this paper is to automate various operations related to opening and closing of railway gates in order to minimize the accidents at unmanned railway gates. This automatic system also identifies the person who is unnecessarily pulling the chains and alerts the station master about the position of train using GSM technique. It also identifies unwanted obstruction in the track by anti-collision technique and detects the breakage in track. This automatic railway system reduces the waiting time of road passengers at the railway crossings since it will identify the arrival of the train and there by closing the gate when needed.