Abstract:As factory railway crossings existing safety problems, designs a warning system at the railway crossings. The system uses micro-PLC controlling technology, which consisting of infrared detector, micro PLC and an alarm, and is able to detect automatically the moving direction and precise location of trains and to warn with light and sound, providing safety for the vehicles and pedestrians. The actual operating experiments prove that the system has advantages of mature technique, reliable running performance and a precise alarm.