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?