I am working on a project ( Instructable soon to be published) which required the Arduino controller to be powered down once a program had been run and restarted at the push of a button. The Pololu Pushbutton Power Switch fit my needs perfectly. This device was so easy to use and has so much potential in other projects I thought I would do a quick write-up in the hopes of helping others.
I use the Arduino as an example, but many other configurations are possible.
Step 1: The Pinouts
I am using the low voltage version which can handle 2.5-7 volts. The standard version can handle 4.5-20 volts. A small switch is provided, but any momentary on switch can be used.
The pinouts of the switch are pretty straight forward. There are two pins for Voltage In (VIN), two for Voltage Out (VOUT), four for ground (GND) and one pin marked OFF.
Step 2: Wiring It Up
In my project, I have a battery pack powering my Arduino. The switch is installed between the power source and the Arduino. Positive voltage from the battery pack is wired to a voltage in (VIN) pin. Negative to a ground (GND) pin. On the arduino side, the VOUT goes to the center pin of a male power plug and the GND to the barrel of the same plug.
The key to this switch function is the OFF pin. Here, I have it wired to pin 7 of the Arduino.
Step 3: And Then Magic Happens...
At this point the switch will function as a push on/ push off switch for the Arduino. With a little code, the Arduino can switch itself off at an appropriate time! All that is required is setting pin 7 (in this example) to HIGH and the Pololu switch powers the Arduino down.
Here is some example arduino code:
int offPin = 7; // Pololu connected to digital pin 7
pinMode(offPin, OUTPUT); // sets the digital pin as output
delay(30000); // wait for 30 seconds
digitalWrite(offPin, HIGH); // Sets the pin to HIGH and shuts down the Arduino
I hope you have found this useful. Please post in the comments if you use one of these in a project.