A crankshaft sensor has two purposes: to help a vehicle's ignition system produce a spark and to signal the fuel system to inject gasoline into the engine's cylinders. Without the crankshaft sensor, the engine cannot continue to run.
The crankshaft sensor performs these two important tasks by sensing the precise location of the cylinder pistons as they move up and down. It then relays this information to the computer that controls the engine's fuel injection system.
This allows the computer to know exactly when to make the injector coils send a spark into the cylinder. It also tells the computer when fuel should be injected into the cylinders. All of this keeps the engine firing properly during each rotation of the cylinder pistons.
The crankshaft sensor also works with the camshaft sensor to determine the position of the cylinders in relation to the engine's valves. This is important in engines with variable timing. The crankshaft sensor and the camshaft sensor are the primary sources used to measure the engine's revolutions per minute, or RPMs.
Modern crankshaft sensors are entirely electronic. Before electronic sensors were invented, the engine's distributor had to be adjusted manually to a precise timing mark to keep the engine firing correctly.