我目前正在使用 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.
当涉及到现实生活中的实现时,这种方法是否可行?其他热调节电路是怎么做的?
最佳答案
这基本上可以工作,但是您应该解决几个问题:
伺服位置和温度之间的关系不会是线性的。至少在 4 个不同位置进行校准并拟合三次多项式。
因为阀门有很大的摩擦力,而且现成的伺服系统中的定位算法并不出色,所以当您命令从较低位置移动到位置“X”时,它到达的位置是当您命令从更高位置移动到相同位置“X”时,它到达的位置不同。您应该针对升温和降温校准不同的曲线,并确保您命令的运动缓慢接近所需温度,以获得可重复的结果。
根据校准曲线到达正确位置后,如果温度不合适,您可以慢慢朝它移动并调整校准。您可能想假设错误来自输入温度的差异并相应地进行调整。
关于algorithm - 温度调节电路Arduino,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55326201/