Passing Colorado Emissions with a DIYPNP MegaSquirt 2 (MS2)

There are a decent number of forum posts on this topic, but not enough where the actual tune settings are shared. Here is the good stuff, more detail below:

This AFR Table and Ignition Table (Spark Advance) passed CO emissions in February 2022 in my 1994 naturally aspirated Miata.

AFR Table that passed CO emissions
Ignition Table (Spark Advance) that passed CO emissions
HC GPM0.61911.0000PASS
CO GPM7.015215.0000PASS
CO2 GPM316.7462N/A
NOx GPM0.00552.0000PASS

Relevant specs of the car at the time of testing

  • 1994 1.8L Miata with 120k miles
  • Naturally aspirated
  • AEM X-Series wideband O2 sensor
  • EGR removed, with cap and block-off plates
  • OEM fuel injectors and OEM exhaust

Here is the full tune file that passed:

DISCLAIMER: I am not an engine tuner, this tune is a frankenstein of what I’ve learned and copied from, TheCarPassionsChannel, the MegaMiata blog, and the documentation from DIYAutotune, MegaSquirtPNP, and TunerStudio. This tune only goes up to 100 kPa because I do not have forced induction, this tune will not work with boost.

Emissions testing

Colorado emissions testing requires a “rolling road” dynamometer-style test where they accelerate the car up to ~30 MPH and ~60 MPH with a testing machine hooked up to the exhaust tailpipe. They test for HC, CO, CO2, and NOx. Cars after 1996 have OBD2 (On-board Diagnostics 2), so they can often pass emissions with just a connection to the car’s diagnostic port rather than a full tailpipe test.

Hydrocarbons (HC) are unburned fuel. They result from incomplete combustion. Incomplete combustion can be caused by too lean, too rich, an ignition misfire or a lack of compression.

Carbon Monoxide (CO) is an indicator of mixture. When it’s lean CO is low. When it’s rich CO is high. It has nothing what-so-ever to do with “spark”. Except in the most basic sense. Ie with no spark there is no combustion, with no combustion there is no CO.

Nitrogen Oxides (NOx) is created when combustion temps are [high]…..well let’s say above 1800f. The thing to remember about NOx is that ppm readings of over 2,000 is perfectly normal with no catalytic converter or pre-cat. Especially in a system like the 1.6 that has no EGR valve.

Carbon Dioxide (CO2) is an indicator of mixture and combustion efficiency. When it’s lean CO2 is low, when it’s rich CO2 is low. CO2 peaks at near stoichiometric. (14.7:1 a/f ratio)

Oxygen (O2) is an indicator of mixture and misfire. When it’s lean O2 is high. When it’s rich O2 is low. when you have a misfire O2 is high.

92MarinerBlue on the forum

What I learned about NOx

NOx emissions were the problem for my Miata to pass emissions, based on the test results from the emissions station. Reading through forum posts and guides I learned that NOx is caused by too-high combustion temperatures. The main causes of high combustion temps are over-advanced ignition timing and running too lean.

  • “Performance” spark plugs cause faster combustion, increasing power, but possibly also increasing combustion temperature which causes NOx.
  • Running lean AFRs at cruising speeds (3000-5000 RPM low load) can increase MPG, but can also increase combustion temperatures creating NOx.
  • EGR (Exhaust Gas Recirculation) is an emissions technology designed to reduce NOx by routing some exhaust gas back into the combustion chamber, effectively reducing the displacement of the engine because exhaust is non-combustible. I did not find a reasonable way to control the EGR valve using MegaSquirt. Also, I already removed and blocked-off my Miata’s EGR system.
  • Advancing ignition timing can create more power, but at the cost of higher combustion temperature. The trick of advancing base timing a few degrees by rotating the CAS (camshaft angle sensor) on a Miata with a stock ECU can cause excess NOx.

How I passed emissions

  • Replaced performance iridium spark plugs (NGK BKR5EIX-11 Iridium IX 5464) with less fancy plugs (NGK V-Power BKR5E-11 6953). I think the iridium plugs were slightly fouled anyway causing incomplete fuel burn.
  • Lowered target AFR closer to 14.7 anywhere that it was higher than that.
  • Decreased ignition timing by about 3 degrees everywhere above ~1200 rpm (idle)
  • Drove around at different speeds with TunerStudio VE Analyze Live running to correct the fuel map for the lower AFR targets.
  • Set EGO correction to 20% to allow the ECU to compensate for any issues with the fuel map during the test. High EGO correction settings can cause oscillation in RPM and fuel/AFR as the ECU tries to chase down the target (20% works for me, but your mileage may vary)
  • Drove around immediately before the test, including a few hard accelerations to warm up the engine and catalytic convertor.

Leave a Reply

Your email address will not be published. Required fields are marked *