-1

I am currently working on a water flow control system using an arduino. The goal is that I can set the temperature of the water stream using the arduino.

I have a Y shaped part of hosing. On the upper left arm of the Y piece I have a constant stream of cold water, around 12°C. On the upper right arm of the Y piece I got a valve with which I can regulate how much hot water I mix in. The hot water is around 50°C. To regulate the hot water intake I am using a servo motor, which cranks the valve to a certain position. On the lower part of the Y I got a temperature sensor which tells me the mixed temperature of the water.

The algorithm I came up with to mix water to a specific temperature looks like this:

1. Calibrate by calculating the minimum and maximum temp and corresponding servo positions
1.1 set the servo position to the absolute minimum, wait for 10 seconds and get the temperature -> minTemperature, minPos
1.2 set the servo position to the absolute maximum, wait for 10 seconds and get the temperature -> maxTemperature, maxPos

2. Set the mixing temperature to X°C
2.1 (maxTemp-minTemp)/(maxPos-minPos) = p °C/pos
Which means that changing the position by 1 position changes the mix temperature by p °C
2.2 minPos + (x-minTemp) / p = targetPos

3. If abs(measuredTemp-x)>Tolerance than do 2.

Is this approach viable at all, when it comes to real life implementation? How are other heat regulation circuits done?

faxe1008
  • 35
  • 7
  • Looks like [PID](https://en.wikipedia.org/wiki/PID_controller) is what you want. Don't expect the proportionality across the entire range of servo positions. – user58697 Mar 24 '19 at 20:14

1 Answers1

0

This will basically work, but there are a couple problems you should fix:

  1. The relationship between servo position and temperature is not going to be linear. At minimum, calibrate at at 4 different positions and fit a cubic polynomial.

  2. Because a valve has a lot of friction, and the positioning algorithms in off-the-shelf servos are not awesome, the position it goes to when you command a move to position 'X' from a lower position is not the same as the position it goes to when you command a move to the same position 'X' from a higher position. You should calibrate different curves for increasing temperature and decreasing temperature, and make sure you command motion that approaches a desired temperature slowly in order to get repeatable results.

  3. Once you get to correct position according to the calibrated curves, if you temperature is off you can move slowly toward it and adjust the calibration. You probably want to assume that the error comes from a difference in the input temperature and adjust accordingly.

Matt Timmermans
  • 53,709
  • 3
  • 46
  • 87