Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

Can I use the Raspberry Pi's GPIO pins to make the Rasperry Pi act as a switch?

I would like to shut down, boot up and reboot my computer via hardware remotely. My idea was to take the PS_ON# pin from the front IO header, plug it in on some GPIO pin and then, when I want to activate the switch, pull the pin to low and thus toggle the PC PSU. Unfortunately PS_ON# uses +5V and I don't even know if I can simply pull a random GPIO pin to low.

-> Can I use the Raspberry Pi to short out a power source on a GPIO pin to GND?

share|improve this question
2  
If you're PC supports wake-on-lan, I would consider that first. –  Jivings Feb 26 at 6:39
    
Unfortunately this is meant for remote desaster recovery: If the PC crashes / turns off unexpectedly and does not respond to network traffic anymore, this should be a way to ungracefully reset the PC to working order, or boot it from a cold state. –  d3rrial Feb 26 at 6:48
3  
This question sets a new low for this site. Despite the fact that the question is rather vague, and shows little research it attracted a number of answers - which are either irrelevant, contain errors and have the largest collection of poor grammar and spelling I have found on this site. –  Milliways Feb 26 at 12:01
3  
@Milliways A large number of answers...And I don't hesitate to agree. However, I think it would be more constructive for us to improve the question and answers rather than complain about them. –  Jivings Feb 26 at 18:00

7 Answers 7

up vote 4 down vote accepted

Basically, yes, you can control other devices using RPI’s GPIO pins, however, there are many limitations which you should consider, especially the voltages and currents involved (you cannot source/sink much current directly from/to GPIO). Generally, I would suggest never to connect RPI to the PC directly, but using an opto-isolator to separate them.

I believe you could be interested in WtRPM: A Web-based (Wt) Suite to Power Up/down Your Computers, which is an article describing exactly the solution you are after, I guess.

share|improve this answer

I'd use a serially controlled relay card to switch the power to the PC. Then, in the PCs BIOS set it so that it will boot whenever power is switched on. That way your power switch/reset circuit is completely independent of the PC, works with 3.3V and can even be used to control multiple computers.

share|improve this answer

You can buy remote controlled power switches in various places. Like this one. Remote controlled power switches

Open up the remote, connect your Raspberry Pi's GPIOs, and you will have a safe, controlled power-switch, which is can be remotely controlled.

I am using a solution like this one, and it works quite well.

share|improve this answer

I don't know how does it exactly work for the PS_ON# but if you need to send in 5V / 0V you can do it with a raspi.

As you foresee the GPIO only send 3.3V witch are not enough. but you also have access to the +5V source in the GPIO header and you can user a transistor to toggle it (5V/0V)

Here you have an example on how to make 5V run through a LED with a raspi. You just exchange the LED by your pin.

http://www.raspberrypi-spy.co.uk/2012/06/control-led-using-gpio-output-pin/

share|improve this answer

Exactly what you are trying to achieve is unclear.

Regardless, unless you are running the Pi off the PC power supply, direct connection is very poor engineering practice. Ignore most of these answers. You need some kind of isolation such as a relay, opto-isolator etc.

share|improve this answer

Playing with mains is dangerous - so best to use a kit designed for that purpose. Be careful with units designed in the US - their safety requirements are a bit different from UK and Europe.

Here is one designed with Uk safety features in mind:

http://www.sf-innovations.co.uk/mains-switch-widget.html

share|improve this answer

well you can do that using opto couplers via basic transistors driving power relays

here is my homebrew , it is in romanian , not yet translated

http://forum.linux-romania.com/read.php?5,29

share|improve this answer
    
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. –  RPi_Awesomeness Apr 16 at 12:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.