PICAXE-based tank pump controller
This circuit was developed to control a pump which transfers water between
two large tanks on a steep block in suburban Melbourne. The lower tank receives
all the roof water and tops up the top tank via a pump. The top tank then
supplies the house.
Both tanks have sensor switches which are open when the water level is low.
When the lower tank is empty, its sensor (S1) prevents the pump from switching
on by turning off transistor Q1 which means than P4 (pin 3) on IC1 is held
high.
The program prevents false triggering due to ripples as the lower tank is
filling, as 50 consecutive true values at 100ms intervals have to be counted
before the pump is switched on. If any of the 50 counts is false, the counter
resets and starts again. This is to prevent the inrush of water to an almost
empty tank generating false triggering to start the pump.
When the lower tank has water above the sensor and the upper tank water level
is below its sensor (S2), IC1 turns on Q5 and relay RLY1 to switch the pump on.
When sensor S2 subsequently closes (ie, when the top tank is full), Q2 turns on
and pulls P3 of IC1 low. The pump is then kept on for another 30 seconds to
ensure the water level is higher than its switch off point.
The program has a safety cut-off for the pump if it has been running
continuously for approximately 30 minutes to guard against a failed tank sensor.
If the pump has run continuously for 30 minutes, the pump is stopped and the
LEDs alternately flash at a very fast rate so both appear to be on at once. This
state requires that the controller must be manually reset by powering off and on
after checking for sensor failure. This is to prevent either overflowing the top
tank or running the pump dry for an extended period.
The pump and its controller are mounted outside (eg, under the house), while
the remote indicator is used inside. When the lower (collection) tank is low,
LEDs 1 & 2 (green & red) flash alternately at 0.25-second intervals.
When the program is detecting the lower tank level, the red LED (LED2) is on.
When the pump is on, LED1 is on and when the top tank is full, LED1 is on for 1
second and LED2 is on for 0.25 seconds, alternately.
The top tank has a commercial sensor but to avoid having to drill a hole low
in the bottom tank, a float sensor was made out of a heavy-duty plastic bottle
fitted with a mercury switch and well sealed in silicone sealant. The neck of
the bottle and the output lead were connected to a brass weight, sealed with
epoxy resin and waterproofed with silicone.
The sensor is forced to float in the horizontal plane by the length of wire
set to the minimum water level. As the water rises, the weight inverts the
bottle and the mercury switch closes its contacts.
Paul Walsh,
Montmorency, Vic.
Tank Sensor Program
| 'Red LED means water ripple check float sensor |
| 'Green LED means pump is on |
| 'Slow equal flash means lower tank is empty |
| 'Slow green & fast red means top tank is full |
| 'Red & green both appear on means pump on for 30
min needs manual reset, |
| 'possible tank sensor fault |
|
|
| Main: |
| low 2 | 'pump off |
| low 1 | 'red LED |
| if pin3=1 and pin4=0 then Checktt | 'TT might be low, LT has water |
| if pin3=0 then TToff | 'TT full |
| if pin3=1 and pin4=1 then LToff | 'TT is low, LT has no water |
|
|
| Checktt: |
| wait 1 |
| if pin3=0 then Main | 'check to see if correct |
|
|
| b0=0 | 'reset variable b0 LT low counter | | b1=0 | 'reset variable b1 LT Ok counter | | b2=0 | 'reset variable b2 10msec counter | | b3=0 | 'reset variable b3 25 second counter |
| do while pin3=1 | 'TT is low |
| findstatus: |
| if pin4=1 | 'LT is low |
| b1=0 | 'reset variable b1 |
| pause 100 |
| inc b0 | 'increment variable b0 |
| inc b2 | 'increment b2 |
| if b0=50 then LToff | 'if variable counts to 20 then exit loop |
|
|
| elseif pin4=0 then | 'LT is high |
| b0=0 | 'reset variable b0 |
| pause 100 |
| inc b1 | 'increment variable b1 |
| inc b2 | 'increment b2 |
| if b1=50 then runpump | 'if variable counts to 20 then run the pump |
| endif |
|
|
| if b2>250 then | 'increment b3 at 25 second intervals |
| inc b3 |
| b2=0 | 'and reset 10msec counter | | endif |
|
|
| if b3=64 then Allstop | 'if pump running for 30 minutes then 'stop
in case of failure |
|
|
| goto findstatus |
| runpump: |
| b1=0 | 'reset variable b1 |
| high 2 | 'pump on |
| high 1 | 'Green LED on |
| loop |
|
|
| wait 30 |
| low 2 | 'pump off |
| if pin3=0 then TToff | 'TT full |
| if pin3=1 and pin4=1 then LToff | 'TT not full, LT has no water |
|
|
| TToff: |
| high 1 | 'TT full, green LED with fast red flashes |
| wait 1 |
| low 1 |
| pause 75 |
| if pin3=1 then Main | 'TT not full |
| goto TToff |
|
|
| LToff: |
| low 2 | 'pump off |
| high 1 | 'flash LEDs |
| pause 250 |
| low 1 |
| pause 250 |
| if pin4=0 then Main | 'LT has water |
| goto LToff |
|
|
| Allstop: |
| low 2 | 'pump off |
| high 1 |
| pause 10 | 'fast flash leds both appear to be on |
| low 1 |
| pause 10 | 'requires manual restart |
| goto Allstop |
|