If you have discovered you need to replace your knock sensor to pass your car emission test, you need to have a pretty good working knowledge of how to work on cars to do this. Otherwise the money you think you might save doing it yourself may turn out to be a lot more than if you had just taken it into the mechanic.
It will cost you about $2,000 to have a mechanic do it and will probably cost a little over $300 to do it yourself, but it is going to take a lot of your personal time to get the job completed correctly. You need a code scanner, which will cost about $100 and then the knock sensor which should cost about $200.
Remove the manifold and radiator. First you need to take off the manifold, which will take about four hours to do. Once you have removed the manifold, remove the radiator, along with the radiator intake and outtake housings
Remove additional parts. Next remove the fan, power steering belt, alternator belt and air conditioner if you have air conditioning. You will need to remove the harmonic balancer and all the timing belt covers, along with your timing belt
Find the knock sensor. Once you have removed all of these parts, your engine is going to look pretty naked, and you will finally be able to get to the knock sensor, which is located in what is called the engine valley. You will be pleased to know that after all of that hassle, the knock sensor itself is relatively easy to remove
Replace the sensor. After you have removed the small knock sensor, place the new one in the spot where the old one was
Put everything back. You now have to replace all of the parts that you removed so you could get to this small part. You will of course need to replace everything in the reverse order in which you took them out