# Ignition circuit again

**URL:** <https://forum.xod.io/t/ignition-circuit-again/6588>\
**Category:** Uncategorized\
**Created:** [July 2, 2023, 5:00pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588 "2023-07-02T17:00:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 2, 2023, 5:00pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/1 "2023-07-02T17:00:02Z")

</div>

I put together this code and everything works fine, namely I found out that sometimes it happens that instead of 90 seconds it turns off as it should do another cycle or two, sometimes even three, is there some kind of solution or something so that every few xx check if it is turned off and turn it off if not? Thanks a lot in advance…

 ![Bez naslova](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/5/55a011fe82cb6bd56b503071ddb191991cb5b39a.png)

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 5, 2023, 3:12pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/2 "2023-07-05T15:12:14Z")

</div>

If the 90 second delay timer is running more than 90 seconds, then it is receiving additional pulses on the SET pin, which will cause it to re-start the timer. If you want to prevent this so that it never runs more than 90 seconds, you will need to create a feed-back loop that disables signals into the delay-SET pin while the delay is active, but even this will not prevent an additional pulse as soon as delay is done, causing a 2nd 90-second delay immediately after the first (perhaps close enough that you cannot detect that it was off briefly) unless you add additional code to keep the delay-SET pin disabled for some amount of time after delay is done. A ‘gate’ node can be used to block input to the delay-SET pin while delay is ACT (you will need to “loop” from delay-ACT back “up” to the gate node, which will require a ‘defer’ node).

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 5, 2023, 4:29pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/3 "2023-07-05T16:29:42Z")

</div>

Thanks, can you explain it a little better, what do I actually have to do now? or if you can draw me from this example? I would be very grateful…thanks

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 5, 2023, 5:36pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/4 "2023-07-05T17:36:13Z")

</div>

The ‘gate’ node can be used to disable delay-SET while delay-ACT is active:  
 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/1/1ff9105fdc43e952e04fda7852dec2b1b5e2f272.png)  
The ‘defer’ node is required because you are passing signals from lower in the program back up, which causes a loop. The ‘defer’ node helps the compiler handle the loop properly.

Not tested, but this SHOULD force your 90 second timer to remain off for at least 10 seconds before triggering again:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/5/553e1daec17e83ada6cf18028411abf613f86d6d.png)  
The blue ‘defer’ node might not be needed. I put it there to make sure delay/not is updated to false before before earlier defer node makes ‘and’ node true; otherwise you might get a brief pulse from the ‘and’ node.

You are mixing boolean and pulses, which is fine, but can cause unexpected results in cases like this. If if-else-R turns false before gate-EN is false, but if-else-R is true when gate-EN turns true, it will immediately trigger another 90-second delay. You will have to determine if that is OK for your application. If it is not what you want, you could put a ‘pulse-on-true’ node before the gate; this will explicitly convert boolean to pulse, but will only send pulse through ‘gate’ when ‘gate’ is enabled (pulses sent when gate is disabled will be lost).

NOTE: Your if-else-F pin is undefined. For readability, you should explicitly set it to something. I assume you want it to be false/0, which is probably how it interprets the undefined pin, but it is better not to leave it ambiguous.

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 5, 2023, 7:35pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/5 "2023-07-05T19:35:16Z")

</div>

I understand partially, but I’m confused how to connect it in the simplest way, then now on my example…  
Can you somehow sketch on my example how to put it together, although I like your last variant the most. Thanks for your efforts in advance…

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 5, 2023, 9:49pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/6 "2023-07-05T21:49:10Z")

</div>

The if-else/gate/delay-90 nodes in my solution replace the if-else/delay-90 nodes in your original picture above. Delete the link between if-else/delay-90 in your original program and replace it with the gate node linked as shown in my pictures, then add the extra nodes from my picture. I just didn’t bother creating all the other unrelated nodes from your original program.

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 6, 2023, 11:10am UTC](https://forum.xod.io/t/ignition-circuit-again/6588/7 "2023-07-06T11:10:37Z")

</div>

![Bez naslova](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/8/8761059a919ccaae0ab220ba70eb3de63f6287d2.jpeg)

Is it ok like this?

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 6, 2023, 2:53pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/8 "2023-07-06T14:53:18Z")

</div>

Correct. That will prevent 90-second timer from restarting in the middle of its count, but it will not prevent it from triggering again immediately after finishing its count.

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 6, 2023, 3:08pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/9 "2023-07-06T15:08:48Z")

</div>

