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!
T2 (second temp probe) control a port?
-
binder
- Posts: 2865
- Joined: Fri Mar 18, 2011 6:20 pm
- Location: Illinois
- Contact:
Re: T2 (second temp probe) control a port?
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: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!
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
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);
}
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
-
agentgreen
- Posts: 97
- Joined: Wed Jul 06, 2011 6:45 am
Re: T2 (second temp probe) control a port?
Perfect!
Love the support for this controller!
Love the support for this controller!
-
chase
- Posts: 101
- Joined: Fri Sep 16, 2011 8:26 am
Re: T2 (second temp probe) control a port?
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);
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
-
chase
- Posts: 101
- Joined: Fri Sep 16, 2011 8:26 am
Re: T2 (second temp probe) control a port?
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!rimai wrote:Sure can. There is no Port 9 though.
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: T2 (second temp probe) control a port?
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.
You have to use either:
Code: Select all
ReefAngel.Relay.Off(Box1_Port1);
Code: Select all
ReefAngel.Relay.Off(11);
Roberto.
-
chase
- Posts: 101
- Joined: Fri Sep 16, 2011 8:26 am
