Idle Tuning for MegaSquirt

Or any other Engine Management System

How to: Tune for a smooth idle

“How do I get a smooth idle like my stock ECU had?” It’s a common enough question to warrent a small article with tips for how to get the idle in tune. The first key may surprise many novice tuners:

The idle control settings are not the most important thing to adjust to get a smooth idle.

This may seem counter-intuitive, but consider this: If the engine is idling at constant load with the throttle held at a constant opening, shouldn’t you have a constant idle speed? If your idle surges or hunts under these conditions, and your idle control valve is staying at one opening value, the idle control settings are not the problem. To get a steady idle, you need three things in place: correct fuel, correct timing, and correct airflow. These problems should be addressed individually.

Correct Fuel

Engines don’t like to idle lean; a lean air/fuel ratio is one of the biggest causes of a surging idle. On an engine with sequential injection, this is simple enough – get the engine idling at 14.7:1 for gasoline, and you’re good to go. Batch fire engines, however, have issues at idle with intake pulse reversion sending some of the fuel into an adjacent cylinder. So, if your engine is batch fire, you’ll need to add a little more fuel so all the cylinders can stay at 14.7:1 or richer. Batch fire engines typically idle best in the mid 13’s, so if you’re leaner than that, put in some more fuel and see if that stabilizes the idle.

You’ll need to make sure the air/fuel ratio is maintained during cold start. If your idle hunts when the engine is cold, but stabilizes when it warms up, try more warm up enrichment.

Warmup enrichment table

Correct Timing

Timing is a very useful tool for controlling your idle speed. Ideally, you’ll want the timing to be set to slightly below the timing that would give it the most power – on most piston engines, this typically works out to somewhere in the 10 to 18 degree range. Then you can add a row around 300 RPM below your target idle speed if you find the idle to be unstable.  The timing in this row can be bumped up by around 2 to 4 degees over the idle timing. The 3d view below shows a spark table set up this way.

Spark table meant to stabilize idle

Setting up your timing like this has a stabilizing effect on the idle. When the idle speed drops, the timing advances, increasing power and moving the idle speed back up. The result is an automatic feedback loop that helps maintain a constant idle speed. Not every engine really needs this. However, you need to look out for timing curves that do the opposite. If you’ve specified less timing below the target idle speed than you have at the idle speed, this often makes for an unstable idle as the ECU pulls timing while the idle speed falls. This can make a slight disturbance in idle RPM amplify itself into an idle speed that cycles up and down rapidly.

Too much timing can be trouble. If the timing at your regular idle speed already puts you at the most power output, you have nowhere to go but down. Over-advanced timing will hurt power as well – beyond a certain point, adding more timing will not bump up the idle, and taken to extremes, it can do the exact opposite. So you want to “hold back” a little timing at your idle RPM and run less than the amount of timing that would give it the most power.

Correct Airflow

You’ll need to get the right amount of air to maintain a good idle speed. How to do this depends on what sort of IAC (idle air control) valve you have.

No IAC valve at all? Yes, you can run without an IAC valve. Just use your idle speed set screw to adjust it open enough that the engine doesn’t stall on cold starts. Sure, your idle speed with the engine warmed up will be higher than it could be, and you’ll have no way to adjust for stuff like the A/C or electrical loads, but it’ll work.

On/off IAC valves give you two choices: On fast idle, or off it. You’d set the idle speed set screw to your desired idle speed with the engine warm, and if your on/off valve is big enough, turning it on will keep the engine from stalling on a cold start. No closed loop control is possible. If you don’t feel much like adjusting closed loop idle, you can even add a second on/off IAC valve alongside an existing IAC to kick up the idle when the A/C turns on. Nissan used this on many early ’90s cars.

PWM IAC valves or stepper motor IAC valves are continuously variable. This lets you adjust the amount of opening time as a function of temperature. There are two ways these can be run. Open loop mode (also called warmup mode) simply tells the valve to open a set amount as a function of temperature. MS1 has a two point curve, while MS2 and later lets you set a more detailed curve of IAC valve versus temperature. Closed loop mode tries to maintain a target idle speed. While not every car needs closed loop idle, it can help compensate for major changes in load. For example, if the idle drops an unacceptable amount when you turn the air conditioning on, you can use the closed loop control to compensate. MS1/Extra has a fairly crude algorithm, while MS2/Extra and MS3 use a more sophisticated (and easier to tune) method called a PID loop.

The MS/Extra code variants provide a closed loop feature that allows targeting a specific idle speed. I recommend leaving the closed loop control off until you have the engine idling well at a steady load.  Both badly tuned closed loop idle and badly tuned fuel or spark settings can cause an oscillating idle.  Leaving the idle in open loop (warmup) mode will let you rule out one cause of an oscillating idle and let you get just the fuel and ignition side straightened out.  As a rule of thumb, trying to use closed loop settings to compensate for poor fuel or timing settings will have the ECU chasing its tail, but never really catch it.  You may find the engine runs perfectly well in open loop and you don’t need closed loop, particularly on a race car with no air conditioning and few electrical loads.

MS1 warmup settingsMS2 warmup curve

The closed loop settings are best used to compensate for load changes, such as turning the A/C on. If your car is equipped with working A/C, a good way to judge the effectiveness of your closed loop settings is to click the A/C on and see how quickly it stops the idle speed from dropping.

The following links provide detailed information about tuning closed loop idle.

MS1/Extra closed loop idle settings

MS2/Extra and MS3 closed loop idle settings

Note that there have been improvements to the idle code as new firmware releases come out. As a general rule, the newer the firmware, the better the closed loop idle control. If you’re running an older firmware and having trouble making closed loop idle work for you, check if there’s a newer release, or even a new alpha code being tested with improvements to the closed loop idle.