PID Tuning Guide
The following is a short guide on basic PID tuning. Volumes are written on this subject, so along with further reading detailed at the end, this should be a quick start to how PID works, and also how to get the best from the ME221s PID based modules (such as closed loop boost, VVT and idle control). For this guide we will assume to be working with closed loop idle control.
First, the base frequency of the PWM valve needs to be known. Usually, our PnP base-maps will have this set, but, if not, it’s easy to measure it using an oscilloscope.
We assume you have discovered the min/max settings of your actuator/valve duties - it will have an effective range of say 20-80% duty, and beyond those extremes it is no longer linear, so first these limits are set. To find these limits override the valves control by placing it in manual mode by the respective driver control, and slowly increase the number until no noticeable effects happen. i.e. with Idle, increase it until the engine revs no longer rise, this would be the max duty, and the same goes for the minimising. Make sure that your ‘Valve Mode’ is set to either ‘Normal’ or ‘Inverted’ as such that when increasing the duty of the valve manually, the RPM at idle rise.
With these set, the PID algorithm now has a window to work in. It won’t try and change the duty beyond those limits.
The next setting is the update interval, or how fast the PID algorithm should run. 10ms -100ms are usual amounts. Choose a value that allows enough time for the system to react to control changes. For idle, we’ve discovered this to be ~100ms.
For those interested in the maths behind, this is the formula of our PID algorithm. It’s very rarely that you’ll need to use the derivative as well, so just leave ‘Td’ set to 0 for normal applications.
![]()
Our PID configuration parameters are:
● P (Kc) - overall gain of the controller. A larger value will make the system adjust faster, but could make it unstable.
● I (Ti) - integral time. A bigger value will make the accumulated error have a smaller effect on the output, whilst a smaller value will have the opposite effect.
● D (Td) - derivative time constant. Not required normally.
First off, you should start by setting the ‘I’ and ‘D’ to 0. Starting value of ‘P’ set to 1. Next, change the target of the PID algorithm (Target Idle RPM for this example) and start adjusting the ‘P’ until the RPM oscillates constantly around the target RPM value. That means exceeding the target by ~200 RPM and then falling below the target by the same amount. Note down this value as ‘Ku’. Also note down the period of these oscillations (time it takes to move from peak RPM to minimum RPM and then to peak RPM again). You can use our inbuilt MEITE logger to obtain this. This value will be ‘Pu’ and is measured in milliseconds.
With these values written down, a good starting point would be to set ‘P’ to Ku / 2.2 and ‘I’ to Ku / 1.2 . These are normally good starting values, but better results can be achieved by experimenting. If you’re having oscillations while in steady-state, try increasing the ‘I’ term, while if it oscillates heavily around the target when that changes, try reducing the P component.
Further Reading
http://innovativecontrols.com/blog/basics-tuning-pid-loops
https://controls.engin.umich.edu/wiki/index.php/PIDIntro
https://controls.engin.umich.edu/wiki/index.php/PIDTuningClassical#Ziegler-Nichols_closed-loop_tuning_method