Project: Dyno. Check it out, for criticism and advice

I've made a circuit to detect electrical pulse from spark plug wire.
To test it I've made a simple program that every second check the sensor value and turn on a red LED if sensor value is HIGH and a YELLOW LED if RPM ( = (1/time)*60000) ) is over 4000. The 2 LEDs works, but when I try to connect arduino on serial monitor, when the engine is running connection is lost, but the LEDs still light up.
I have that problem with serial monitor
I thought there might be some short-circuit or something like that...
Who can help me?

P.S. If you need the circuit sketch I'll let you have.