A steam locomotive is a steam powered railway locomotive. It was used a lot between about 1830 and 1970. Afterwards, diesel and electric locomotives were used more often. The first steam locomotive was made by Richard Trevithick for a railway used for moving iron at an Ironworks in Wales. A steam locomotive works by burning a fuel like coal in a special space called a firebox. This produces hot gases that rise and go through tubes in a boiler - a large space with water in it. This heats the water, producing steam. The steam is then taken through another tube to a cylinder. The steam then pushes the piston which in turn pushes a metal rod that is connected to the wheels, making the locomotive move. The steam then rises out through the chimney.