# PID controller for a very wide temperature range (∆T=190°C)

I'm designing temperature control system based on Peltier elements. And it's needed to work on a very wide temperature range - from below zero to more than 100°C. So there is two work modes - cooling and heating. I've implemented a PID controller, made different gains for two modes. And I can adjust them to go to a specific temperature (e.g. 100° or -5°) from room temperature (25°). But when I want to go e.g. from -5° to 60° it may go into oscillations or conversely grow very slowly. Should I break my large range in smaller subranges? Or maybe different gains depending on difference between current and target temperature (∆T)?

Also, I thought to implement auto tune algorithm, but I didn't found anything for the Arduino?

• are you using a controller or making your own code? if making own code, linearize the output stage, that will ease your loop design a LOT. Heaters usually dump in a controlled amount of power, but for control purposes, you are concerned with rate-of-change of temperature, and that depends on T difference. Similar with peltier's --- so set it up so that the controller output is a value that is (to first order) linear vs dT/dt ... then have an output linearizer function translate that into a physical output based on the T diff's Jan 8, 2021 at 14:51
• sorry misspoke -- heat PUMPS or coolers will have that behavior, and it includes peltiers Jan 8, 2021 at 15:18
• I'm writing my own code. Do you mean move from PID controller and implement, for example, simple P controller? Jan 9, 2021 at 11:05
• Keep the controller, add an additional function in series with the signal that goes to the plant (the peltier). That function reduces the non-linearity of the plant, as seen from the controller. Keep it simple, you only need a partial improvement in linearity. If you can reduce the nonlinearity down by factor of 3 or so it'll make it much easier on the loop. I am making some assumptions here about what is really the root cause, but it's something that has worked well for me in similar situations. Jan 9, 2021 at 14:23
• My PID controller returns power in range from -100%(cooling) to 100%(heating). And I'm using H-bridge to control voltage on the Peltiers. So I have already implemented such a function, that translates power to PWM Jan 11, 2021 at 8:46

Generally speaking, the PID should be able to handle that requirement without having to break it down into subranges.

It can be tricky to find the right values for a PID.

Check the answer of this post about the process of adjusting the PID, it's easier to go step by step rather than randomly changing the values.

More detail can be found here.