Bangladesh's railway system mostly uses typical manual railway crossing technique or boom gates through its 2,955.53 km rail route all over the country. The accidents are frequently happening in the railway crossings due to not having obstacle detectable and quickly operating gate systems, and also for fewer safety measures in the railway crossing. Currently, there are very few automatic railway crossing systems (without obstacle detectors) available, however, all of them are dependent on the national power grid without a backup plan for any emergency cases. Bangladesh is still running a bit behind in the power generation of its consumption, hence it is not possible to have a continuous power supply at all times all over the countryside. We aim to design and develop a smart railway crossing system with an obstacle detector to prevent common types of accidents in the railway crossing points. We design to use two infrared (IR) sensors to operate the railway crossing systems which will be controlled by the Arduino Uno. This newly designed level crossing system will be run with the help of sustainable renewable energy which is cost-effective, eco-friendly, and apply under the national green energy policy towards achieving sustainable development in Bangladesh as a part of the global sustainable goal to face climate change challenges. We have summarized the simulated results of several renewable energy sources including a hybrid system and optimized the Levelized Cost of Energy (LCOE), and the payback periods.