Ok, I’ll try it and let you know, thank you very much.

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 21, 2023, 6:13am UTC](https://forum.xod.io/t/ignition-circuit-again/6588/10 "2023-07-21T06:13:49Z")

</div>

@gweimer , can you tell me if it is possible to make this whole function work only during a certain time period of the day?

My first idea was that it should work on the light sensor, as it should, but when I try everything on the table together with the sensor, everything works fine, and when I connect it to the car, the sensor seems to have no function, I don’t know why, so I decided to set a time period for the function to work…

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 25, 2023, 6:55pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/11 "2023-07-25T18:55:48Z")

</div>

Re: light sensor working on bench, but not in the car. The most likely issues are either: 1) connections coming loose while moving the project, 2) power issues if you use different power supply in car, or 3) light in car not as bright as on test bench. Something is obviously changing during the move since there is no reason it should work in one location but not another if nothing within the project has changed. You would have to experiment to determine what is changing.

Re: Enabling during certain time period. You probably need to add a real-time clock (RTC) if you want to do something during specific time of the day. Arduino boards only have time since last reset/power on; they have no idea what time of the day it is, and this time “loops” after several days.

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 26, 2023, 4:12am UTC](https://forum.xod.io/t/ignition-circuit-again/6588/12 "2023-07-26T04:12:13Z")

</div>

I’m guessing, but the sensor works the same as it does on the table via a 5V stabilizer and it’s connected to 12V like in the car, so it’s not clear to me, but I’ll play with it and see… thank you very much for the answers.

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 28, 2023, 7:23am UTC](https://forum.xod.io/t/ignition-circuit-again/6588/13 "2023-07-28T07:23:15Z")

</div>

tell me, I would like the led to light up only after 5 seconds and to light up as long as pin D6 is active and when pin D6 is not active to turn off, but I can’t connect, which part should I add in between? and that it lights up at 30% intensity?

 ![Bez naslova](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/a/a922d14323396919c4a570fd96072d9b8badceb9.jpeg)

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 28, 2023, 3:52pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/14 "2023-07-28T15:52:32Z")

</div>

Here is one option:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/9/9c618f2056570edca678433ef68ace28ac8d2c7b.png)

Start delay when D6 is active, but only turn on LED if delay is NOT active & D6 is active. If LED should be on, give it value 30; otherwise give it a value of 0.

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 28, 2023, 4:22pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/15 "2023-07-28T16:22:08Z")

</div>

it works great, thanks, that’s exactly what I needed, I’m wondering how to set the intensity to 30%, does this number 30 indicate that? Because it still works for me at full intensity?

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 28, 2023, 6:17pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/16 "2023-07-28T18:17:01Z")

</div>

Sorry. I messed up. LUM input should be between 0 and 1. 30% would be 0.3

Note that you will have to experiment with exact value. You will probably never see a slow fade from 0 to 1 for 0% to 100%. LED may not be visible until some number above say 0.1, and you will reach full intensity before getting to 1.0.

You will also need a port that support PWM to dim an LED. These ports change based on Arduino model. Many of them will tag PWM ports with a “~”

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 28, 2023, 6:51pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/17 "2023-07-28T18:51:59Z")

</div>

I know that, but which nod should I put before the LED lights up, let’s say in this case?

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 28, 2023, 8:08pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/18 "2023-07-28T20:08:06Z")

</div>

The if-else node should have 0.3 for T and 0 for F (I had incorrectly used 30 for T). You don’t need a specific node before the ‘led’ node, you need a specific value fed to led-LUM. There are MANY ways to feed it different values in different situations. In this case, I chose to use if-else.

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 29, 2023, 4:49am UTC](https://forum.xod.io/t/ignition-circuit-again/6588/19 "2023-07-29T04:49:22Z")

</div>

ok, thank you very much for everything, you’re awesome…

---

<div class="post-metadata">

**Author:** ![apsolucija](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@apsolucija](https://forum.xod.io/u/apsolucija)\
**Post date:** [July 29, 2023, 1:56pm UTC](https://forum.xod.io/t/ignition-circuit-again/6588/20 "2023-07-29T13:56:55Z")

</div>

I connected it and everything is fine, but I have a problem, when node “C” is active, everything should be off, but for some reason, node “A” sometimes gives an additional impulse and activates the led again, regardless of whether node “C” is on. is it possible to make it so that when node “C” is on, no other node can be activated through it anymore? Thank you

 ![Bez naslova](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/e/e064c5cf7b7c67275dea9177eb2dbdfa2a0b7e91.jpeg)

[Next page](https://forum.xod.io/t/ignition-circuit-again/6588.md?page=2)
