Characterizing The Ignition Signal (Tach-to-CAN)
First we must find a location to tap into the ignition signal, on an NA miata there are two locations that are relatively accessible. The first is on the back of the instrument cluster at the IGN terminal. The other location, and the one I used is the diagnostic box inside the engine bay. I chose to use this for preliminary testing so that I wouldn't have to tear my dash apart every time I tested something. However, it would probably be best to use the rear of the instrument cluster for a more permanent install in the future.
The diagnostic box exposes the IG- signal, which sends a pulse to tell the car when the ignition coil should fire. Knowing that a spark or ignition occurs every 180 degrees of crankshaft revolution we can infer that the time between pulses is 1/2 of the engine rotation.
The easiest way to prove this theory is to capture the ignition timing on an oscilloscope and compare it with the known engine RPM. For this step, I am using the Rigol MSO5072 scope to capture the waveform. I connected the probe to the IG- pin seen below and the ground lead to the GND pin.
The vehicle's engine should be running at idle RPM when capturing this waveform. My Miata's engine speed is around 900RPM at idle, and the resulting waveform is as seen below:
We can see the ignition pulse occurs every 32.70ms. Therefore we know that it takes the crankshaft approximately 65.4ms to do a full rotation. By converting this to frequency (1/t) we get about 15.3Hz or 15.3 rotations per second. Now to convert this into engine RPM, multiply the rotations per second by 60 (60 sec in a min) to get the rotations per minute. For this example I got an engine speed of 917 RPM, spot on to the expected idle RPM. Meaning the theory of operation is correct and therefore Engine RPM = 60*(1/(2*Δt)). Where 60 equates to 60 seconds in a minute, 2 accounts for 2*(180deg) = 360deg, Δt as the time between rising edges of the pulse and 1/__ as a conversion from time to frequency.
Summary:
Engine RPM = 30/Δt
Next Step
Project Repo: Tach-to-CAN