Page 1 of 1

RPi to turn PC on.

Posted: Tue Mar 25, 2014 4:34 pm
by nickon314
Hi,
My Desktop PC has a push button on the front to turn the thing on.
Pressing the button momentarily is all that's needed.

And, inside the PC case, I can get to those two wires which lead to the push button, and momentarily short them out to do the same thing.

Now, I've soldered some flying leads from those two wires - and they now poke out the back of the case.

What I'm hoping to do is connect those two wires to the RPi - and programmatically get the RPi to turn the PC on.
I have a USB relay adaptor which I guess I could use to do this - but that's otherwise employed in another project.

So, my question is - is it possible to use two GPIO pins to do what I want?
I mean, is it possible to connect two RPi GPIO pins together (in software) to make a make and break switch?


Thanks in advance.

Regards

Nick

Re: RPi to turn PC on.

Posted: Tue Mar 25, 2014 4:46 pm
by Tarcas
You can make it turn the computer on, but not only using a couple of GPIO pins. You can either do it using WOL (Wake On Lan, you use a program to connect to the desktop over Ethernet and tell the motherboard to power on) or with a relay. The relay would electrically isolate the Pi from the motherboard, and allow you to use a GPIO pin from the Pi in order to flip a switch. With the other side of that switch (relay) connected to the motherboard pins, you can simulate the button press.

Check out this tutorial on using relays and relay boards with the Pi. If you're a hardware beginnner, you probably want to pick up a relay board (they're very inexpensive) so you don't have to mess with the various components.

Re: RPi to turn PC on.

Posted: Tue Mar 25, 2014 5:40 pm
by nickon314
Damn, Wake-On-Lan. Why didn't I think of that.
I feel such an idiot.

I suppose it's possible for the RPi to send such a WOL message ?


Regards

Nick

Re: RPi to turn PC on.

Posted: Tue Mar 25, 2014 8:36 pm
by ghans

Code: Select all

sudo apt-get install wakeonlan
wakeonlan MAC-ADDRESS-OF-TARGET
ghans

Re: RPi to turn PC on.

Posted: Wed Mar 26, 2014 7:14 am
by rpdom
ghans wrote:

Code: Select all

sudo apt-get install wakeonlan
wakeonlan MAC-ADDRESS-OF-TARGET
ghans
In addition to that, you can also create a file called /etc/ethers which contains a list of host names and MAC addresses (like /etc/hosts does with hosts and IP addresses), looking something like this:

Code: Select all

01:02:03:04:05:06 mypc
Then you can "wakeonlan mypc"

Re: RPi to turn PC on.

Posted: Wed Mar 26, 2014 10:31 am
by ski522
I use my Pi to send WoL packets to a couple of PC's in my house, works great. Just remember to enable WoL on the computer, not all of them come with it on by default.

Re: RPi to turn PC on.

Posted: Wed Mar 26, 2014 5:17 pm
by nickon314
OK,
That's looking very interesting.
I've now got my RPi to use WOL to wake up one PC.
But, I have another PC which refuses to behave. I checked the BIOS, and enabled the relevant setting, but that one still doesn't WOL.
I might have to use the GPIO pin/switch method for that one after all.

Another question then - is it possible to wake a Raspberry Pi using the same WOL method?

I've got 3 RPi's, one of which is permanently on as it's running the house intranet.
The other two could be turned on as-and-when using WOL from the 'primary' RPi.

Does it do that ?


Regards

Nick

Re: RPi to turn PC on.

Posted: Wed Mar 26, 2014 5:43 pm
by rpdom
No, the Pi does not support WOL. Although the network chip has the ability, it is not configured or connected to the necessary circuitry.

[edit]
Remember that the Pi uses less power when running flat-out than most PCs do in standby when waiting for WOL signals.

Re: RPi to turn PC on.

Posted: Wed Mar 26, 2014 7:08 pm
by Tarcas
Although it doesn't support WOL, it does support a switch to turn it on from standby state. I haven't tried it, but I read that if you jumper header pins 5 and 6 from powered off but plugged in, it will turn on. If it's not that, try other pins near 6 (4, 5, and 8 are adjacent. Maybe it was 4 or 8 instead. Just jumper each to 6 for ground.)

I tried to find it on google, but wasn't able to. I do remember seeing someone in the forum who connected a switch like this to shut it down by script when pressed, and he found that it powered it up too, because he happened to choose the right GPIO pin for his power switch.

Re: RPi to turn PC on.

Posted: Wed Mar 26, 2014 7:42 pm
by rpdom
It is indeed pins 5 and 6. That will work, but will need something to trigger it, unlike WOL.

Re: RPi to turn PC on.

Posted: Thu Mar 27, 2014 4:21 am
by Tarcas
rpdom wrote:It is indeed pins 5 and 6. That will work, but will need something to trigger it, unlike WOL.
You could always add another Pi to activate a relay that connects them. :-D Kiiiiind of defeats the purpose of turning it off in the first place though.

Re: RPi to turn PC on.

Posted: Wed Apr 02, 2014 12:10 pm
by txt3rob
my home automation project has a section for WOL

https://github.com/txt3rob/RPI-Control

should check that out

Re: RPi to turn PC on.

Posted: Wed Apr 02, 2014 2:18 pm
by cs2000