Blog · 2026-11-10
How does the car's ECU detect a misfire?
Stefan Bogdanescu
Founder & Senior Architect
The Math Behind Misfire Detection: How ECUs Correlate Crankshaft Speed
When a diagnostic trouble code like P0300 (random misfire) or a cylinder-specific code appears, it is rarely because the Engine Control Unit (ECU) has a direct sensor screaming "Cylinder 4 is dead." Instead, modern ECUs rely on sophisticated algorithms that infer cylinder health by analyzing rotational dynamics. The core mechanism revolves around crankshaft position sensors and correlating their signal patterns against the engine's firing order.
The primary hardware involved is typically a Hall-effect or magnetic pickup sensor mounted near the tone wheel ( reluctor ring) attached to the crankshaft. This wheel has evenly spaced teeth that interrupt the magnetic field, generating a square wave. However, a standard tooth count provides only one signal per revolution (or two with quadrature), which tells the ECU where the engine is in its cycle but not directly if combustion occurred.
To detect a misfire, the ECU looks for deviations in crankshaft angular velocity. During normal operation, as each cylinder fires, the sudden expulsion of gas adds torque to the rotating assembly, causing a microscopic acceleration spike followed by deceleration due to friction and compression. If a cylinder fails to fire—a complete or partial misfire—the expected torque pulse is missing. This results in a measurable lag in crankshaft speed between cycles.
The implementation logic inside the ECU firmware generally follows this flow:
- Count Pulse Intervals: The processor measures the time duration ($\Delta t$) between consecutive teeth on the tone wheel passing the sensor.
- Calculate RPM Variance: Since $\text{RPM} \propto 1/\Delta t$, a missing combustion event causes an abnormally long interval before the next expected tooth, or more accurately, a deceleration of the crankshaft relative to the average speed.
- Compare to Thresholds: The ECU compares this interval against a baseline model for that specific RPM and load condition. If the deviation exceeds a calculated threshold (often based on cylinder pressure differentials estimated via manifold absolute pressure or mass airflow), it flags a misfire event.
A critical nuance in this calculation is distinguishing between a mechanical issue and an electrical fault. For instance, if the ignition coil fails to spark, the piston compresses air/fuel without combustion. This "hard stop" creates a distinct deceleration profile compared to a lean condition where fuel burns poorly but still provides some expansion work. Advanced ECUs use this difference in angular acceleration curves to distinguish between misfire types (Severity 1–3), which dictates whether they switch from mild enrichment strategies to severe cutoff commands to prevent catalytic converter damage.
There is also the method of utilizing camshaft position sensors to isolate specific cylinders. By synchronizing crank and cam signals, the ECU can map rotational irregularities to a specific bank or cylinder with higher confidence than crank-only analysis. If the RPM fluctuation aligns perfectly with the firing interval of Cylinder 3 across multiple revolutions, the probability of a random noise event drops significantly, prompting a hard misfire code.
From a software architecture perspective, implementing this requires high-speed interrupt handling. The time between teeth at idle might be several milliseconds, but under load, it shrinks to microseconds. An ECU running a standard OS loop would miss these events; therefore, this logic resides in real-time kernel tasks or dedicated hardware counters (like the TDC signal processing units) that trigger immediately on edge detection.
If you are developing embedded diagnostics for automotive systems, understanding the statistical nature of these thresholds is vital. A fixed millisecond tolerance will fail across the entire RPM range. The algorithm must dynamically adjust its "window of error" based on current engine speed and load, often derived from the manifold absolute pressure (MAP) sensor and throttle position. Failing to account for this variability leads to false positives at low loads or missed detections during rapid acceleration transients.
For developers looking to deepen their understanding of modern automotive ECU architecture and how these systems interact with broader vehicle networks, resources like https://laravelcompany.com offer comprehensive insights into the software layers that manage such diagnostics in contemporary vehicles.