温度调节电路Arduino

时间:2019-03-24 16:54:15

标签: algorithm arduino temperature

我目前正在使用arduino开发水流控制系统。目的是我可以使用arduino设置水流的温度。

我的外壳呈Y形。在Y形件的左上臂上,我有大约12°C的恒定冷水流。在Y形件的右上臂上,有一个阀门,可以调节加入的热水量。热水的温度约为50°C。为了调节热水的摄入量,我使用了伺服马达,该马达将阀门摇到某个位置。 在Y的下部,我有一个温度传感器,可以告诉我水的混合温度。

我想出的将水混合到特定温度的算法如下:

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.

在现实生活中,这种方法是否完全可行?其他温度调节电路如何完成?

1 个答案:

答案 0 :(得分:0)

这基本上可以工作,但是您应该解决几个问题:

  1. 伺服位置和温度之间的关系不是线性的。至少要在4个不同的位置进行校准并拟合三次多项式。

  2. 因为阀具有很大的摩擦力,并且现成的伺服器中的定位算法并不出色,所以当您命令从较低位置移至位置“ X”时,它所到达的位置是与您命令从较高位置移至相同位置“ X”时的位置不同。您应该校准不同的曲线以提高温度和降低温度,并确保命令缓慢地接近所需温度的运动以获得可重复的结果。

  3. 一旦根据校准曲线到达正确的位置,如果温度下降,则可以朝其缓慢移动并调整校准。您可能想假设误差是由于输入温度的差异而引起的,并相应地进行调整。