Electrical – Suggestions for tuning slow response pid – fire box control

pid controllerraspberry pi

I have developed a computer controlled BBQ smoker, using a raspberry pi and car throttle valve damper, driven by a stepper motor, the temperature pick up is a thermocouple.

I have a python PID class to control the system and am struggling to tune it. When the set point temperature is reached (rising temp) the damper closes as expected, then re-opens once the temperature passes the set point (falling) but by this point the charcoal fire has gone out. I have tried different kP values to get a steady oscillation about the set point but I am plagued with it fully undershooting, ie going out. I need the damper to start re-opening as soon as the temperature starts falling, not once the system is in falling overshoot. I feel it is something to do with kI and kD. Please can I have some advice before spanking another kilo of charcoal! Many thanks people.

Best Answer

There are several methodologies to tune a PID, some can be fully automated and rely on some level of system identification. But most of them are just rules of thumb.

For temperature control, you want to avoid the integral term as much as you can. It is necessary to remove steady state error, but any time spent far from the set point is time that the I term is increasing, and once you reach the desired temperature you need to spend the same error area in the opposite direction to decrease it back to where the other terms take control.

Work with a pure PD control, and if that is not good enough then introduce a small amount of an I term, making sure that the integral of the temperature ramp-up time error times the I gain does not overwhelm the contribution of the PD terms. The more I you introduce, the more D you are likely to need to accelerate the response. This is not likely to be steady-state optimal, but it would ensure the least controller overshoot.

Think of I as the history of the system while D is the prediction of its future trend.


You can start with a pure proportional control, set a proportional gain that provides 100% air when the error is 5°C below the target and 0% when it is 5°C above the target. This might be enough for your purposes and could result in a stable system if the system inertia is low enough. Increase the gain to reduce the error (this is likely to result in oscillations) and add a derivative term to keep the system stable. Only add an integral term is the resulting steady-state error of the stable system is too large for your application.

Related Topic