Fridge PID tuning

Again, can’t attach zip files to WordPress, if anyone wants source code, contact me. I may put things on GitHub at some point

With the fridge built and tested, it was time to tune the PID controllers. I wrote a little add-on to the old USB temperature probe script to handle sending the PID gains and target temperatures (and also controlling the LCD display mode and backlight). (In the end I settled only PI control because of saturation effects).

After a bit of tuning with just the proportional gain, the results weren’t bad, quite clearly some oscillation going on here, with an error of a bit over half a degree.

So I add in some integral gain via the Ziegler-Nichols method. Again, not bad, but still a bit of steady-state error.

After a bit more tuning, and some substantial optimisation and bug fixing of the code, I start getting closer. A bit of an overshoot, but generally accurate to within maybe 0.3 degrees now after it settles.

This time it turned out that the method I was using to avoid integral windup (limited integral history) was causing the steady-state errors, so I adjusted the PID implementation to use a different method (disable the integral until close to the setpoint):

Perfect! The graph shows that if we tune the PI to get rid of the steady state errors, I can achieve +/-0.05 °C resolution (I believe the resolution after oversampling to 1 minute is accurate)

Note: resolution doesn’t mean it’s ACCURATE, I haven’t spent too much time calibrating it!

I think it is time to cook something…



Leave a comment