Far-seeker:
The way you are using pulseIn() is giving you the length of the tach pulse, which is the main information you need. However, if you want work with the time inbetween pulses you could have a separate timer that is reset everytime a pulse is read (I wouldn't use another pulseIn() because of the way it delays the rest of the sketch).As far as a hardware filter you'd want either a low pass (set just above the frequency you are limiting to in the sketch) or a band pass filter (with the low end of the band being the frequency correlating to under 1 RPM or whatever minimum value you are interested in), and a passive first-order implementation could be sufficient.
Ah, I meant to say the length of the pulse.
Actually right now i'm not using that for my calculations. I'm just counting how many pulses per 200ms.
PeterH:
Have you obtained a clean square wave at TTL levels, or are you still trying to clean up the signal in software?
I don't have access to a 'scope anymore, so I don't know how my waveform looks right now. I'm using the circuit purposed earlier in this thread by dc42:
(but with the addition of a diode between the tach signal and resistor.
dc42:
I'd use a small signal NPN transistor. Connect emitter to ground, collector to the Arduino pin (configured as an input with pullup resistor enabled), and base to the tach signal through a 100K resistor. The resistor will protect the transistor from the positive going spike, also from any excessive negative-going voltage (although from your scope trace it looks like it only goes to -2V, which is insufficient to cause the emitter-base junction to avalanche anyway).