Ignition circuit again

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…

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).

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

The ‘gate’ node can be used to disable delay-SET while delay-ACT is active:
image
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:


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.

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…

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.

Is it ok like this?

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.

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

@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…

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.

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.

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?

Here is one option:

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.

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?

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 “~”

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

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.

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

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