I bought a mini pushbutton power switch board, and I’m trying to wire it so I can re-use the push-button as a sensor to an Arduino so it can read the button state and perform a controlled shutdown.
My goal is that when the Arduino is off, an external pushbutton wired to the A pin will short to ground, turning the Arduino on. Then, when someone presses the external pushbutton again, the Arduino will register the key-press, do some internal cleanup, and then set OFF pin high to turn itself off.
This is the simplest way I thought I could accomplish this behavior:
I found I had to add the diode because when the pushbutton board latches on, the A pin appears to stay shorted to ground, causing the Arduino’s SB pin to always register low, regardless of the external pushbutton state, meaning the Arduino could never tell when the external pushbutton was pressed again.
However, this circuit still doesn’t work. The problem I’m now having is that the pushbutton board immediately turns “on” and stays stuck “on”. Even setting the OFF pin to high has no effect. How do I fix this circuit?