I posted this question on the Pololu forum, but haven’t received a response yet. I am starting to get disperate so I thought I would see if anybody from Sparkfun could lend some guidance. [Here is the link to that..
above is a image of my current setup, which allows for the the first button press to turn on the Arduino. Subsequent button presses do not shut down the power, which is great and works great. What I’m trying to achieve is being able to have the Arduino read when that same button is pressed additional times (besides the first press).
So in essence:
First press of the button turns on the Arduino
Second press of the button is detected by the Arduino and starts a shutdown process
When the Arduino is finished shutting down, it sets “off pin” on the switch and powers down.
What is the setup to allow the above without causing additional battery drain?
I’m very new to embedded electronics. It seems to me like the solution would involve connecting a wire from an open digital pin on the Arduino to either the positive side of the push button with a pull - down resister towards ground or the negative side with a pull - up towards positive.
When the button isn’t pressed, the voltage on that switch node will either be your battery voltage (when the circuit is in the off state) or some fraction of that (when the circuit is in the on state).
My first inclination is to run that into the Arduino’s analog comparator pin. Setup a voltage divider off the switched power (5 V?) and use that as an input to the other comparator input pin. The comparator can then cause an interrupt when the voltage falls (upon a button press) below the divider voltage. The Arduino interrupt routine can then issue the turn off signal to the Pololu switch. One issue to be looked into is that the Arduino will be off but it’s comparator input will be connected to the battery voltage, thus drawing some power. I don’t know how much. I suspect it’ll be “small” but how small is small enough is up to you. An inline resistor might help in reducing the power.
Second I note you have the switch wired “wrong” per the Pololu diagram. But since it works …
And on that note I would remind you that the LiPo voltage changes vs it’s state of charge. When fully charged it might be 4.2v. At full discharge, it’s perhaps 2.8 - 3.0 v. The Pololu switch is really only spec’ed to work at 4.5+ v. Will it still turn on when the LiPo is “low” ? Additionally the on resistance is “high” when the working voltage is only 5v, let alone 3+ v. You may not draw enough current for this to matter but if your circuit is more than is shown, you might want to consider diode OR’ing the LiPo and converted voltage (that’s what the red thing does, a DC/DC converter ?) into the Pololu switch to give it a higher working voltage.
Lastly what is that converted voltage ? Why are you routing it into the Vin pin of the Arduino ? Why not create 5 V and run that into the Arduino 5V pin, thus bypassing the regulator ?