Detector Rail

Detector Rails are a type of rail that acts like a pressure plate, and the first rail switch.

When any kind of Minecart is on top of the Detector Rail, it will generate a redstone signal. The signal will be transmitted to blocks that are adjacent to the detector (including Powered Rail) and redstone placed under the rail, like pressure plates.

Crafting
Detector rails are crafted as normal rails, but with a pressure plate instead of a stick, and the addition of redstone.

Uses
Detector rails can be used for many things. One train station-like feature could be activating a note block to indicate that a minecart is approaching.

Detector rails can be used with a memory cell to power powered rails for long tracks.

Additionally, they can be used to create a one-way gate to a Powered Rail, with any carts coming the other way slowing down if not stopping completely.

They also can be used to activate arrow shooters to create a minecart-friendly mob trap.

A trap based on the land mine trap can be built with powered rails as a stand in for a regular pressure plate, then placing it in a rail system to kill the occupants of minecarts. If water is beneath the TNT, the explosion usually won't destroy the pressure detector rail and can't destroy the mine cart. Because the mine cart absorbs the blast, a detector rail trap won't usually be lethal to anyone outside the cart or a few blocks away. There is a chance that the minecart will bump the TNT and prevent it from falling straight down and not touch the water and therefore destroy blocks when it explodes. It is also possible for a very fast moving mine-cart to skip over the pit the TNT makes as it falls, thereby evading danger.

as of 1.6.6 detector and powered rails cannot be placed above TNT (along with redstone),

As a defense mechanism in multi-player or for your own challenge, you can make a rectangle using powered rails, regular rails, and detector rails. Then, make a box around it with glass (except the floor). At every detector rail have a redstone rail leading to a dispenser filled with arrows. When you begin the movement of the mine carts they'll pass over the detector, firing the arrows in a constant pattern until you run out of ammo. It is also good for speed killing by filling a hole with mobs and slaughtering the mobs inside; you can get a lot of resources this way.

Bugs

 * Occasionally placing a detector rail will power other rails without needing a minecart on it (see image on right side).
 * If a detector rail is placed on a slope and the next rail has the opposite slope, the detector will only generate signals for occupied carts (like a stone pressure plate). This bug can be used to detect and redirect empty carts.
 * Detector rails placed on slopes do not work reliably. They will only turn on if the minecart is traveling slowly, and will usually not activate at all if the minecart is traveling at maximum speed.
 * A detector rail being used to change direction on a T shaped track will work as intended from one direction but if the cart is going fast enough from the other the plate can trigger early

History

 * When the detector rail was first added to the game it could not be placed next to any rail without the game crashing due to a bug.