I'm trying to build this circuit. When I pressed the push button it will power the arduino nano and the A1 will be LOW for 10 seconds which will make the pin 2 High (which is relay pin) and as a result the Arduino will remain ON even I release the push button due to the relay which connects the GND of battery to the Arduino GND pin.
The issue is The Arduino turns ON after 10 seconds but it doesn't turned OFF when i again press the same push button but making the relay pin LOW
When pressing the button for 10 seconds it got enough time to run the code and make the pin2 HIGH*(I set the 10s timer in the code)*. Its works fine but I can't make the pin2 LOW when pressing the button again.
You have to press the button for more then 10 seconds.
When the button is pressed it will power the Arduino and at the same time it will make the pin A1 LOW for 10 seconds which will turn ON the relay.
That's the logic behind this.
As long as the relay is energized, the Arduino ground and the battery ground are connected together. Pressing the button will not have any affect at that point, since both sides of the switch are already connected together.
< edit > in fact, I don't see how the A1 input could ever be HIGH, since it is permanently connected to the Arduino ground.