Page 1 of 1
T2 (second temp probe) control a port?
Posted: Mon Sep 19, 2011 6:24 am
by agentgreen
Is there a way for me to turn on and off certain ports based on the temperature of T2?
Right now T2 is monitoring my canopy temp. I want my canopy fans to come on when the temp gets above say 85 degrees, and turn off when it gets below 80.
Thanks!
Re: T2 (second temp probe) control a port?
Posted: Mon Sep 19, 2011 6:35 am
by binder
agentgreen wrote:Is there a way for me to turn on and off certain ports based on the temperature of T2?
Right now T2 is monitoring my canopy temp. I want my canopy fans to come on when the temp gets above say 85 degrees, and turn off when it gets below 80.
Thanks!
Yes, you can. You will have to handle this in your PDE file and will not be able to use the StandardFan functions. It's pretty simple. Here is the existing code:
Code: Select all
if (Params.Temp1 == 0) return; // Don't turn the fan/chiller on if the temp is reading 0
if (Params.Temp1 >= HighTemp) Relay.On(FanRelay); // If sensor 1 temperature >= HighTemp - turn on fan
if (Params.Temp1 <= LowTemp) Relay.Off(FanRelay); // If sensor 1 temperature <= LowTemp - turn off fan
So, what you would do inside your PDE file is something like this: (this code goes in your loop() where you would put the StandardFan function).
Code: Select all
void loop()
{
// ... other functions here
// Turn on Port6 when the temp gets above 85.0 degrees
if ( ReefAngel.Params.Temp2 >= 850 ) ReefAngel.Relay.On(Port6);
// Turn off Port6 when the temp goes below 80.0 degrees
if ( ReefAngel.Params.Temp2 <= 800 ) ReefAngel.Relay.Off(Port6);
}
The temperature values that are used in the code are 3 (or 4, if over 100) digit values. The farthest right digit (the singles digit) is for the decimal value. So 861 equals 86.1F and 736 equals 73.6F. If you are using C, it works the same except the value is for C.
You will just need to change Port6 to be whatever port you have your fans plugged in. And make sure you do not use StandardFan on that port either otherwise it will work on the ports as well and you will get undesirable results.
curt
Re: T2 (second temp probe) control a port?
Posted: Mon Sep 19, 2011 6:39 am
by agentgreen
Perfect!
Love the support for this controller!
Re: T2 (second temp probe) control a port?
Posted: Sun Nov 20, 2011 6:14 pm
by chase
Could I use this to turn a secondary heater on and off between 76 and 77 (I defined port 9 as Heater2)?
Code: Select all
//Temp 2 settings
// Turn on Heater2 when the temp < 76.0 degrees
if ( ReefAngel.Params.Temp2 <= 760 ) ReefAngel.Relay.On(Heater2);
// Turn off Heater2 when the temp > 77.0 degrees
if ( ReefAngel.Params.Temp2 >= 770 ) ReefAngel.Relay.Off(Heater2);
Re: T2 (second temp probe) control a port?
Posted: Sun Nov 20, 2011 6:17 pm
by rimai
Sure can. There is no Port 9 though.
Re: T2 (second temp probe) control a port?
Posted: Sun Nov 20, 2011 6:46 pm
by chase
rimai wrote:Sure can. There is no Port 9 though.
Oh, I thought on the relay expansion box port 1 is port 9? I forgot to mention that in the original post. Also, do I need any includes in the beginning to use temp2 readings? Assuming port 9 is valid on the relay box the code didn't work, that's why I ask. Thanks for the help!
Re: T2 (second temp probe) control a port?
Posted: Sun Nov 20, 2011 6:51 pm
by rimai
No need for any include, but port 9 is invalid.
You have to use either:
or
You do need the #define RelayExp on the features file to enable the expansion relay box.
Re: T2 (second temp probe) control a port?
Posted: Sun Nov 20, 2011 9:33 pm
by chase
That's what it was, thanks!