POST UPDATED IN October, 2021
The Knock sensor is of the piezoelectric type, for producing a voltage with a certain frequency when movements arise between its layers or by exerting a pressure on them. The signal it produces is AC voltage (Alternating Current), and the larger the vibration, the higher the voltage produced.
Its function is to detect vibrations that are obtained by motor detonations. If a vibration of the injector occurs, the Knock sensor has a voltage level that is determined proportionally to the same degree of vibration. The Engine Control Unit (ECU) stores the data of that voltage level with circuit, which is known as Schmitt trigger. Once this level of signal has been completed, at the moment another vibration occurs, which exceeds the voltage level that has already been saved, the ECU (Engine Control Unit) will dictate a delay in time, through an adjustment in the ignition times. This will do so until the engine is stable.
There are cases in which the Engine Control Unit (ECU) does not obey the KS sensor signal when the engine is idling or running. The reason is that these signals do not work, because when trying to turn it on or when it is still cold, the vibrations are many.