nickon314
Posts: 115
Joined: Tue Jul 03, 2012 12:11 pm
Location: West Yorkshire

RPi to turn PC on.

Tue Mar 25, 2014 4:34 pm

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

Tarcas
Posts: 740
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: RPi to turn PC on.

Tue Mar 25, 2014 4:46 pm

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.

nickon314
Posts: 115
Joined: Tue Jul 03, 2012 12:11 pm
Location: West Yorkshire

Re: RPi to turn PC on.

Tue Mar 25, 2014 5:40 pm

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

ghans
Posts: 7871
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: RPi to turn PC on.

Tue Mar 25, 2014 8:36 pm

Code: Select all

sudo apt-get install wakeonlan
wakeonlan MAC-ADDRESS-OF-TARGET
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
rpdom
Posts: 14987
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RPi to turn PC on.

Wed Mar 26, 2014 7:14 am

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"

ski522
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm

Re: RPi to turn PC on.

Wed Mar 26, 2014 10:31 am

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.

nickon314
Posts: 115
Joined: Tue Jul 03, 2012 12:11 pm
Location: West Yorkshire

Re: RPi to turn PC on.

Wed Mar 26, 2014 5:17 pm

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

User avatar
rpdom
Posts: 14987
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RPi to turn PC on.

Wed Mar 26, 2014 5:43 pm

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.

Tarcas
Posts: 740
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: RPi to turn PC on.

Wed Mar 26, 2014 7:08 pm

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.

User avatar
rpdom
Posts: 14987
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RPi to turn PC on.

Wed Mar 26, 2014 7:42 pm

It is indeed pins 5 and 6. That will work, but will need something to trigger it, unlike WOL.

Tarcas
Posts: 740
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: RPi to turn PC on.

Thu Mar 27, 2014 4:21 am

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.

txt3rob
Posts: 365
Joined: Sat Aug 11, 2012 3:45 pm
Contact: Website

Re: RPi to turn PC on.

Wed Apr 02, 2014 12:10 pm

my home automation project has a section for WOL

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

should check that out
The Raspberry Pi Hell Guy - Random Ramblings to assist me and others.
http://raspberrypihell.blogspot.com
My Github - http:/www.github.com/random-robbie/
http://www.smspi.co.uk - send free uk sms via your raspberry pi from here


Return to “Automation, sensing and robotics”