10

I have following setup:

  • Arduino Duemilanove
  • Small water heater connected with optical relay (PWM is ok)
  • Waterproof DS18B20 temperature sensor
  • Unknown amount of water (but temperature sensor and heater are always underwater).

How can I accurately control water temperature, based on temperature sensor readings? By accurately, I mean up to accuracy of temperature sensor (in this case, ±0.5°C). Everything should run on Arduino, so no additional data storage or processing power is available. For debugging, I can obviously use computer.

I have tried running PID, but it seems really hard to

  1. Avoid overshooting - going over target temperature either initially, or when (cold) water is added
  2. Stabilize properly after adding cold water.
6
  • Did you tune your PID, or were you just using standard values? Commented Feb 21, 2014 at 15:06
  • I tried to tune PID parameters with various 'how to tune PID' guides, with no luck. I also tried PIDAutotune, but couldn't get anything better out from it. I'm not saying PID could not fit to this.
    – Olli
    Commented Feb 21, 2014 at 15:45
  • With water heating, you are going to have a lot of inconsistencies. Where is the heater in your tank relative to the temperature probe?
    – Matt Clark
    Commented Mar 4, 2014 at 4:01
  • 1
    You'd probably have to add something that mixes the water to homogenize the temperature throughout. Then you'd have to take into account the thermal properties of your heating element, how long it takes to cool off after disabled, etc... It is dependent on how much water is in the system as well. If you can control the temperature of the heating element, that would go a long way.
    – Daniel
    Commented Mar 5, 2014 at 19:15
  • Not part of your issue ATM, but worth noting: Don't confuse accuracy, precision, and repeatability. Accuracy means how close the reported temperature is to the actual temperature. Precision is the smallest difference the device can distinguish (.0625 degC for DS18b20). Repeatability is how much reported measurements of the same temperature vary from one another. The last two are of more concern than the first. Even with +/-0.5degC accurate sensor, you could still hold temperature to within (or at least distinguish differences, which is a necessary condition) of a few 1/16ths degC....
    – JRobert
    Commented Mar 6, 2014 at 22:46

1 Answer 1

3

You need to know the response time of your system and the repeatability of your measurements to characterize your data (establish confidence). I suggest taking samples and average them before turning the heater back on.

Imho, water will not happily stay within 0.5°C. Can you allow for coarse and fine modes? Use a higher PWM for great differences and then lower PWM for when close to target.

Once homed in on your target, there are a few means you can try to improve temperature stability. While pre-built things like PID work for many, I normally implement functionality like this manually.

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.