WC 32 well pump programming question

jzsjr

Member
Hello,
 
I want to connect a current sensor between the pressure switch and the the well pump to let me know when my pump is running too long and there might be a leak or other issue.  So when the current is sensed the the ttl goes to 1 I need something to either start a timer or a counter and then when this timer or counter hits a certain number an email will be sent out.  I looked over CAI documentation but did not see any programming information about the counter.  Can someone please help me out with this?
 
Thank you,
Jim
 
The way I generally do it (because one second granularity is fine, but I might a timer that can run for days), is to detect the change-of-edge (that's straightforward), and on a rising (or falling, or either, depending on function) - simply add your timer duration (in seconds) plus the current time (CTS) to a RAM/VAR.
 
Then, in your code, compare that value to CTS. As soon as it is "less than" CTS, your timer has expired.
 
 
  eg:
loop:
         xor   ip1  ram1b1       ; same as last time?
         bz same                     ; if same state as last time, ignore
         xor ram1b1 1 ram1b1  ; toggle the "last state" flag
         tsteq ram1b1 1          ; if it's a rising edge (just turned on)
         add 3600 CTS ram2  ; set (or re-trigger) a 1 hour timer
same:
.... stuff
         tstgt ram2 CTS           ; while ram2>CTS timer has not expired
         goto loop
     ... timer expired, do stuff here.
 
Couple of thoughts on your project. Depending on where you live outdoor watering may come into play. That will make it difficult to detect leaks by measuring pump on time. Be interesting to run an experiment to see if pump continues to cycle when watering and how long it stays on.  Small leaks will be undetectable as they look like normal water usage.
 
1)You could connect WebControl to leak sensors in areas where water is likely to collect. That is my plan but I have not actually added the sensors to an existing WebControl system yet. Once I do that plan on adding an interlock to the well pump to kill power if it detects a leak. 
http://www.grisk.com/images/product_pdfs/liquid_detection/2800_5v_dc_water_sensor.pdf
 
2)I use a well pressure switch with a low pressure cutout to detect large leaks or the well running dry. Pretty low tech but effective. At first I thought the extra complexity would make the pressure switch less reliable but it has been working fine for years.
 
The following is untested.  But it should send you an email once per day telling you how many seconds input 1 was on. You could write it slightly different to send you a message every time VAR1 gets above some number of cumulatively being on. Or another mod could be to only send you an email when IP1 is on continuously for longer than something. It seems to me that if you are looking for a leak, you would expect the pump to be on for more than x seconds in a give (24 hour) time period. That is how I wrote it. The program also runs continuously except for a 1.2 second hold after the email to prevent multiple emails. So you could use this CAI board to do other things without getting hung up in loops. You could get rid of that 1.2 second hold as well if you needed to, but it would require using a few more lines of code and a RAM or VAR value, or other flag.
 
START
TSTEQ IP1 1
CALLSUB CNTR
MOD CTS 86400 RAM2
TSTEQ RAM2 0
CALLSUB TELLME
END
 
CNTR:
TSTNE RAM1 CTS
GOTO CNTR1
RET
 
CNTR1:
INC VAR1
SET RAM1 CTS
RET
 
TELLME:
EMAIL . . .
DELAY 1200
SET VAR1 0
RET
 
Gentlemen,
 
Thank you very much for the ideas.  Ross, as always, you know how to manipulate these devices and cut to the chase.  
 
Tschmidt, I do have one of the low pressure sensing switches but wanted more information that the WC32 could provide looking more at when the pump is running than if water is actually leaking.  I figured it was easier to sense the pump running than placing sensors at "guess spots" where a leak may occur (which is what I do at my main residence using ISY and insteon wireless sensors).  The well, also, is only feeding water to the house and is not used for irrigation.  My first major leak with this system was after replacing my pressure tank I could not figure out why the pressure switch was not cutting off.  There turned out to be a nice sized pool behind bushes bubbling up from the ground where the water line goes into the house.  After replacing the tank and turning the water back on a bad pvc joint had pulled out.  I think because of this situation I'm more interested in know if the pump is continuously running especially if I am not there.  The low pressure switch was in place when this happened but I guess there was still enough pressure in the line to keep it from tripping.
 
Lou, guessing that the pump is running too long and there might be a leak is really a by product of what I want.  I do want to know how many times the pump is cutting on and how long it is running, which I believe you hit on.  The WC32 at my well house is currently sensing two temperature (inside and out) and already has a current sensor set up sensing when the small heater inside cuts on and off (with notification) so the new CS and program will be in addition to what it is already doing.
 
My programming is certainly rudimentary at best but I will play around with your suggestions and share what I come up with. 
 
Thank you,
Jim
 
jzsjr said:
Gentlemen,
 
Thank you very much for the ideas.  Ross, as always, you know how to manipulate these devices and cut to the chase.  
 
