Sale ends todayGet 30% off any course (excluding packages)

Ends in --- --- ---

ego PID setting and how to know you have it right

General Tuning Discussion

Forum Posts



Tech Articles

Discuss all things tuning in this section. News, products, problems and results. 

= Resolved threads


pretty much what the title says how do you know is there a data field that can help you confirm?

Are you referring to closed loop lambda control here?

Yes Andre! Sorry I've been away from my computer hopefully you'll still see this...

Tuning PID is the same general process regardless what you're trying to control. If you happen to own the boost control course then there is a complete module on this and how to tune it which is very valuable.

With closed loop fuel control I'd start by getting the main fuel table close as this means the closed loop system isn't going to be chasing huge errors - The less work any closed loop system needs to do, the better it will work.

Start by adding some proportional gain only and measure the effect. I start with a small amount and then begin doubling it until the system becomes unstable and oscillates. This let's you know the range of usable values and you need to back the P gain off again. I aim for a little oscillation/overshoot and then add some derivative gain which has the effect of slowing the system down and preventing overshoot. Too much D gain will result in slow response while too little can result in oscillation. Lastly you can add a little integral gain to correct any remaining error.

In essence I try and use the minimum gain possible. The biggest mistake I see is people trying to use closed loop fuel control to fix a poorly tuned fuel map. The results you'll get in this instance are likely to be poor.

PID control of anything is tuned basicly the same. You should tune Proportional control first, then add Integral control, after that add Derivative control if needed.

Proportional control is how fast the system reacts on measured unit change. Too big coefficient - you will see huge oscillations until measured unit reaches target. Too small - it will take a lot of time.

Integral control based on summing errors through past time. Too big coefficient will increase oscillations more and more until system fails.

Derivative control usually not needed. This control is an attempt to predict the unit change in near future.

Try to make engine running on steady AFR on minimum RPM you can hold steady AFR with closed loop control on and all coefficients dropped to zero. Slightly increase Proportional coefficient, change target AFR and measure delay between target change and system stabilized on that AFR using your logger, increase coefficient and repeat the procedure until you see overshooting (oscillations around new target). Step back and this should be the minimum time to reach the target hence the optimal P coefficient. Integral control tuned after Proportional, which should be on. The target is the same - to drop the delay between Target AFR change and wideband signal reaches that target. Usually that's enough.

Some ECU's like Link G4+ has complex PID control with floating coefficients, I think that tuning that type is a subject of Andre's webinar )))

Andre was the first this time)))

so basically your are saying there no set point for a base! so is there a way to know you have it right since afr's are constantly fluctuating

There is no set for base, it depends on the system, how fast it reacts and how fast it can introduce changes

I'll add a few more comments to avoid confusion:

Proportional gain is a component that's relative to the size of the current error (difference between measured value and target value). As the measured value gets closer to target the error is reduced and hence the power of the proportional gain is reduced.

Derivative gain is a component that's relative to the 'rate of change of error'. This has a kind of braking or dampening effect and can prevent the system overshooting the target.

With P and D alone it's impossible to reach the target exactly as the power of these components reduces as we get closer to target. Integral gain is a component that reduces any remaining error with relation to time.

Some systems may only offer P and I gains and this can work adequately. Typically I find with a system that demands fast response and minimal error that you'll get the best results with P, I and D gains correctly tuned.

PID control is a universal approach to controlling a closed loop system and hence there is no 'base setting' that you can apply to every system. The required speed and accuracy for cam control for instance, as well as the system's ability to respond to changes is vastly different to idle speed control.

The technique of tuning PID control is to request a change in target and then monitor how the system responds to this new target - ie how it responds to an error being introduced. When the gains are right the system will quickly correct the error without overshooting or oscillation. When the gains are wrong you'll either have slow response or a system that is uncontrolled.

PID tuning can be complex however closed loop fuel control in my opinion isn't that tricky to set up mainly because if the fuel table is correctly tuned in the first place, the system should have very little work to do.

Thank you that helps me termendisly! Ive found in my expernece that its tuning feature like this that I dont have a good grasp on mainly knowing the tricks to knowing youve got them right. So to test this id set my target afr table and then add fuel to the ve table and see what it ends up doing?

Probably reversing that test makes more sense

