1
\$\begingroup\$

I'm building an insulated box in which I have about 5-6 liters of water which will be cooled/warmed by a Peltiers, driven by variable current. The setpoint will vary between 16 and 26 degrees C, and it will change gradually during a 24 hours cycle. The disturbance of the system is the outside temperature, in which the box will be placed. It is a room temperature, which change very slowly, mostly seasonally (almost no day/night change) between 19 and 29 degrees.

So as you can see, when the outside temperature is in between the inside temperature borders the Peltiers will need to switch directions from cooling to heating or opposite.

Another point that should be mentioned is that the Peltiers are more efficient (at cooling) when driven with lower current. Which means that when cooling it is not efficient to get to the setpoint fast and then stay there keeping the temperature. Also overshooting is not efficient too.

So my question is: what algorithm should I use in order to control the temperature in most energy efficient way?

Is it appropriate to change the setpoint in some short intervals, let say 5-10 minutes and use PID?

Or to measure somehow the speed of temperature change at the given power, then predicting if it enough to meet the setpoint at the needed time and correcting it if not.

Edit: Here is a step response of the system: enter image description here

The sensor that measure the inside temp is located very close to the water ouflow 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 lighs. The horizontal axis lines are on every hour. From this picture it cannot be seen, but the deadtime is really 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 time that the sensor allows. So for me it looks like a first order system, bit I still don't have idea how it will be best to control it. There are 2 problems. First one is - the regulator has a gap between 0 and 0.5A, in which I cannot control the peltier. The only thing I can controll is the speed of its cooling fan, which will change the temperature on the hot side, thus on the cold side. But I haven't experimented with this. Second problem is the heating part. Cooling is proportional to the current, but heating will be proportional to the current + to the square of the current, which to me seems that will complicate a lot switching between cooling and heating. And this switching should be done gradually, passing through zero.

\$\endgroup\$
7
  • \$\begingroup\$ About overshoot: placement of the water temperature sensor with respect to Peltier changes PID parameters greatly. Experiment with sensor position if you're able. Is water static or has inflow/outflow? \$\endgroup\$
    – glen_geek
    Commented Jun 21, 2023 at 23:04
  • \$\begingroup\$ irilinir, Are you saying that anything between 16 and 26 is fine and can just track ambient when in that range? Or did I hear in your words that you have a specific daily cycle in mind? Also, what about edge effects? \$\endgroup\$ Commented Jun 21, 2023 at 23:47
  • \$\begingroup\$ The water is constantly flowing and yes, there is a daily cycle. Something like this, hourly. 20, 20, 19, 19, 18, 18, 18, 17, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 24, 24, 22, 22, 21, 21 It will be reconfigurable, but most likely the speed of change won't be bigger than 1 degree per hour. I don't know what are "edge effects". \$\endgroup\$
    – irilinir
    Commented Jun 22, 2023 at 7:25
  • \$\begingroup\$ The question is a bit broad. The D in the PID regulator will process the speed of temperature changes. Give it a run and plot the thermal response. \$\endgroup\$
    – Jens
    Commented Jun 22, 2023 at 15:45
  • \$\begingroup\$ @Jens added manual step response \$\endgroup\$
    – irilinir
    Commented Jul 24, 2023 at 8:49

1 Answer 1

1
\$\begingroup\$

So my question is: what algorithm should I use in order to control the temperature in most energy efficient way?

There isn't a good way to do this if you want energy efficiency. The best control is likely a PID (I tried many different control schemes and the one that worked the best was PID for controlling to a set-point. MPC might also be a good way to go, and you can give MPC more control goals than just reaching the set point, but they are time consuming to implement and computationally expensive).

The best thing you can do is use the right circuit and use current control like you are doing. If you use PWM it's easier to implement but the peltier is fully off or fully on, you can use a filter to kind of do a current control with PWM, but you'll lose energy in the filter.

Is it appropriate to change the setpoint in some short intervals, let say 5-10 minutes and use PID?

Yes you can and the slower you set the PID the less energy it will use because it won't try an eliminate the error immediately (if you set the PID to come in fast then there will be a larger error and it will try to run a higher current and use more energy). So you will have to set the PID to balance between energy use and how fast it goes to the control point.

Peltiers can be modeled but this is really difficult to come up with a good pelteier model as many parameters need to be molded and they change over temperature such as seebeck coefficient, thermal conductivity and electrical resistance.

\$\endgroup\$
5
  • \$\begingroup\$ I need to read about MPC. I will controll the peltiers by DC - DC buck convertor. I have modified the current control and now it has digital potentiometer instead of the normal one. So I have 255 values at disposal. The drawback is that I cannot go bellow certain current (about 0.7-0.9A) because the regulator provide below about 1.4V, but I'll play a little bit more with the circuit to lower this border. However, I can turn it off easily when needed. \$\endgroup\$
    – irilinir
    Commented Jun 22, 2023 at 16:32
  • \$\begingroup\$ I was thinking about something like this: Divide the hour interval in smaller ones, for example 6 minutes. If I consider that the outside temperature is almost constant in one hour interval, its influence of the internal volume will be even closer to constant too. So I start the first 6 minutes with low power and measure the temperature at the end of this period. Then I calculate the speed of change and try to estimate if this speed is enough to get to the setpoint at the end of the hour interval. If it is not, then I recalculate the needed power and increase it. Then repeat. \$\endgroup\$
    – irilinir
    Commented Jun 22, 2023 at 16:39
  • \$\begingroup\$ Also I can read the outside temperature and make some adjustments of the starting power. For example if I have outside temp of 29 degrees and I need to heat from 17 to 18 degrees, I could start with peltier turned off and check if the outside temp influence is not enough, and even correct in the negative direction if it is too much. But if the outside temperature is 20 degrees and I need to go from 24 to 25 degrees, I will need to start with heating directly. \$\endgroup\$
    – irilinir
    Commented Jun 22, 2023 at 16:51
  • \$\begingroup\$ I have an additional question. Is the described system a first order system, and what exactly determines its DC gain? The time constant depends on the water volume (capacity) and heat resistance, but what the gain depends on? I presume that I will need to change the Kp of the PID on some conditions (changing water volume, switching between heating and cooling, as the peltier cooling is proportional to the current, but heating is to the current + the square of the current). But do I need to change it on changes of outside temperature? \$\endgroup\$
    – irilinir
    Commented Jul 21, 2023 at 20:03
  • \$\begingroup\$ Please use the voting and answer system \$\endgroup\$
    – Voltage Spike
    Commented Jul 21, 2023 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.