The first self-propelling steam locomotive makes its outing at the Pen-y-Darren Ironworks in Wales.

Penydarren Ironworks was the fourth of the great ironworks established at Merthyr Tydfil in South Wales.

Built in 1784 by the brothers Samuel Homfray, Jeremiah Homfray, and Thomas Homfray, all sons of Francis Homfray of Stourbridge. Their father, Francis, for a time managed a nail warehouse there for Ambrose Crowley. Most of the family were involved in trade as ironmasters or ironmongers (in this context meaning a manufacturer of iron goods). Samuel built Penydarren House on the opposite bank of the River Taf, as a home for the family locally.

Because the owners of the Cyfarthfa Ironworks dominated the management of Glamorganshire Canal, the other Merthyr Tydfil ironworks built a tramroad to Abercynon, bypassing the upper sections of the canal. This "Penydarren Tramroad" (more correctly, the Merthyr Tramroad) was used for a trial of the first railway steam locomotive, built by Richard Trevithick. This successfully hauled wagons but was so heavy that it broke many rails. The engine was then used for other purposes as a stationary engine.

The business was financed by William Forman of the Tower of London, who provided all the capital, partly on mortgage but taking a share in it himself. Samuel Homfray left the business in 1813. In 1819, the partners were William Forman and William Thompson of London. William Forman offered the works for sale in 1859, and the Dowlais Iron Company bought the mineral ground. The works were used intermittently by various others until 1883. Some remains of the works can still be seen.

A steam locomotive is a rail vehicle that provides the force to move itself and other vehicles by means of the expansion of steam.: 80  It is fuelled by burning combustible material (usually coal, oil or, rarely, wood) to heat water in the locomotive's boiler to the point when it becomes gaseous and its volume increases 1,700 times. Functionally, it is a steam engine on wheels.

In most locomotives, the steam is admitted alternately to each end of its cylinders, in which pistons are mechanically connected to the locomotive's main wheels. Fuel and water supplies are usually carried with the locomotive, either on the locomotive itself or in a tender coupled to it. Variations in this general design include electrically-powered boilers, turbines in place of pistons, and using steam generated externally.

Steam locomotives were first developed in the United Kingdom during the early 19th century and used for railway transport until the middle of the 20th century. Richard Trevithick built the first steam locomotive known to have hauled a load over a distance at Pen-y-darren in 1804, although he produced an earlier locomotive for trial at Coalbrookdale in 1802. Salamanca, built in 1812 by Matthew Murray for the Middleton Railway, was the first commercially successful steam locomotive. Locomotion No. 1, built by George Stephenson and his son Robert’s company Robert Stephenson and Company, was the first steam locomotive to haul passengers on a public railway, the Stockton and Darlington Railway, in 1825. Rapid development ensued; in 1830 George Stephenson opened the first public inter-city railway, the Liverpool and Manchester Railway, after the success of Rocket at the 1829 Rainhill Trials had proved that steam locomotives could perform such duties. Robert Stephenson and Company was the pre-eminent builder of steam locomotives in the first decades of steam for railways in the United Kingdom, the United States, and much of Europe.Towards the end of the steam era, a longstanding British emphasis on speed culminated in a record, still unbroken, of 126 miles per hour (203 kilometres per hour) by LNER Class A4 4468 Mallard. In the United States, larger loading gauges allowed the development of very large, heavy locomotives such as the Union Pacific Big Boy, which weighed 540 long tons (550 t; 600 short tons) and had a tractive effort of 135,375 pounds-force (602,180 newtons).From the early 1900s, steam locomotives were gradually superseded by electric and diesel locomotives, with railways fully converting to electric and diesel power beginning in the late 1930s. The majority of steam locomotives were retired from regular service by the 1980s, although several continue to run on tourist and heritage lines.