Detonator (railway)

A railway detonator (torpedo in North America) is a coin-sized device that is used as a loud warning signal to train drivers. It is placed on the top of the rail, usually secured with two lead straps, one on each side. When the wheel of the train passes over, it explodes, emitting a loud bang. It was invented in 1841 by English inventor Edward Alfred Cowper.
Uses.
Typical uses of detonators include:
On a high-speed line, detonators may need to be placed on both rails.
As with all explosives, detonators can become unstable over time and must, therefore, be replaced regularly.
They are triggered by pressure, rather than impact. This makes them safe during transport, as they normally cannot detonate in a bag or storage container. 
In the United States.
Upon hearing the noise of a torpedo exploding, the engineer reduces speed to 20 mph or less, not resuming its original speed until at least two miles beyond where it encountered the device. They were traditionally used in pairs to ensure that the sound registered with train crews. Torpedoes are essentially obsolete in the U.S. as soundproof construction of modern locomotive cabs renders them useless.
Quoting from the terminology book of the Brotherhood of Railroad Signalmen:
A torpedo is a device which is strapped to the top of a rail. When a train drives over the torpedo, it emits a very loud "bang" which can be heard over the noise of the engine, and signals the engineer to stop immediately. Torpedoes are generally placed by the flagman when protecting a train ahead.
Torpedoes are about 2" × 2", red in color, about 3/4" high, and have two lead straps attached, which hold it to the rail. The torpedo has discs inside and are filled with detonating powder. The torpedo was invented about 1874.
In the United Kingdom.
Defined by the Rule Book, when protecting a line for whatever reason (failed train, obstruction fouling the running lines), three detonators must be placed 20 yards apart. These signal an emergency stop to the driver. Detonators are also used to protect engineering works where the line remains open. The controller of the possession will communicate with the operative with the detonators as to when to place them on the track, or lift them to allow a train through.
In Germany.
Detonators were used where hazards had to be secured and there was no time for other signaling or if there was a danger that another signal might not be recognizable in time, for example due to fog or snow. To give the emergency signal, three detonators were placed in short succession, with the explosion of a single detonator being a stop signal. Since 1986 detonators have no longer been used on German railways. Only the ICE 3 trains that travel to France still have detonators on board because of French regulations.
In Taiwan.
The use of detonators has been superseded by radio communications since the early 1950s. In November 2010, the Taiwan Railway Administration deployed 800 detonators for destruction on maintenance tracks. It received media attention, emitting sounds similar to the culturally significant firecrackers.
In Australia.
Today known as audible track warning signals, or audible track warning devices, detonators are used to attract the attention of train crews when track repairs or an obstruction are ahead, or when a hand signaller is acting for a signal.
In Tanzania.
Detonators are used to attract the attention of train crews in case of:
Detonator placer.
Many mechanical signal boxes in the UK were equipped with detonator placers that placed detonators on a running line when a lever was operated. The levers were painted a striking white and black chevron pattern, pointing upwards for the "up" line, downwards for the "down" line. In some cases, the placers were fed from a cartridge holding a number of detonators.
Composition.
According to "Military and Civilian Pyrotechnics" by Ellern, page 376, FORMULA 155 – Railroad Torpedo, is by mass:
Garratt locomotives.
The length of Garratt locomotives made the sound of a detonator hard to hear, so New South Wales 60 class locomotive had "sound pipes" to bring the noise of the explosion to the crew.