Using the Pololu Pushbutton Power Switch
Intro: Using the Pololu Pushbutton Power Switch
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.
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.
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.
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
void setup()
{
pinMode(offPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
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.
Here is some example arduino code:
int offPin = 7; // Pololu connected to digital pin 7
void setup()
{
pinMode(offPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
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.
23 Comments
Bjarneec 8 years ago
Hi peeps. Know this is an old treath. but can this unit power on and then off 4-5 flashing LEDs connected with a 12v power supply with the push on a momentary button? (i Know they have LV and SV and I mean the SV) I'm looking for something to leave constant voltage with my momentary button to power on my LEDs and then with same button power them off again. And this looks like the solution if im not wrong :)
dfalls 9 years ago
pololu/circuiting/coding newbie here.. I was wondering how would I be able to wire the pololu power switch? because the wires I have just slide right through the holes on the switch.. thanks..
dfalls 9 years ago
and what are the extra pieces that come with it? the pushbutton and the other thing that looks like a centipede?
Daniel6610 14 years ago
The switch is an electronic switch that will turn on and off power to ANY project or product you wish to use it on. It gives you a SOFT SWITCH option, like all the new electronics use, instead of a manual HARD switch such as a toggle or slide switch.
In some cases someone may not want a big toggle switch or slide switch sticking out, ao you con just have a flush mount momentary push button to use as your switch(Just like all the fancy new electronics gadgets you buy now a days).
The option of the OFF input on the switch give you a way to use an alternative method to turn off your project. In the case above, youevolve is using a pin on the micro controller to turn the entire project off. This will save more power than just letting the micro-processor go to sleep.
jkeny 12 years ago
Any help appreciated.
Daniel6610 12 years ago
It does not monitor voltage and turn off at a certain voltage.
The meaning of the low voltage switch is that it is meant to be used in a circuit that uses between 2.5 volts and 7 volts. The standard version of this switch is for use in circuits that require between 4.5 volts and 20 volts.
Hope this clears things up. Sorry it's not what you were looking for.
jkeny 12 years ago
It just doesn't say how to do this or adjust this low voltage condition? I thought you guys might know? I've already written to Pololu about this but go no reply.
jkeny 12 years ago
I basically wanted to the LV version to turn itself off at 3V because I'm using LiFePO4 3.3V batteries & they should not be discharged below 2.7V or they will be damaged. So I wondered how the LVC is implemented & if it could be changed by changing a resistor on board? Does anyone have the full schematic of this switch?
Daniel6610 12 years ago
http://www.batteryspace.com/pcmforlifepo4packs.aspx
They have many different modules depending on your voltage needs and other specs. These may be able to be used in conjunction with the Polulu power switch.
I hope this helps a little.
Dan
jkeny 12 years ago
I know about these PCMs but don't need anything that complex - I simply need an LVC. I thought this switch had it? Is the full schematic available so I could evaluate what changes might be need on the pcb for it to work in the way I require?
Daniel6610 12 years ago
Dan
jkeny 12 years ago
Thanks, John
Daniel6610 12 years ago
Dan
vmspionage 13 years ago
Thanks to Pololu for the great products. I especially love those tiny boost regulators. The smallest version I made with through hole stuff and a MAX1771 was about the size of an Arduino mini, and that's using a home etched board. My early breadboard modes were almost credit card size. They have ones about half the size of a postage stamp. Good stuff!
gfxprotege 13 years ago
Say you have a push button that you want to use to Turn on the arduino, and then let it time out after a little bit. Would you simply write in a method that reads if a button is pushed, to switch pin 7 to low?
crapflinger 14 years ago
i gather that the purpose is to give the arduino a chance to shutdown (so it's a shutdown button not a power button...sort of like if you press the power button on your PC..) but it would be nifty to include some info as to how the polulo does this etc..
youevolve 14 years ago
This could be used in something like a museum display where the user presses a button to see a display and then can walk away without manually shutting the display down.
The Pololu switch does actually shut the microcontroller down totally, greatly saving battery power.
crapflinger 14 years ago
the press initiates the "code" then tells it to stop at a predefined time period...
how do the guts of the switch itself help with this? is it because it's a multi part switch?...like pressing the switch pulls one of the pins high...the arduino detects that and does it's do, waits it's wait, and then sends an "off" signal to the off pin on the pololu (who came up with that name) which in turn tells the switch to kill power?
youevolve 14 years ago
http://www.pololu.com/catalog/product/751
You have the basic idea. The stop trigger could be a programmed timer or any other condition. It is all in how you want to set up your program.
crapflinger 14 years ago
IMO the more info (and explanation) you can get into the ible itself...the better it's going to be