Capacitive signals hanging up arduino... :(

I am using this way to sense the capacitive pickup and calculate RPM of an engine

The problem is when I am testing it openly it works fine and the RPM is calculate correctly But when I am enclosing the arduino into a cabinet and after that any wires passing by the spark plug hangs arduino...

How do I overcome this...??

How are you conditioning the signal from the capacitive pickup before it goes to the Arduino - its important to prevent over-voltage spikes to get at the microcontroller directly.

You need lots of decoupling on the supplies and on the signals.

This is the main circuit I got from one forum...

But I was using only this part...

My main problem is that there are other wires from the analog and digital pins from the arduino which are passing through one sleeve . Now when this sleeve gets closer to the ignition coil the arduino hangs...

You want to pass the cables through a Ferrite ring before they get to the arduino. Better still wind them a few turns round it. You can get them in lots of places, here is one:- http://www.reemelectronics.co.uk/ferrite-rings-and-beads-ferrite-hem3013-x-1.html

OK so if I wind the bunch of cables few turns in one of those rings, and then after that if the bunch goes near the ignition coil arduino will not hang...??

No guarantees of it fixing the problem, but it will suppress induced spikes traveling down the line. If it doesn't fix it, it is an improvement and a step closer to solving it. This sort of thing doesn't have a sure fire fix.