Won't restart after delay

Hello
i make some automatic filling system for my aquarium. actually this code work fine. The problem happen if the fresh water container empty and im late to fill with the new fresh water.

The idea is sensor read the water level and if the level below the desire it will turn on pump to fill the tank with the delay 15s (the pump will on for 15s then off) if the water reach the sensor no problem will occurs. but if the water cant reach the pump it will stop working until i restart the arduino or lower the sensor to the water then place it again in the original place (need to manually restart the sensor value to make it work again)

for information if i didn’t use the delay node everything work fine even if the water can’t reach the sensor then it will turn on the pump until the water reach the desire level.

i choose to using delay because the sensor is sensitive if not using delay the relay will on off on off in short time and i believe it will short the relay age and make some annoying noise :sweat_smile:

can someone help me solve this issue?
i upload my code for more details
Thanks
ATONEWv2.xodball (3.4 KB)

Hello!

Here’s your patch for reference:

It stops working until a new pulse to delay, that is when greater outputs false and then true again, that is util the water overflows and underflows again.

I am not sure what behavior you’re trying to achieve if the fresh water tank is empty? If you want to keep trying until the water sensor is reached but handle the relay carefully, try to use xod/core/debounce instead of delay.

yes i want it to keep trying until the the water reach the sensor.

it works perfect like i want. thanks a lots :slight_smile:

One idea is to feed “needs more water” sensor directly to pump, but in parallel, have the delay node that keeps it running for at least 15s (‘or’ the output of sensor & delay to run pump). This will cause it to run for at least 15s, but continue to run if level is still below sensor.

Probably a better alternative is to drop the delay timer and use flip-flop to remember pump state. Set the flip-flop when water drops below one level, reset the flip-flop when water rises above a higher level. For example, assuming you are using range-finder to determine water level, turn pump on at >8cm, turn pump off at <7cm.

great idea i will try it and see which method is the most effective

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.