A railway detonator (torpedo in North America) is a coin-sized device that is used to make a loud sound as a 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. 
Typical uses of detonators include
- a warning, caution or stop signal in dense fog, when signals are difficult to see;
- a warning of a train stopped on the line ahead by an incident or accident — the train crew are usually responsible for placing the detonators;
- a warning of ongoing engineering works ahead; or
- when a signaller or other railway employee requires to stop approaching trains in an emergency.
- to alert crews working on the rails if a silent, runaway train or train carriage is approaching.
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. Detonating them by striking with a hammer does work. An incident involving the explosion of detonators in the cab of an Irish train in March 2012 is currently under investigation. 
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" x 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.
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.
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.
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.
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.
According to Military and Civilian Pyrotechnics by Ellern, page 368, the formula for railroad torpedoes is, by mass:
- "Minutes of Proceedings of the Institution of Civil Engineers, Volume 1".
- "Boy badly injured after hitting train detonator with hammer: reports". The Sydney Morning Herald. July 2, 2012. Retrieved May 2014.
- "TA20 – ARTC Code of Practice for the Victorian Main Line Network". artc.com.au. August 2011. Retrieved 20 November 2011.
- BRS 72 - Brotherhood of Railroad Signalmen - Railroad Terminology, Slang, Definitions, quoted with permission.
|Wikimedia Commons has media related to Railway detonators.|
- Detonator use images - Dead Link (HTTP 404)