Page 1 of 1

temperature controll

Posted: Thu Jan 05, 2012 5:06 pm
by Jordy101091
Hi, all

Im still working on my aquarium controller, everything works perfectly but one thing I can't figure out thats why I need your help.
For the temperature controller section of the software I need to make something like hysteresis so that the heater doesn't kick in on every change of temperature.

If I set the upper limit of the temperature to: 22.4
My goal temperature to: 22.0
and my lowest temperature to: 21.8

So that the heater kicks in when the temperature is 22.8 or below and stops when temperature reaches 22.1 or above.
I dont know on howto approach this problem. hope somebody can explain it to my.

Regards Jordy

Re: temperature controll

Posted: Thu Jan 05, 2012 5:30 pm
by Gary Freegard
Hi

I would try the following, or something similiar
  • if (new_temp-old_temp) > 0 then temp_up = 1
    if (new_temp-old_temp) < 0 then temp_up = 0

    if new_temp <=22.8 AND temp_up = 0 then heater on
    if new_temp >=22.1 AND temp_up = 1 then heater off
Goodluck

Gary

Re: temperature controll

Posted: Thu Jan 05, 2012 5:32 pm
by Steve
I think you just need to do the following every few seconds:

Code: Select all

  read temperature

  if (temperature < MIN_TEMPERATURE)
    turn heater on
  end if

  if (temperature > MAX_TEMPERATURE)
    turn heater off
  end if

Re: temperature controll

Posted: Thu Jan 05, 2012 6:47 pm
by Jordy101091
Thanks steve and gary for your quick reaction,

The solution steve has works best for me and tested this and works perfectly thanks for that.

Regards Jordy