Temperature control of a system with variable setpoint and ambient temperature heated/cooled by Peltier

Hello,
I'm have an insulated box in which there are about 4-5 liters of water which are cooled/heated by a Peltiers, driven by DC-DC buck convertor as variable CC source. The reversing of heating-cooling is done by reversing the polarity with relay. The setpoint vary gradually between 16 and 25 degrees C on hourly schedule with speed between 0 and 2 degrees per hour. The box is placed in a room, which temperature can vary between 18 and 30 degrees with small hourly changes and big seasonal changes.

I've read a ton on information about control algorithms, but still don't know what to use for this system. It seems quite complex, because of to many variables that change it's behaviour:

  1. Ambient temperature vary a lot. This affects not only the heat transfer rate of the box, but the performance of the Peltiers, most probably in non linear way.
  2. Setpoints vary a lot, which has similar effect on heat transfer and Peltiers performance.
  3. Peltiers are not simetrical at cooling and heating, nor linear.
  4. The system should be controlled conservatively, because Peltiers are more energy efficient when driven with low current. For example if the setpoint now is 20 degrees, and after hour is 19, the temperature change should happen as gradual as possible. Fighting overshoots will not be energy efficient too, although they are not very big problem for the system itself.
  5. DC-DC buck cannot be controlled under 0.5A.

All these points make me realize, that it is impossible to have fixed PID constants. Probably scheduled constants depending on the ambient temperature or it's relation to the controlled temperature and direction of the Peltier?

Also I found some papers on self-tuning on step response, but I don't know how appropriate are they for my system and I'm not sure that I can translate them into code. Neural networks - similar problems, also they seem too heavy on resourses and won't fit Arduino nano.

Here is a step response of the open loop system:
The sensor that measure the inside temp is located very close to the water outflow from the Peltiers heatsink. The value jumps for some unknown reason that I have to investigate. The red line is the ambient temperature. First step is done on a stable system by switching on the lights over the box (it is illuminated and the lamps heat it for some extent) plus lowering the peltier current from 2.248A to 1.284A. Second step is increasing the current from 1.284A to 1.776A with lights still turned on. For the third step I didn't have time to wait for stabilization, it consists of further increasing the current from 1.776 to 2.259A and turning off the lights. The horizontal axis lines are on every hour. From this picture it cannot be seen, but the deadtime is small, it is hard to measured it, because in the moment I'm regulating the current by turning a potentiometer, so it takes some time and the step is not really rectangular, but I can say it is under 30 seconds. The measurements are taken every second, this is the minimum period that the sensor allows.

I suspect, that the step response will be very different if done on lower ambient temperature or even more if done in heating direction.

Any advices will be highly appreciated.

Adafruit has a tutorial on building a Sous Vide cooker. There's a detailed section on how they custom-tuned the PID for precise temperature control. Give it a read:
https://learn.adafruit.com/sous-vide-powered-by-arduino-the-sous-viduino/sous-vide

1 Like

Not enough information, but for help, the following points must be taken into account.

  1. Please post code, using code tags, links to the sensors, modules and power supplies, a wiring diagram and a photo of the setup.

  2. Peltiers require excellent heat transfer on both input and output. If the ambient temperature affects the process, you probably don't have a big enough finned element and fan on the ambient side. Use high quality thermal paste on both faces of the Peltier.

  3. Water MUST be stirred, or you can never achieve uniform temperature in the chamber. Random changes in thermally driven water circulation will cause any control algorithm to misbehave.

The water is circulated by pumps through heatsinks on the cold sides of the Peltiers. Hot sides are cooled down by quite massive CPU coolers with 6 heat pipes each, (TDP probably about 150W) with 12cm fans operated on 1800 rpm. Ambient temperature will affect the process no matter how good is the cooling, for the simple reason that the hot side can go as low as the ambient temperature. And if it fluctuate with more than 10 degrees, this mean that the temperature on the cold side will fluctuate with the similar amount too.
I think code and scheme are irrelevant for the moment, as we are still speaking about control algorithms.

I did see that PID has been mentioned. Have fun!

Do you have any document source that says they are not linear? My experience is the are absolutely symmetrical in heating and cooling. If you change polarity, you must wait at least 15 minutes for the internal heat to dissipate before applying power. Otherwise good by Peltier.

Cooling power of the Peltier is proportional to the current. This part is linear, but the change of the current changes the hot side temperature, which changes the heat transfer rate. This is why the chart look like this:


Heating is even more complex, because the the generated heat on the hot side is sum of the transferred heat + current generated heat, which is propotional to the square of the current.

About switching the sides - I suppose the time will depend on the actuall temperatures on both sides. If the algorithm drives first the current to 0, and only then switch sides, it won't be a problem, because it will happen at similar temperatures on both sides.

Thanks for the link. I checked it - they are using autotune algorithm to get the constants. I can see a few problems with this - first you have to start from a stable state and second - switch to open loop and disturb the system, I don't know by how much and for how long. In my case probably I can do this once per day when I have some period with stable temperature. The bigger problem is that it will have to be done in the heating direction too. And the biggest question is if this autotuning will give results which are appropriate for different operating point. For example - the autotune is done at 16C when outside is 28. Will the parameters be good for the 23C inside and 30 outside? I could experiment with this.

Temperature can't change instantly and almost all heating/cooling systems are simply on/off... When your house is below the target temperature the heater comes on and it shuts-off when the target is reached. Your oven and refrigerator in your kitchen work similarly.

If you try to control the temperature linearly you risk instability, like "overshoot", "undershoot" and "hunting". (From school, I vaguely remember something about Laplace Transforms.)

In the real world there is usually some hysteresis (AKA "swing") so it goes slightly above and slightly below and relays don't switch on & off several times per second (or more) and "chatter", etc.. Something similar can be accomplished with a delay. That may not be required with solid-state switching.

On/Off control of Peltier is not a good idea. First the fast change of the current stress it mechanically, and second - it is not energy efficient, because in the moment when you turn it off, its thermal resistance becomes very small and you are loosing heat through it. When you turn it of with full power, you are driving it inefficiently, because the current generated heat on the hot side is proportional to the square of the current. The most appropriate method of driving Peltier is with variable current source. This is how the commercial Peltier controllers are working.

But you have to start somewhere.

Exactly, that's the only way to get off Top Dead Center. Otherwise, you'll be stuck in the Paralysis of Analysis.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.