PC liquid cooling HC-500A water chiller controller (need guidance)

Hi all,
Looking for some guidance on this project as am current stuck on the code, and am not finding any projects the are enough of the same thing. I am trying to control a Hailea HC-500A aquarium water chiller for my PC cooling loop I have running through it. I want to be able to setup a high and low set temperatures for turning it on and off. I found the sundfounder thermostatic water tank tutorial as a great starting place as it has the basics. So I could use some guidance on:

-how to work with the existing 2 wire temperature probe currently install in the chiller and hooking it up to the arduino(Confused about the differences for 2 and 3 wire temp probes). Currently just testing code with a thermistor
-currently stuck on using the rotary encoder to set the 2nd temp value. It jumps over if statement code to set the lower temp.

here is my code so far.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "encoder.h"
#include <EEPROM.h>
LiquidCrystal_I2C lcd(0x27,16,2);
ENCODER encoder;
#define buttonPin 10 //the key attach to
#define temPin A0 //the thermistor attach to 
#define relayPin 2 //the relay attach to
#define ledPin 13
float upperTem = 0.00;  //set upper limit temperature value
float lowerTem = 0.00;  //set lower limit temperature value
#define beta 3950 //the beta of the thermistor
#define resistance 10 //the value of the pull-down resistor
float hysteresis = 0.25;

void setup()
{
  pinMode(relayPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  digitalWrite(relayPin, HIGH); 
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Water Chiller ");
  lcd.setCursor(0, 1);
  lcd.print(" Controller ");
  encoder.Init(7, 6, 5);// Init(CLKPIN, DTPIN, SWPIN)
  pinMode(buttonPin, INPUT);
  upperTem = EEPROM.read(0);
  lowerTem = EEPROM.read(1);
  Serial.begin(9600); // print serial 
  delay(1000);
  lcd.clear();
}

void loop()
{
  if(digitalRead(buttonPin) == 0)
  {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" Set Mode ");
    lcd.setCursor(0, 1);
    lcd.print(" start... ");
    delay(500);
    lcd.clear();
    while(1)
    { 
      lcd.setCursor(0, 0);
      lcd.print("Set Upper ");
      lcd.print(char(223));
      lcd.print("C: ");
      float change = encoder.turnSettle();
      upperTem = upperTem + change;
      lcd.print(upperTem,0);
      if(encoder.pressed())
      {
        EEPROM.write(0, upperTem);
        lcd.setCursor(0, 1);
        lcd.print("Set Lower ");
        lcd.print(char(223));
        lcd.print("C: ");
        float change = encoder.turnSettle();
        lowerTem = lowerTem + change;
        lcd.print(lowerTem,0);       
        if(encoder.pressed())
          {
          EEPROM.write(1, lowerTem);
          //delay(100);
          lcd.setCursor(0, 0);
          lcd.print("Temp High: ");
          lcd.print((float) EEPROM.read(0));
          lcd.setCursor(0, 1);
          lcd.print("Temp Low:  ");
          lcd.print((float) EEPROM.read(1));
          delay(1000);
          lcd.clear();
          break;
          }
      }
    }
  }
  else
  {
    //read thermistor value 
    long a = 1024 - analogRead(temPin);
    //the calculating formula of temperature
    float tempC = beta /(log((1025.0 * 10 / a - 10) / 10) + beta / 298.0) - 273.0;
    float tempF = 1.8*tempC + 32.0;
    // set the cursor to column 0, line 0 
    lcd.setCursor(0, 0);
    lcd.print("T:");lcd.print(tempC, 1);lcd.print(char(223));lcd.print("C/");
    lcd.print(tempF, 1);lcd.print(char(223));lcd.print("F");
    lcd.setCursor(0, 1);
    lcd.print("L/H:");lcd.print(lowerTem,0);lcd.print(char(223));lcd.print("C/");lcd.print(upperTem,0);lcd.print(char(223));lcd.print("C");
    delay(100); //wait for 100 milliseconds 
    if(tempC <= upperTem + hysteresis) //turns chiller on above set temperature
    {
      digitalWrite(relayPin, HIGH); 
      digitalWrite(ledPin, HIGH);
    }
    else if(tempC > upperTem - hysteresis)   //turns chiller off below set temperature
    {
      digitalWrite(relayPin, LOW); 
      digitalWrite(ledPin, LOW);
    }
  }
}
float upperTem = 0.00;  //set upper limit temperature value
float lowerTem = 0.00;  //set lower limit temperature value

