I hope someone can help me with this.
The project is a catchment tank for my wife's laundry, she wants to save the water and direct it to some trees in the garden.
I have written a small simple program to control a water pump. In simulation mode it works fine, but in practice it has a strange behavior like switching on and off instead of staying on.
The circuit has 3 float switches. The bottom float switch is used to keep the pump going until the water has been emptied from the tank. The second switch is the high level trigger that turns on the pump. The third and top switch is to show an alarm state if for some reason the water has climbed too high in the tank.
When running on the computer in simulation mode it works flawlessly. the tank can fill, pass the first float switch and when the water level reaches the second float switch, the pump turns on and starts to empty the tank. When the bottom float switch has been reached, a delay timing is used to let a further amount be emptied before shutting off.
The top float switch just turns on a flashing RED LED as a warring.
In practice, the system sort of works, but the pump which is activated by a solid-state relay pulses on and off and doesn't stay on as it should.
In test mode I substituted a LED for the SSR to see how it works, in real life, I have both the SSR and the LED working, but it is pulsing on and off. Tried with the LED only and also the SSR only, same thing happens.
Here is a copy of the BAS file that I wrote, maybe have done something wrong, although in simulation it works fine.
;Pin 3 top float sensor, pin 1 bottom float sensor, pin 0 ?pump? power through solidstate relay, pin 2 ?alarm? LED
start:
low C.0
low C.4
input 2
main:
if pinC.3 = 1 then pump
if pinC.2 = 1 then alarm
goto main
pump:
high C.0
pause 20000 ; tried to give it a pause to keep the pin on longer
if pinC.1 = 1 then pump
if pinC.1 = 0 then pump_off
goto main
pump_off:
for b1 = 1 to 5 ; make a delay to empy tank more before turning off ?pump?
pause 1000
next b1
low C.0
goto main
alarm:
high C.4
for b1 = 1 to 2
pause 5000
next b1
goto start
The project is a catchment tank for my wife's laundry, she wants to save the water and direct it to some trees in the garden.
I have written a small simple program to control a water pump. In simulation mode it works fine, but in practice it has a strange behavior like switching on and off instead of staying on.
The circuit has 3 float switches. The bottom float switch is used to keep the pump going until the water has been emptied from the tank. The second switch is the high level trigger that turns on the pump. The third and top switch is to show an alarm state if for some reason the water has climbed too high in the tank.
When running on the computer in simulation mode it works flawlessly. the tank can fill, pass the first float switch and when the water level reaches the second float switch, the pump turns on and starts to empty the tank. When the bottom float switch has been reached, a delay timing is used to let a further amount be emptied before shutting off.
The top float switch just turns on a flashing RED LED as a warring.
In practice, the system sort of works, but the pump which is activated by a solid-state relay pulses on and off and doesn't stay on as it should.
In test mode I substituted a LED for the SSR to see how it works, in real life, I have both the SSR and the LED working, but it is pulsing on and off. Tried with the LED only and also the SSR only, same thing happens.
Here is a copy of the BAS file that I wrote, maybe have done something wrong, although in simulation it works fine.
;Pin 3 top float sensor, pin 1 bottom float sensor, pin 0 ?pump? power through solidstate relay, pin 2 ?alarm? LED
start:
low C.0
low C.4
input 2
main:
if pinC.3 = 1 then pump
if pinC.2 = 1 then alarm
goto main
pump:
high C.0
pause 20000 ; tried to give it a pause to keep the pin on longer
if pinC.1 = 1 then pump
if pinC.1 = 0 then pump_off
goto main
pump_off:
for b1 = 1 to 5 ; make a delay to empy tank more before turning off ?pump?
pause 1000
next b1
low C.0
goto main
alarm:
high C.4
for b1 = 1 to 2
pause 5000
next b1
goto start