A Knock Sensor is basically a mintaure microphone that is attached to a portion of the engine block that picks up most of the vibrations from engine fuel combustion; typically near the intake manifold, or the first or last pistons. Locations may vary.

A Knock Sensor is made up of a piezoelectric element surrounded by a coil wire. This element is tuned to the knock frequency of the engine. (typically around 5Khz) The knock sensor is connected via one wire to the ECU (Engine Control Unit).

Knock sensors detect pre-ignition. (also called detonation, premature combustion) Which can occur due to over-advanced ignition timing, "bad gas", or underrated octane for the design of the car. Putting 89 octane fuel in a car that requres 93 octane will cause engine knock. As the engine vibrates, the Knock Sensor sends voltages back to the computer. The computer analyzes these voltages and determines if they meet a pattern that is equal to engine knock. If so, the computer reduces timing by as much as 5* to try and stop it.

There are various flavors of Knock Sensors, typically the ones on newer model vehicles work both ways, if the computer does not detect knock, it advances timing slightly to try and increase performance. You will find a knock sensor on every vehicle sold today, and on most older cars, as long as they're equipped with an ECU.