EEPROM.write(0, upperTem);
EEPROM.write(1, lowerTem);

upperTem = EEPROM.read(0);
lowerTem = EEPROM.read(1);

A float is four bytes. You can not put them in one byte of the eeprom memory. Please look at the examples which come with EEPROM.h to see how to use eeprom.put() and eeprom.get() with your float variables.

It should not stop regulating temperature while you're changing the values. If you leave it sitting in that mode then it may overheat.

It's also fun to change the temperatures and have the fan start/stop while you're doing it. It's one more check that it's working properly.

cattledog:
A float is four bytes. You can not put them in one byte of the eeprom memory. Please look at the examples which come with EEPROM.h to see how to use eeprom.put() and eeprom.get() with your float variables.

Thanks, I changed the code based on your suggestion and reading up on that. I just changed all the FLOAT write values to INT seeing I dont need to deal with decimals for a saved temperature value. (doesnt need to be that exact)

So now am back to the issue on the code is skipping over my 2nd IF statement for setting the lower temp. I believe its because of the WHILE(1) loop. Is the parameter of 1 in that meaning TRUE for the whether the encoder button is pressed? Therefore skipping over the IF statement?

It should not stop regulating temperature while you're changing the values. If you leave it sitting in that mode then it may overheat.

Yes, the structure of the program with the blocking while() loop for setting the temperatures is not ideal.

So now am back to the issue on the code is skipping over my 2nd IF statement for setting the lower temp. I believe its because of the WHILE(1) loop. Is the parameter of 1 in that meaning TRUE for the whether the encoder button is pressed? Therefore skipping over the IF statement?

I think there are several logical errors with the while loop and the nested if statements. The entire program should be recrafted as non blocking, probably as a state machine. But that said, try what you have with these control variables for the movement through the while loop(). This snippet is untested and has the incorrect eeprom code. It may not work, but should give you some ideas of how to use boolean control variables.

 while (1)
  {
    static boolean lowerIsSet = true;
    static boolean upperIsSet = false;

    if (upperIsSet == false)
    {
      lcd.setCursor(0, 0);
      lcd.print("Set Upper ");
      lcd.print(char(223));
      lcd.print("C: ");
      float change = encoder.turnSettle();
      upperTem = upperTem + change;
      lcd.print(upperTem, 0);
      if (encoder.pressed())
      {
        EEPROM.write(0, upperTem);
        upperIsSet = true;
        lowerIsSet = false;
      }
    }

    if (lowerIsSet == false)
    {
      lcd.setCursor(0, 1);
      lcd.print("Set Lower ");
      lcd.print(char(223));
      lcd.print("C: ");
      float change = encoder.turnSettle();
      lowerTem = lowerTem + change;
      lcd.print(lowerTem, 0);
      if (encoder.pressed())
      {
        EEPROM.write(1, lowerTem);
        lowerIsSet = true;
      }
    }

      if(upperIsSet==true && lowerIsSet==true)
      {
      //delay(100);
      lcd.setCursor(0, 0);
      lcd.print("Temp High: ");
      lcd.print((float) EEPROM.read(0));
      lcd.setCursor(0, 1);
      lcd.print("Temp Low:  ");
      lcd.print((float) EEPROM.read(1));
      delay(1000);
      lcd.clear();
      upperIsSet = false;//re initialize
      break;
    }
  }