Bangladesh’s railway system mostly uses typical manual railway crossing techniques or boom gates through its 2955.53 km rail route all over the country. Accidents frequently happen at railway crossings due to the lack of quickly operating gate systems, and to fewer safety measures at the railway crossing as well. Currently, there are very few automatic railway crossing systems available (without obstacle detectors). Additionally, 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 generating enough power for 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 at railway crossing points. We use two infrared (IR) sensors to operate the railway crossing systems, which are controlled by an Arduino Uno. This newly designed level crossing system is run with the help of sustainable renewable energy, which is cost-effective and eco-friendly, and applied 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 the results of several renewable energy sources, including a hybrid system, and optimized the Levelized Cost of Energy (LCOE) and the payback periods.