I'm building a project to replace my speedometer and tach in a 95 vw mkiii. The Vehicle Speed Sensor is a sawtooth waveform that frequency changes with speed. The engine speed sensor waveform is generated by inductive resistance. The flywheel has 58 teeth and a two tooth gap. The waveform ends up looking like the blue waveform:
Now, I plan on using the FreqMeasure library from PJRC. This library reads the time between a single cycle. Supposing the frequency was 1hz between teeth, and the library averaged 59 cycles (the 58 from the teeth and the one from the gap), the average would be 1.0169. If the engine was running at 7000 rpm, this would be about 6880 rpm. I don't really care about the accuracy that much. At 1000rpm it would be about 980rpm. Good enough for a general gauge.
I am just curious if anyone could think of how to use the gap in the waveform to determine the actual RPM?
Most crank/cam angle sensors have an extended gap to indicate cylinder #1 top dead center, so the engine knows when to fire the correct spark plug (and when to fire the correct injector on engines with individual injector control - not common, most engines fire all injectors at the same time or in batches of two or three).
Assuming an Arduino at (say) 16Mhz has the resolution to read a waveform at 400mhz, simply divide the output without making the code more complex to analyze the waveform.
TomGeorge:
Hi, these days with direct cylinder injection, this sort of encoder/toothed system will be common.
Tom...
Been common for decades mate - my 1989 Nissan GTR's CAS has well over 60 slots, from memory it has 360 on the camshaft angle sensor (therefore one slot for every two degrees of engine rotation), plus six unevenly sized position slots to tell the computer which cylinder is currently at TDC.
I suggest that rather than trying to measure the pulse duration, you count the number of pulses in a given period. This will average out the effects of the varying pulse lengths for you, and give you a more accurate measurement.
PeterH:
I suggest that rather than trying to measure the pulse duration, you count the number of pulses in a given period. This will average out the effects of the varying pulse lengths for you, and give you a more accurate measurement.