PWM Closed Loop Idle Tuning Example
The following assumes a PWM valve such as used in this example on the 1990 MX-5 1.6.
Note that the following draws on further technical PID tuning information found in the Appendix.
To begin with, we need to know the base frequency at which the valve operates. It is best to either scope a factory control valve, or to research this on the web. The OEMs take into consideration the mass of the valve, the inductance and other factors to find the best control frequency. In the early MX-5’s case, this is 160Hz. We enter this into the ‘PWM Base Freq’ box.
Next, we need to get the engine running, and of course we are assuming a correctly mapped VE table and ignition table.
With the engine running, and warm (and extra electrical load like headlights, blower heater, heated seats etc OFF), its now time to set the ‘fail safe’, mechanical idle. All throttle bodies usually have an adjuster, or air bleed screw. With the IAC valve unplugged, or physically blocked, set the air bleed/throttle stop screw such that the engine idles at your ideal idle speed when warm, say 950rpm. This means that worst case you have a steady, usable idle to take it elsewhere to be tuned if you're unable to.
Next, we need to find the limits of control of the idle valve. To do this, we set the idle control mode to ‘manual duty’.
Now, we can enter numbers in the ‘PWM Manual Duty’ field, which is the percent the valve will be driven ‘on’ for.
What we are trying to do, is find the smallest number where any less doesn't SLOW the engine, and the LARGEST number where RPM doesn't increase anymore (or goes to a silly high idle such as 2,000rpm etc). Start at 50%, and work up and down in 5% steps until you find these limits. It is also worth noting that if you increase the number, and the engine SLOWs, (or if decreasing the number the RPM goes up) then your valve operates in an ‘INVERTED’ manner (which is true on some of the MX-5) so set the ‘PWM Valve Control’ drop down to ‘INVERTED’. The result of which is that a reported higher Valve Duty (from the Idle Valve Duty % DRO) means MORE AIR is being allowed into the engine, and hence a higher RPM. (In inverted the valve is actually driven LESS as this number goes up, but the end result is the same - a bigger duty %, a faster RPM).
On the MX-5 in this example, moving up and down through manual duty %s, we find the minimum to be around 27%, and the maximum to be around 55%, so we enter these into the respective PWM Min/Max Duty fields.
We have now allowed the valve to only work in the range where it can actually do something - running at say 10% would be useless, as the slowest engine speed is reached at 27% - no need to go any lower on the output duty!
With the ranges set, its time to take a starting guess at the PID settings. Generally, we would set the update interval (or how often the algorithm will check and adjust) to 50ms (20 times a second), so let’s enter the ‘PID Upd Interval’ as 50.
Also, we can pre-set the P term to ‘0.8’ and the I to 800, and D term to ‘0’. Note that typically for idle control, the D term will always be left at Zero.
We must also make sure our target RPM table makes sense - it should go from the fast idle RPM at cold temperatures down to the normal RPM at warm temperatures.
With the engine running and warm, we should see the ‘Target RPM’ readout showing approx 850-1000 (or whatever your table has it set to.
Next ensure that all of the other settings enable idle to happen when it should, ie at certain RPMs, throttle positions and so forth, all settable from within the idle driver.
Now turn on the ‘PWM Closed Loop’ mode, and note that the idle status indeed turns to a ‘Closed Loop’, to indicate it is TRYING to idle, and the algorithm is active, and note the ‘RPM Error’ readout which shows how far from the target RPM the engine currently is.
Now to tune the PID….
There is a very detailed guide in the appendix, but from a layman tuner perspective, here is a brief step-by-step.
- Increase the P number such that the idle oscillates around the target RPM by around +/-200rpm.
- Set the P to about half of what it was when it started oscillating.
- At this point start to steadily increase the ‘I’ value which should ‘smooth’ the operation of PID and allow it to reach a steady idle. As a guideline, this number is normally very close to the oscillation period measured above (in milliseconds).
- You should see the duty readout moving around trying to find the ‘sweet spot’ that gives a smooth idle.
- Load the engine/Rev the engine and allow it to fall back into idle etc. Increase the ‘P’ to improve response time (back it down a bit after you're getting oscillations) and decrease the ‘I’ to make it ‘catch faster’ while in steady state.
- As a rule of thumb, the ‘P’ and the ‘I’ work in opposite directions. Increasing the ‘P’ improves response time, but increases the chance of getting oscillations, while increasing the ‘I’ makes the system more stable and decreasing it makes it respond faster in ‘steady state’.
- As a second rule of thumb, always reach a stable value for ‘P’ before adjusting ‘I’ or ‘D’ (you shouldn't ever need to use ‘D’ unless you really know what you're doing)
The overall idea is that PID can be tricky to tune - but when it is correct, the engines idle will perform as if OEM, fast to respond to load changes and stable. We have listed some default IAC/PID settings in the appendix for various engine models, and as more are discovered by us or reported to us we will add to the list.
Remember some cars, such as the MX-5 feature an air bleed screw on the throttle body. With the Idle control running in closed loop, and PID working properly, you should adjust this bleed screw such that the valve duty (which will automatically change to account for changes to the air bleed) should sit in the lower quarter of the PWM Duty range when the engine is at warm idle. i.e on the MX-5, which has a range from 28-50%, we would adjust the bleed until the engine idles warm at the target RPM with a PID controlled valve duty of around 30% - this allows the valve to have more ‘up RPM’ when it needs it, rather than being ‘maxed out’ in the fast or slow valve duty.
Note: All initial settings should be done with the engine fully warmed up and with all extra electrics (i.e headlights and wipers etc) off.