The way you would normally validate a PID control system is to request a change in target and watch how quickly and accurately the system follows to achieve the new target. With fuel control you could do this by either adding/subtracting fuel from your fuel table or by changing the AFR target.

More often though I'd just drive the car and log AFR, target AFR and closed loop trim over a normal drive cycle and see how well the closed loop is performing. If you're doing this sort of test make sure you use smooth throttle application as any time you request accel enrichment with a sharp throttle opening you make the closed loop control harder.


this helped me a lot in understanding it the first time around.

Sweet thank you gentleman confirming a way to test it is what i was looking for and now i have it!

Hello, same PID for closed loop but this time for idle question.

I've seen that in the webinars on Link Fury the Actual AFR number at idle are very consistent, and on MoTeC M1 ECU the lamba almost stands still with very accurate values of 0.997 to 1.001.

I have Haltech Sport2000 on M52B28 turbo engine with stock mild camshafts , at idle my AFR's is inconsistent and runs between ~14.3 to 15.0 even with closed loop disabled.

The question: is that a difference in ECU technology that working with AEM wideband and i have to give up on trying get constant AFR and live with it OR there is a way to configure the system to get it stable?

p.s. The idle RPM is 850 but there are jumps of 30-40 rpm in each direction. The timing is 27 degree at 800 rpm and 25 degree at 900 rpm. I've tried several AFRs from 13.0 to 14.7 (the leaner - the more AFR and rpm jumps). My PID settings for idle are: 25ms refresh rate, P=20, I=5, D=0.

Thanks in advance :)

we already talked about that. Haltech ps runs a very strange PID algorythm, nobody can understand how it works

^ yes! Glad im not the only one going "wtf?"

Also, sanderman, try something else out. If you go to your setup, and the advanced setup options, youll see "idle timing map" and "idle fuel map" or something like that, i forget. It will allow you to get tighter control on the idle area if your setup is particularly fidgety.

Thank you very much guys, now that makes sense ;) i am using that Zero Throttle table for timing, will try to use it for fuel as well.

PID is very interesting process: on one hand you can make it responsing fast but it can overshoot, on the other hand if values are low and the process is slow - it'll be incorrect since it has a delay. For example you are now at certain rpm with -10% correction, once you pass to another cell in the map, the correction will decrese slowly with inertia.

I would love to see a webinar on A/F or idle control with the Haltech Elite to see some real world examples of dialing in PID with it.

With the Elite and earlier the Platinum Sport in our Z I find the AFR is reasonably consistent at idle - Certainly it's closer than what you're noticing sanderman.

You should be able to achieve a stable AFR at idle without closed loop control in any ECU provided your engine is capable (ie you're going to struggle if you have a lot of overlap with big cams). I'd typically expect to see the AFR moving by no more than about +/- 0.1 AFR at a normal operating temperature and consistent IAT. If the AFR is moving much more than that I'd be looking at your map to see if there is a reason. In particular a common mistake I see is people having large changes in fuelling across the cells in the fuel table in the idle area. It only requires a small change in idle speed to then result in a large change in fuel delivery.

The PID gains in the Haltech software are dealt with a little different to other ECUs. To get a better handle on this as well as why, I spoke to Scott at Haltech about it. This is from him:

The The Sport and Pro series ECU did not use a true PID control system, rather a system that mimics PID. The Elite uses a true PID controller that is not dependent on itself (Meaning you can use just P, just I, just D or a combination of each).

As far as the units for the gains go, Haltech's explanation is that the gains are dependent on the sampling rate of the system. Here's a link that explains the effect of sampling rate in a little more detail if you're interested: http://support.motioneng.com/downloads-notes/tuning/pid_overdamped.htm

Andre, thank you very much for the reply.

Yesterday i've been informed also that Siemens Deka 60lb add the inconsistency to the idle AFR, since their dead time not consistent from what i understood. After concentrating more on the Actual injection time value by making Fuel cells closer to each other in values - AFR's are much better and most time have +-0.1 AFR difference with O2control off.

Car idles now much better at 950 RPM, the next step is to find correct dead-times for these Siemens 60lb.

In overall i am pretty happy with the result on current hardware :)

Attached Files

We usually reply within 12hrs (often sooner)

Need Help?

Need help choosing a course?

Experiencing website difficulties?

Or need to contact us for any other reason?