Engine knocking is one of the worst things that a car can encounter. It can damage the engine so badly and can easily empty your pocket. But the knock sensor helps to prevent your engine from knocking.

Wait we need to know the basics first. If you don’t know what knocking is? Click the link Engine Knocking
Table of Contents
Piezoelectric Knock Sensors
We know that knocking occurs with lots of vibrations what if you can detect any unusual vibrations to sense Knocking? The piezoelectric Knock sensors do the job.
Piezoelectric effect
When we strain a polycrystalline material, it develops a net electric charge. And the inverse of this effect is also true. When we introduce an electric field to the same material, it strains. (Pierre curie observed this effect ).
Why does it happen? This is mainly because of their structure and dipole formation in a crystal. There exists a dipole in all the crystals.
In a crystalline material, there exists a dipole between the positive and negative ions. This is responsible for the potential voltage or strain obtained.
When a stress is applied (Piezoelectric effect)
If there is no stress applied, there exists a dipole in the whole of the crystal but they have organised randomly that these dipole pairs cancel out hence no voltage is obtained between the ends of the element. When a piezoelectric material is stressed, the dipole organises in an organised fashion and is parallelly oriented as shown. This develops a charge across the ends of the element along the line of strain. This is how a piezoelectric knock sensor works.

When the voltage is applied (Inverse symmetry effect)
When you apply a voltage across a piezoelectric material, the dipoles orient themselves along the applied electric field and this leads to a strain. This effect finds its application in actuators.
Now coming back to knock sensors. Engine knocking is always associated with loud bangs which are essentially high amplitude vibrations. These sensors are mounted directly in the cylinder wall and look as shown. When the engine vibrates, that vibration is transferred to the piezoelectric material by the bolt. Even a healthy engine produces some amount of vibration but when this amplitude is more than a predetermined level, the sensor senses a Knock and the message is sent to the engine control unit. The Engine control unit adjusts the ignition timing and Air fuel ratio accordingly. Hence the Piezoelectric Knock sensor saves your engine.

Source: BOSCH/