When a piston in an engine reaches the top of its travel, that point is known as Top Dead Centre or TDC. This is important to know because I don't think any engine actually fires the spark plug with the pistons at TDC. More often than not, they fire slightly before TDC. So how does your ignition system work, and what is ignition timing all about?
Well generating the spark is the easy part. The electrical system in your car supplies voltage to your coil and ignition unit. The engine will have a trigger for each cylinder, be it a mechanical trigger (points), electronic module or crank trigger. Whatever it is, at that point, the engine effectively sends a signal to the coil to discharge into the high voltage system. That charge travels into the distributor cap and is routed to the relevant spark plug where it is turned into a spark. The key to this, though, is the timing of the spark in relation to the position of the piston in the cylinder. Hence ignition timing. Having the spark ignite the fuel-air mixture too soon is basically the same as detonation and is bad for all the mechanical components of your engine. Having the spark come along too late will cause it to try to ignite the fuel-air mixture after the piston has already started to recede down the cylinder, which is inefficient and loses power.
Timing the spark nowadays is usually done with the engine management system. It measures airflow, ambient temperature, takes input from knock sensors and literally dozens of sensors all over the engine. It then has an ignition timing map built into its memory and it cross references the input from all the sensors to determine the precise time that it should fire the spark plug, based on the ignition timing map. At 3000rpm, in a 4 cylinder engine, it does this about 100 times a second. In older systems, the spark timing was done using simple mechanical systems which had nowhere near the ability to compensate for the all the variables involved in a running combustion engine.
Typically as an engine revs quicker, the ignition timing needs to advance because the spark needs to get to the cylinder more quickly. Why? Well the fuel-air mix takes a finite amount of time to combust. It won't burn any quicker or slower for any given engine speed. So for higher speeds, the mixture needs to be ignited earlier in the cycle to ensure that it begins to burn at the optimum timing point. In modern systems, this is all taken account of in the ignition timing map. On older mechanical system, they used mechanical or vacuum advance systems, so that the more vacuum generated in the intake manifold (due to the engine running quicker), the more advanced the timing became.
Checking ignition timing
Despite the speed that an engine turns, it is possible for mere mortals like you and me to be able to check the ignition timing or an engine using (and you'd have never guessed this) an ignition timing light. Timing lights are typically strobe lights. They work by being connected to the battery directly and then having an induction coil clamped around one of the spark plug leads - normally the first or last cylinder in the engine depending on the manufacturer. When the engine fires the spark plug for that cylinder, the inductive loop detects the current in the wire and flashes the strobe in the timing light once. So if the engine is ticking over at 1100rpm, the strobe will flash 550 times a minute (4 stroke engine, remember?). Fantastic. So you're now holding a portable rave lighting rig but how does this help you see the timing of an engine? Well it's simple. You must have seen strobe lights working somewhere - a rave, a stage show - they're used to effectively freeze the position of something in time and space by illuminating it only at a certain point and for a fraction of a second. Shooting a strobe at someone walking in a dark room will result in you seeing them walk as if they were a flip-book animation on a reel of film. This effect is what's used to visualise the timing of your engine. Somewhere on the front of the engine there will be a notch near one of the timing belt pulleys and stamped into the metal next to it will be timing marks in degrees. On the pulley itself there will be a bump, recess or white-painted blob. When you point the timing light down towards the timing belt pulley, remember it fires once for each firing of the cylinders? Each time it fires, the white blob on the pulley should be at the same position in its rotation - the strobe fires once for each ignition spark at which point the mark should be in the same place, and the effect to you is that the whole pulley, timing mark and all, are now standing still in the strobe light. The mark on the pulley will line up with one of the degree marks stamped on the engine, so for example if the white dot always aligns with the 10° mark, it means your engine is firing at 10 degrees before TDC. When you rev the engine, the timing will change so the mark will move closer or further away from the TDC mark depending on how fast the engine is spinning.
Note that in some engines, the two marks are simply painted or stamped, and there are no degree markings. In this case, the marks align when the first piston is exactly at TDC.
Check the timing marks first
After all that, it's worth pointing out that crank timing marks can be way off so it's worth confirming that your TDC marker is actually TDC before pratting about with the timing. It's not as bad now as it used to be, but in the bad old days, Rover V8's were particularly bad for this, with some being as much as 12° off! So how you do confirm your TDC really is TDC? Small cameras, a good set of feeler gauges, some cash and someone who knows what they're doing.
Timing marks on cam belt pulleys
The same timing marks exist stamped into the metal near, and on the pulley on the end the cam. Essentially these marks are used to line up the cam to the correct position when you're changing the timing belt. You have to make sure the engine is rotated to TDC and that the cams are properly aligned too. If you don't, the cams will spin permanently out-of-synch with the engine crank and the engine will run badly, if at all.