Tschmidt, I do have one of the low pressure sensing switches but wanted more information that the WC32 could provide looking more at when the pump is running than if water is actually leaking.  I figured it was easier to sense the pump running than placing sensors at "guess spots" where a leak may occur (which is what I do at my main residence using ISY and insteon wireless sensors).  The well, also, is only feeding water to the house and is not used for irrigation.  My first major leak with this system was after replacing my pressure tank I could not figure out why the pressure switch was not cutting off.  There turned out to be a nice sized pool behind bushes bubbling up from the ground where the water line goes into the house.  After replacing the tank and turning the water back on a bad pvc joint had pulled out.  I think because of this situation I'm more interested in know if the pump is continuously running especially if I am not there.  The low pressure switch was in place when this happened but I guess there was still enough pressure in the line to keep it from tripping.
 
Lou, guessing that the pump is running too long and there might be a leak is really a by product of what I want.  I do want to know how many times the pump is cutting on and how long it is running, which I believe you hit on.  The WC32 at my well house is currently sensing two temperature (inside and out) and already has a current sensor set up sensing when the small heater inside cuts on and off (with notification) so the new CS and program will be in addition to what it is already doing.
 
My programming is certainly rudimentary at best but I will play around with your suggestions and share what I come up with. 
 
Thank you,
Jim
 
 
You could also easily add a cycle count to the pump as well as a total time on count.  Typically you would run that on a 24 hour interval where you get one email per day telling you about the previous 24 hours.  Another twist would be to add a notification if the pump ran continuously for longer than some chosen number of seconds. 
 
Now it includes a cycle counter.  VAR2 would be how many times it switched on during the previous 24 hours and VAR1 would be the total seconds it was on during those hours.
 
 
START
TSTEQ IP1 1
CALLSUB CNTR
CALLSUB CYCLE
MOD CTS 86400 RAM2
TSTEQ RAM2 0
CALLSUB TELLME
END
 
CNTR:
TSTNE RAM1 CTS
GOTO CNTR1
RET
 
CNTR1:
INC VAR1
SET RAM1 CTS
RET
 
CYCLE:
TSTEQ IP1 0
CALLSUB CYCLE1
TSTEQ RAM2 1
RET
INC VAR2
SET RAM2 1
RET
 
CYCLE1:
SET RAM2 0
RET
 
TELLME:
EMAIL . . .
DELAY 1200
SET VAR1 0
SET VAR2 0
RET 
 
Here's another reason to monitor whether the well pump is running continuously.
 
The PVC pipe on my well pump developed a crack just above the pump after 30 years due to the twisting torque force developed by the pump motor each time it turned on.  Eventually, the crack became large enough that so much water was leaking out that the pump could never reach the cutoff pressure on the pressure switch.   Now, the pump has a well torque arrestor on it.  But back in the day when the pump was originally installed, they didn't use them.
 
In another case, a friend's well developed a leak on the foot valve due to galvanic corrosion between the valve and the pump fittings.  He eventually realized something was wrong when his electric bill was hundreds of dollars higher than normal for several months.
 
Both of these are leaks that would not be apparent if you don't monitor the pump.
 
Ral,
Funny you mention the galvanic corrosion.  Last week, before I added any of this programming to the WC32, I could hear the well running underneath the cap and my pressure switch was not cutting off.  I'm not comfortable pulling a well especially by myself, so I called the well company and gave them a great deal of information about what I thought was going on.  They came out and found the flex pipe to galvanized pipe at the top of the well was corroded and leaking.  They replaced with stainless.  If it is not one thing it is another.  
 
Apo,
I added your initial program into mine and can see the variable count within the UI but when the email is sent I don't see any variable  CTS numbers.  It is set to send all I/O in the email.  Thank you for adding the cycle information.  I will give that a try in a few days.  As of now for testing purposes I have the pump emailing me when it cuts on and off in addition to your initial program.  I would definitely be interested in how you would do the alert for continuous running.
 
Thank you,
Jim
 
I had a tubing leak in my well a couple of years ago.  I found it because my electric bill spiked up.   My utility installed a smart meter on my well, and I check the electric useage every couple of days.  (via their web app)   The consumption spiked noticeably when I had the leak.
 
I believe that your counter should catch a problem like I had.
 
If editing the PLC code using a text editor on computer, you could add ";" or "#" after each line of programming, then put comment behind it.
When pasted into WebControl GUI, anything starting with ";" or "#" including those comments will be stripped automatically. 
 
Sorry for not related to this discussion topic, just hope that will be helpful.
 
Lou,
 
I'm not really sure why I was referring to you using your last name.  One of those strange things where I focused in on Apo.
 
Jim
 
Lou,
 
I applied the cycle update and looked at var2 with in the UI and it was reading something like 2900.  I was not sure about your two returns in cycle: so I removed the first one.  Now I believe it is not working altogether.  I will play around with it and see if I can get it figured out.
 
Jim
 
Back
Top