Delay on another clock?

I have Co2 meter that controls a temperature relay that i have on a short interval timer.
And i have a window opener that i want to open for a few sec and then check again in 10 min.
The easiest would have been to have two meters on different clocks but they conflict since they read the same port as i have only one meter in reality.

I get it that the clock resets the long delay and I tried other delay posts but i cant figure it out. Pls help.

You leave a lot unsaid, and your code doesnā€™t quite match what you saidā€¦

Assuming you open the window when CO2 is too low, your program currently waits 10 minutes, then opens window for 5 seconds.

If you are trying to prevent the window being open more than 5 seconds every 10 minutes, probably the simplest solution is to block signals to that part of the program for 10 minutes using a ā€˜gateā€™ node.

image
While the 10-minute delay timer is NOT active, we pass the CO2 value to the ā€˜lessā€™ node. The same time the 10-minute timer is started, we open the window for 5 seconds.

NOTE: the ā€˜deferā€™ node is needed any time you run a wire ā€œupā€ the program to create a loop.

It does not work, it stays like that forever and does not cycle. Probably needs some additional impulse or something.


Sorry about being vague before and messing up the nodes. I just want the window to open for a few sec and quickly close so it does not get cold IF the co2 gets too high but i want to control how often he checks and how long the window remains open.

If you want the window to open when CO2 gets too high, shouldnā€™t you be using a ā€˜greaterā€™ node instead of a ā€˜lessā€™ node?

Hmmā€¦the ā€˜gateā€™ node quits updating CO2 levels to ā€˜lessā€™ node, so it will be stuck on true, but since it is not ā€œchangingā€ to true, it should not trigger relay to open the window again during that 10-minute time it is locked. There would be an issue if CO2 level is still out-of-bounds when 10-minute timer ends because the state of ā€˜lessā€™ does not change to send another pulse.

This might fix the problem:
image
Now we trigger the window to open if CO2 levels are wrong AND we are outside the 10-minute pause.

I think this will work, but if the window never opens, you might need a ā€˜deferā€™ node between the ā€˜notā€™ and ā€˜andā€™, just to make sure the relay triggers before it goes into ā€˜pauseā€™ state. The fact that ā€˜lessā€™ links directly to ā€˜andā€™, while the other path goes through ā€˜delayā€™ and ā€˜notā€™ should mean you donā€™t need the extra ā€˜deferā€™.

I cycles once, on off on and then stays like that forever. Maybe missing a defer for the second delay? Then again I am barely able to follow what you did. It seems easier to get another sensor / arduino. But thanks anyway.

And yes it should be greater not less.

Wellā€¦call me confusedā€¦ How can the relay stay on if it is only on when delay is active? I donā€™t see how the delay could keep getting triggered every 5 secondsā€¦

You are saying the relay for D4 is staying on after doing one on-off-on cycle? How long is it on & off for?

It starts, stays on for the amount of the first delay, then off for the amount of the second delay and then once its done it turns on again and stays like that. And yes even when it says false but the main point is that it does not cycle, the gate is tripping.


Does it do the same for you? You donā€™t need a sensor, I unplugged it so it stays at 0 just in case.
This is why I hate coding, a simple thing will take days to figure out (if at al)l and from what i hear even then there is a lot of praying, begging and dark magic involved.

To clarify:

  1. Pictured above is the full program you uploaded for this last test?
  2. ā€œIt starts onā€ means the relay that is connected to D4. What exactly is connected to D4 and how do you know it is on?
  3. It stays on for 15 seconds, then turns off for 3 seconds, then turns on & stays on?
  4. Is picture above at the end while relay was on?

The above picture shows both delays off, which should mean the relay is off, and likely means the longer delay is not getting re-triggered after it expires because output of ā€˜lessā€™ is not changing (so it never pulses delay-SET again; the same problem we had with smaller delay and why we added the ā€˜andā€™ node). If we have ā€˜andā€™ nodes feeding each delay node, we probably donā€™t need the ā€˜gateā€™ node because ā€˜andā€™ node would basically do the same thing.

1 Like

WORKS!!! THANK YOU!

But yes, my bad, the green relay light goes out when it opens and not the other way round. Sorry about that! Weird design. My other relay has it the other way round. Lights up red when open. Anyway to answer your questions:
1: Yes
2: See above
3: Yes
4: Yes

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