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.

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:
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


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.