Train lights
Trains include a variety of types of lights, for safety, illumination, and communicating train status. The most universal type of light is the headlight, which is included on the front of locomotives, and frequently on the rear as well. Other types of lights include classification lights, which indicate train direction and status, and ditch lights, which are a pair of lights positioned towards the bottom of a train to illuminate the tracks. History. The earliest trains did not run at night, but the need for running trains at night soon became apparent. In the United States, early records  of headlight usage date back to 1832: that year, Horatio Allen devised the first known locomotive headlight - though his "headlight" consisted of a burning pile of wood on a flatcar, followed by a giant reflector on a second flatcar, pushed by a locomotive. While this method of illumination was impractical, other experimentation continued. One early method was to hang a number of lanterns off the front of a locomotive. In the later 1830s, the first proper train headlight was built by two mechanics in New York, a box made of sheet metal and incorporating a reflector. Mass production of locomotive  headlights was started in 1838 in that state, and by 1850 they were a common sight on trains in the United States. By the dawn of the American Civil War, nearly every locomotive in the country was equipped with a headlight. Despite experiments and advances in headlight technology in the 1800s, the very idea of using headlights on trains was for a long time controversial. As late as 1886, a railroad official in the United States was quoted as saying "On a road engine the headlight is of no earthly use to the engineer; it obstructs his vision so that  he cannot see his switch lights, and I think that every thinking engineer will come to the conclusion that he would rather run in the night without a lamp, than with it, as he can see better in the dark". Early headlights were fueled by oil, though kerosene-fueled headlights were developed as well in the 1850s. The discovery of electricity soon led to experiments with using it to power locomotive lights, with the first-known example, a battery operated light, being tested in Russia in 1874. In 1883, a railroad company in France also experimented with electrical lights , but the first example to go into production was designed by an American inventor in 1897. In 1915, the United States Congress passed a law mandating every train be equipped with an electric headlight, ending all debate about their utility. Despite the widespread use of locomotive headlights in North America, in the United Kingdom trains typically ran without headlights at night during the 19th century. Twin-sealed beam headlights were also invented after the end of World War II, and they were designed in a way where two lightbulbs are installed in one headlamp. Types. Classification lights. Also known as  marker lights, these are used to provide information on the type and status of a train. Traditionally, classification lights existed in three colors: white lights indicated an "extra" train (a train that is not scheduled but added due to demand), green lights were displayed on a regularly scheduled train that was being followed by additional sections (extra train(s)), and red lights indicated the rear of a train. In the 21st century, the first two types of classification lights are seldom used, but several railroad companies continue the use of red marker lights to indicate the rear of a train. This  is particularly used when locomotives are pushing a train from the rear - seeing red marker lights indicates that the train is moving away from the viewer, not towards them. Emergency lights. These lights activate when a train makes an emergency brake application. Emergency lights are usually red, and often flash. Ditch lights. Ditch lights, also known as auxiliary lights, are additional lights at the front and sometimes rear of a locomotive or cab car that are positioned closer to the track than normal headlights. They are used to make trains easier to spot, for safety. Many ditch lights are also  designed to flash when a train sounds its horn, for additional visibility. They are mandated by law in several countries, including Australia and the United States. Strobe lights. On remote control locomotives, a strobe light is often used to indicate the locomotive is not occupied. Strobe lights are also used on normal locomotives as a means of making the train more visible. Door indicator lights. On passenger railroad cars, there are often indicator lights above each external door that light up when the door is open. These allow the train crew to make sure a train does not leave a  station until all doors are closed, for passenger safety. In newer trains, they also flash when the door closes.