SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By king44444
#169863
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..

The switch product page is here

Image

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:
1. First press of the button turns on the Arduino
2. Second press of the button is detected by the Arduino and starts a shutdown process
3. 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.

Here are two setups I've tried, but no luck.
Image
Image

Is what I'm trying to achieve even possible with this switch? could you provide a simple example setup where your switch would:
1. first push of a button power a controller on.
2. subsequent button pushes of that same button did not power off the controller.
3. the controller was able to detect when that button was pressed.
By Mee_n_Mac
#169918
According to Jan over at Pololu;
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 ?