Sensor from engine spark plug: only collecting data for a few seconds.

Thanks for the replies!

pylon:
Provide a complete wiring diagram. This is probably a hardware issue and not a software issue, otherwise it wouldn't work with the signal generator too.

The only difference between the two setups is connecting the wire that feeds the clean signal circuit to the signal generator instead of wrapping it around the spark plug. I've attached a drawing of the circuit.

jremington:
You will need extremely robust spike suppression circuitry to protect the Arduino input.

What do you mean by robust spike suppression, and what do you mean by protecting the input? I've attached a pic of an oscilloscope display while running the motor. The blue signal comes from the spark plug wire, the yellow signal is the output of the circuit.

jremington:
Seems like an awful lot of code to read RPM.

It could definitely be done with less code, but for the application I'm using it for, all the variables and arrays are needed. For readability, I deleted out all the other code that doesn't deal with this specific issue before posting here.

CleanSignal.PNG