# How can I build a power switch?

I would like to be able to have a simple power switch between the RPi and its USB power, such that I don't have to plug and unplug the device to operate it.

Is there a simple switch available that I can buy or build?

The most naive approach would be to add a switch to an extension cord. You can usually find all necessary components in your local hardware store. If you do not know how to construct and solder something like that together, it might be better to just buy something, that does the trick. I found an switching adapter for the German "Schuko" system on Amazon.de, but you might have a different system in your country and choose a different retailer.

• It's Schuko (Schutzkontakt). Schoko is short for chocolate ;) – Der Hochstapler Jun 24 '12 at 11:49
• You are of course correct, but please edit my answer, next time. The comments should not be used for discussions of such trivialities, I think. – Bengt Jun 24 '12 at 15:42
• I had no plans to discuss it, but I also like to reserve edits of other peoples answers for changes that are more substantial. – Der Hochstapler Jun 24 '12 at 19:30
• I think an edit is much less prominent than a comment and should therefore be used preferably to keep things tidy. – Bengt Jun 24 '12 at 19:33

See this thread on raspberrypi.org and this blog article with images how to create a switch.

• In keeping with our policy regarding informationless link-only answers, if this post is not edited to contain information that can stand as an answer, however minimal, in 48 hours it will be converted to Community Wiki to simplify having it corrected by the community. – Ghanima Feb 16 '17 at 22:34

I am not good with soldering, so I got myself the ready made RemotePi Board, it plugs into the GPIO port. The board enables you to so switch the power with a button or an infrared remote control - the infrared signal is forwarded to the OS as well, so you can remote to it using LIRC. Works well with my Logitech Harmony and OpenElec.

If I were going to build an "on/off" switch I would use a simple button acts as a switch, and monitor it through the GPIO pins. See this tutorial for building a button: http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/buttons_and_switches/

Then I would use the button to send a proper shutdown command sudo shutdown -h now so that I didn't corrupt my disk, or cause other damage by shutting down unexpectedly. How do I turn off my Raspberry Pi?

The last step is theoretical, since I don't know a good way to write that script. If someone knows how to write that shell command (and thinks this answer isn't wrong), please feel free to edit this answer!

• But how would turn your raspberry pi ON? – Christian Feb 24 '17 at 12:33
• My suggestion only addressed shutdown. I have no idea how you would turn it on with a button. – geneorama Feb 24 '17 at 19:44

A nice cheaper alternative include remote control in now in kickstarter.

It uses an Attiny85 chip to trigger the Pi to shutdown and monitors the TX pin and wait until the Pi is in halt state. It has a button and a infrared remote for control on and off. It is also programmable so you can use it like a development board.

• Hello and welcome to Raspberry Pi! Could you please provide a little more details (and have the link as a reference only). Please note that a disclosure of affiliation (if there is any between you and this product) is requested. In keeping with our policy regarding informationless link-only answers, if this post is not edited to contain information that can stand as an answer, however minimal, in 48 hours it will be converted to Community Wiki to simplify having it corrected by the community. – Ghanima Feb 16 '17 at 22:37

Try this new product launching on kickstarter - http://kck.st/UVBXTE

• In keeping with our policy regarding informationless link-only answers, if this post is not edited to contain information that can stand as an answer, however minimal, in 48 hours it will be converted to Community Wiki to simplify having it corrected by the community. – Ghanima Feb 16 '17 at 22:35