Temp Sensor questions

edlentz

Member
I have had a CAI Web Control board for a couple of years now.  Mostly I use it to open and close my garage doors.  I have used a couple of temp sensors to monitor temps around my house.  Now I want to take it a little further.  I want to monitor my pool water temp and start my solar pump, keep track of the inlet / outlet temp so I don't inadvertantly cool down the pool.  In the manual there is an example using a chicken coop temp monitoring to turn on a heater.  The example uses C for the temp.  Does it matter in the PLC code whether it is F or C?  As long as the temp sensor setting is the same as the PLC code?  Using this code I could not get the relay to change state.

START
TSTLE T1 235
CALLSUB Pump_ON
TSTGT T1 294
CALLSUB Pump_OFF
END
Pump_ON:
SET OP4 1
RET
Pump_OFF:
SET OP4 0
RET

What am I doing wrong.\?   In this example I just wanted to see if I could get the output of OP4 to change, which it never did.  The Temp settings were set for C and the temp was 22C
 
Thanks in advance for any enlightenment.
 
I just built a pool solar heater,i have to add outside temp (ran out just ordered more)but for now this is what i am using
Code:
outputs used


op1 manual main pump
op2 e stop
op3
op4
op5 
op6 
op7 pump solar heater
op8 pool pump

t1 outside
t2 roof
t3 sloar water 
t4 
t5 pool water temp

var1 
var2 6 added to t5 for ck roof temp
var3 
var4 6 added to t5 start pump
var5 2 added to t5 stop pump
var6 
var7 
var8 

ram1 
ram2 
ram3 
ram4
ram5
ram6
ram7
ram8
ram9

em1 
em2 power reset
Code:
start
    email em2
    delay 2000
    set op1 0
    set op2 1
    set op7 0
    set op8 0
    

loop:
    add 60 t5 var2

    add 50 t5 var4

    add 20 t5 var5

    TSTEQ OP2 1  
    CALLSUB PH_OFF 

    tstgt t2 var2
    callsub pipetemp

    goto loop
    end

ph_off:
    set op7 0
    set op8 0
    goto loop
    ret

pipetemp:
    tstgt t3 var4
    set op7 1
    tstlt t3 var5
    set op7 0
    ret
 
You can use C or F, so that number will be the temperature in your selection times 10.  For example, 76.5F will be 765 in PLC code when temperature set to F.
 
In your PLC code, it seems when temperature is 22C, it should turn on OP4.  Did you use a voltmeter to measure the OP4 terminal without load?  Opx output is TTL level output with max current 10mA per output, 30mA max total output current.  Please make sure not overload the output.
 
you have start and end,you need a loop
Code:
START
loop:
 TSTLE T1 235
 CALLSUB Pump_ON
 TSTGT T1 294
 CALLSUB Pump_OFF
 goto loop
END
Pump_ON:
 SET OP4 1
RET
Pump_OFF:
 SET OP4 0
RET
 
pittom said:
you have start and end,you need a loop
 
I think the "loop" is implicit. While not what I'd call "best practice", when the program encounters "END" it resumes at "START" anyway.
(For simple code, this is probably ok, but more complex code, or code that has a startup/initialize section, it would be bad!)
 
edlentz said:
What am I doing wrong.\?
Is the pump on or off?
Is OP4 1 or 0?
Does the state of OP4 change with temperature?


If the pump is off when it should be on what is the status of OP4?
Could be the code is working correctly but the hardware is not able to control the pump.

22C is reported as 220 so should go to pump_on routine, setting OP4 high

What happens when the temp reaches 25.5, does the pump turn off? Does OP4 go to 0?

/tom
 
OP4 stays off no matter what i set T1 at.  I can manually set OP4 to 1 and it runs the relay to turn on the pump.  That is the way I have been using it so far.  So the temp either C or F has to be what it is set for in the device setup and it needs to be 3 digits.  I changed the temp in the code to below what the actual temp was and OP4 stayed at 0.  I am using a Sainsmart relay board that I have been using for several years to switch on the pump.
 
@edlentz, In the IO Setup screen, did you uncheck "Global PLC Enable"?   Or on that page, unchecked TTL output section PLC enable for the TTL output?
If you can manually set OP4 to 1 and turn on the relay, 0 to turn off the relay, that means the OP4 is working.
 
By factory default, Global PLC is enabled, all TTL outputs are controlled by PLC.  If you are not sure, a factory reset will bring it back to default setup.
 
Could you please let us know the firmware version?  It should not be a matter, since all PLC firmware versions when PLC execute and TTL is controlled by PLC, it should work.
 
If possible, do a factory reset by shorting the two reset pin then power up, then try to reconfigure the board again.
 
Back
Top