T2 (second temp probe) control a port?

Do you have a question on how to do something.
Ask in here.
Post Reply
agentgreen
Posts: 97
Joined: Wed Jul 06, 2011 6:45 am

T2 (second temp probe) control a port?

Post 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!
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: T2 (second temp probe) control a port?

Post 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
agentgreen
Posts: 97
Joined: Wed Jul 06, 2011 6:45 am

Re: T2 (second temp probe) control a port?

Post by agentgreen »

Perfect!

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?

Post 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);
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: T2 (second temp probe) control a port?

Post by rimai »

Sure can. There is no Port 9 though.
Roberto.
chase
Posts: 101
Joined: Fri Sep 16, 2011 8:26 am

Re: T2 (second temp probe) control a port?

Post 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!
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: T2 (second temp probe) control a port?

Post by rimai »

No need for any include, but port 9 is invalid.
You have to use either:

Code: Select all

 ReefAngel.Relay.Off(Box1_Port1);
or

Code: Select all

 ReefAngel.Relay.Off(11);
You do need the #define RelayExp on the features file to enable the expansion relay box.
Roberto.
chase
Posts: 101
Joined: Fri Sep 16, 2011 8:26 am

Re: T2 (second temp probe) control a port?

Post by chase »

That's what it was, thanks!
Image
Post Reply