Hi Guys,
I got the chiller working with Kflop control! I powered the sensors with 5v through a 390 ohm resistor and fed signal into kanalog and got around 3.800 volts. Voltage would change in 0.004 increments based on temperature. Im guessing each increment might be a degree? But not really sure. At least it gives me a voltage thats changing that i can use to control it.
Did a little program to compare temperature and delay starting chiller since it needs 3 minutes for pressure to equalize before restarting. Also added a delay to stop, to force chiller to run for a period of time. And it all seems to be working great. Thanks to those that helped. Heres the code im using incase it might help somebody sometime:
Code:
// From Spindle chiller on off timer
int timechiller = 0; // for spindle chiller timer
int timehot = 0; // for spindle chiller timer
int Hot = 0; // for spindle chiller, 1 if coolant hot, 0 if normal
double ambienttemp = 0;
double coolanttemp = 0;
double tempdiff = 0;
// End spindle chiller timer
for(;;)
{
// Spindle chiller on and off
coolanttemp = KANALOG_CONVERT_ADC_TO_VOLTS(ADC(4));
ambienttemp = KANALOG_CONVERT_ADC_TO_VOLTS(ADC(5));
tempdiff = coolanttemp - ambienttemp;
if (tempdiff > 0.01)
{
Hot = 1;
}
else
{
Hot = 0;
}
int TT=Time_sec(); // get current Time_sec
if (timechiller != TT && Hot == 1) // if coolant too hot and one second passes, add 1 to timehot
{
timehot = timehot + 1;
timechiller = TT;
//printf("Hot. temp difference is %f\n",tempdiff);
}
if (timechiller != TT && Hot == 0) // if coolant normal and one second passes, subtract 1 to timehot
{
timehot = timehot - 1;
timechiller = TT;
//printf("Normal. temp difference is %f\n",tempdiff);
}
if (timehot > 180 && !ReadBit(55)) SetBit(55); // if timehot greater then 180 sec and chiller off, turn chiller on
if (timehot < -300 && ReadBit(55)) ClearBit(55); // if timehot less than time off and chiller on, turn off
if (Hot == 1 && ReadBit(55)) timehot = 1; // if Hot and chiller on, reset counter to 1
if (timehot < 1 && !ReadBit(55)) timehot = 1; // if timehot less 1 and chiller off, reset counter to 1
// End Spindle chiller on and off
}