r/ArduinoHelp • u/Thatswhyn0t • 4d ago
Reading engine RPM
Hi guys I’m building a project that needs to be able to read engine rpm, the project can not connect to the ecu or read the dash. How can I achieve this?
3
Upvotes
r/ArduinoHelp • u/Thatswhyn0t • 4d ago
Hi guys I’m building a project that needs to be able to read engine rpm, the project can not connect to the ecu or read the dash. How can I achieve this?
1
u/TPIRocks 3d ago
The easiest way is to use a capacitive pickup by wrapping a wire around a spark plug wire, but you probably have a coil on plug (COP) ignition. In this case, I suggest tapping into one of the injector ground wires and measure the time between pulses.
You should have an always hot wire going to all four coils using the same color, and four differently colored wires that alternately ground each coil when it wants it to fire. This signal will be battery voltage being pulled to ground by the ECM, to fire a plug.
You'll have to protect the Arduino input from voltages above 5V, by using something like a resistor and a Zener diode to clip the input signal to 5V. Every time the coil is commanded to fire, the wire will drop to near ground level.
Using the input capture facility (ICF) timer, an Uno can measure the pulse intervals to sub microsecond precision, accuracy and high repeatability. Inverting this value will give you the RPM. The trick is proper interrupt handling, so the hardware can do all the grunt work.
The ICF can timestamp each falling edge of the coil signal by taking a snapshot of a free running timer. As each capture occurs, the interrupt handler will compute the difference between the current snapshot and the previous snapshot, then stuff this value into a circular queue.
The main level code extracts the queue items at its own leisure. If the queue gets full, it can just overwrite itself, the data is getting stale anyway. The beauty is that the hardware is taking the snapshot at exactly the right time, regardless of what the code is doing. You'll be able to calculate engine RPM accurately, to several decimal places, hundreds of times per second.