popph
Posts: 8
Joined: Wed Mar 25, 2020 10:02 am

Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Wed Mar 25, 2020 10:08 am

Hi everyone,

I'm a university student and have my own personal PC in a dedicated lab. The PC however, has some issues of freezing up (due to my heavy simulations) and I would have to return to the university just to restart my PC through a hard reset. I was wondering if I can use a raspberry pi to remotely turn on/ hard reset/ reset my PC without having to travel to my university? My PC freezes very randomly, and most of the time, I'm already home working on it remotely.

My question is, can I wire up a raspberry pi to the power switch of my motherboard (X-399A Prime ASUS) ? Since there is internet connection in my lab, I can remote control into the raspberry pi, run the script, and it helps to hard reboot my PC when needed. Is sending a signal to the Power Switch Pins sufficient or does it require higher voltage signal?

Your help is very much appreciated. I have no experience with raspberry pi, so I am completely clueless of what it can do and which components I should use. I have spent the whole day searching for guides online, but can't seem to find any.

Thank you!

pcmanbob
Posts: 8969
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Wed Mar 25, 2020 3:48 pm

Hi.

This topic has been covered a number of times on this forum try putting this in you preferred search engine.

"controlling PC power switch with pi site:raspberrypi.org/forums"

and look for posts by @thagrol
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

klricks
Posts: 7021
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Wed Mar 25, 2020 5:39 pm

If the BIOS on your PC can be set to auto boot when power is restored then it might be a lot easier to get a computer controlled outlet or power strip. Then you only need to power cycle the outlet over remote connection.

Also there is available IP power switch outlet devices that can do this without the need for a RPi.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

User avatar
thagrol
Posts: 2679
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Wed Mar 25, 2020 9:34 pm

A search will probably turn this up but...

I did it like this: https://github.com/thagrol/fakewake

You'll have to sort out routing over the internet to/from the lab yourself.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

PhatFil
Posts: 1640
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Wed Mar 25, 2020 10:04 pm

fwiw my solution was to flash the fantastic tasmota firmware https://github.com/arendst/Tasmota/wiki onto a $4 sonoff basic and host mosquitto mqtt broker on a pi. I then use node red,To issue the relevant on/off commands via mqtt to the switch as needed.. But you dont have to, python scripts or mature automation suites like openhab also work.. Both my Pi3B 5v psu and its 12v usb hdds (6x) psu are both controlled by such switches so the drives can be dismounted and shut off when not in use (old legacy hdds with old infrequently required data)

emma1997
Posts: 702
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Wed Mar 25, 2020 10:31 pm

Maybe an XY Problem issue but sounds like a watchdog would be easier and need less attention:

http://www.berkprod.com/Product_Web_Pag ... chdog.aspx

DIY version possible at a fraction the cost (2$-3$).

HvdW
Posts: 47
Joined: Tue Jun 17, 2014 12:41 pm

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Wed Mar 25, 2020 11:23 pm

Isn't there an ESP8266 solution available?
Like this one, or this or the same on YouTube.
Who knows knows
Who doesn't doesn't

popph
Posts: 8
Joined: Wed Mar 25, 2020 10:02 am

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Thu Mar 26, 2020 7:05 am

pcmanbob wrote:
Wed Mar 25, 2020 3:48 pm
Hi.

This topic has been covered a number of times on this forum try putting this in you preferred search engine.

"controlling PC power switch with pi site:raspberrypi.org/forums"

and look for posts by @thagrol
My apologies. I have been searching on google for hours on this matter. I've probably been using the wrong keywords. But yes, I did came across thagrol's post after some searching. Apparently, no comments were attached in the forum itself to guarantee if it works. I have yet to buy a raspberry pi, and would like to double confirm before I go on further (it is expensive in my country and I'm on a tight budget)

popph
Posts: 8
Joined: Wed Mar 25, 2020 10:02 am

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Thu Mar 26, 2020 7:05 am

klricks wrote:
Wed Mar 25, 2020 5:39 pm
If the BIOS on your PC can be set to auto boot when power is restored then it might be a lot easier to get a computer controlled outlet or power strip. Then you only need to power cycle the outlet over remote connection.

Also there is available IP power switch outlet devices that can do this without the need for a RPi.
Sadly, power is always on. It freezes, and doesn't restart on its own. That's the biggest problem so far.

popph
Posts: 8
Joined: Wed Mar 25, 2020 10:02 am

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Thu Mar 26, 2020 7:07 am

thagrol wrote:
Wed Mar 25, 2020 9:34 pm
A search will probably turn this up but...

I did it like this: https://github.com/thagrol/fakewake

You'll have to sort out routing over the internet to/from the lab yourself.
Thank you thagrol. I've came across your invention and found it very very useful. However, the post that I've come across (you've shared your creation), did not reply to your comment. So I was not sure if I wanted to take the risk to buy a raspberry pi and start the project myself, as a raspberry pi is costly over here, and I'm a student on tight budget :D .

Will keep this in my list now. Thank you!!

popph
Posts: 8
Joined: Wed Mar 25, 2020 10:02 am

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Thu Mar 26, 2020 7:09 am

PhatFil wrote:
Wed Mar 25, 2020 10:04 pm
fwiw my solution was to flash the fantastic tasmota firmware https://github.com/arendst/Tasmota/wiki onto a $4 sonoff basic and host mosquitto mqtt broker on a pi. I then use node red,To issue the relevant on/off commands via mqtt to the switch as needed.. But you dont have to, python scripts or mature automation suites like openhab also work.. Both my Pi3B 5v psu and its 12v usb hdds (6x) psu are both controlled by such switches so the drives can be dismounted and shut off when not in use (old legacy hdds with old infrequently required data)
Thank you for your help PhatFil! I will definitely put this in my list to try to solve the problem. If I have a chance to deal with the problem without any further purchasing, I'd do that first. A $4 sonoff basic is almost 30 dollars (our currency) which is costly for a student like myself :D . If it's simple resistors and lab materials, I could get some from my lab for free instead

popph
Posts: 8
Joined: Wed Mar 25, 2020 10:02 am

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Thu Mar 26, 2020 7:13 am

emma1997 wrote:
Wed Mar 25, 2020 10:31 pm
Maybe an XY Problem issue but sounds like a watchdog would be easier and need less attention:

http://www.berkprod.com/Product_Web_Pag ... chdog.aspx

DIY version possible at a fraction the cost (2$-3$).
A simple solution would do! I can monitor the situation pretty easily on my remote application. There's an indicator, and if it's red, means I have to reboot it. :) Thank you for the suggestion! Will read more on it (I am not familiar with a watchdog myself :shock: )

popph
Posts: 8
Joined: Wed Mar 25, 2020 10:02 am

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Thu Mar 26, 2020 7:14 am

HvdW wrote:
Wed Mar 25, 2020 11:23 pm
Isn't there an ESP8266 solution available?
Like this one, or this or the same on YouTube.
Hi there! Thank you so much! I have been searching for a solution by using an ESP8266 myself too! This is a gem! However, I'd like to try it with a relay instead of constructing such a complicated circuit. Do you think it would work with a relay?

User avatar
thagrol
Posts: 2679
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Thu Mar 26, 2020 11:37 am

popph wrote:
Thu Mar 26, 2020 7:05 am
pcmanbob wrote:
Wed Mar 25, 2020 3:48 pm
Hi.

This topic has been covered a number of times on this forum try putting this in you preferred search engine.

"controlling PC power switch with pi site:raspberrypi.org/forums"

and look for posts by @thagrol
My apologies. I have been searching on google for hours on this matter. I've probably been using the wrong keywords. But yes, I did came across thagrol's post after some searching. Apparently, no comments were attached in the forum itself to guarantee if it works. I have yet to buy a raspberry pi, and would like to double confirm before I go on further (it is expensive in my country and I'm on a tight budget)
It works. I wouldn't have shared it otherwise. Currrently 24 stars and three forks on git hub so someone else must be using it.

As for cost, you don't need to, and probably shouldn't, use a 4B for this. A zero with a WiFi or ethernet dongle you can route to the outside of the PC's case would be best. A zeroW(H) may work but that's dependent on WiFi signal strength and how good a faraday cage the PC case makes.

If you can't get hold of a zero, any Pi model will work subject to the current available from the PC's PSU. I'd try for a second hand B or B+ if money is tight. Or A/A+ but those are likely to be harder to find.

You don't have to use the same switch IC that I did. You could use reed relays, opto couplers, or connect the GPIO directly to the power and reset button front panel headers. If going for the last option, make sure you connect to the correct pin of the pair on the header and you'll need to do some experimentation on stopping side effects on the PC if/when the Pi reboots.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

popph
Posts: 8
Joined: Wed Mar 25, 2020 10:02 am

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Fri Mar 27, 2020 2:33 pm

thagrol wrote:
Thu Mar 26, 2020 11:37 am
popph wrote:
Thu Mar 26, 2020 7:05 am
pcmanbob wrote:
Wed Mar 25, 2020 3:48 pm
Hi.

This topic has been covered a number of times on this forum try putting this in you preferred search engine.

"controlling PC power switch with pi site:raspberrypi.org/forums"

and look for posts by @thagrol
My apologies. I have been searching on google for hours on this matter. I've probably been using the wrong keywords. But yes, I did came across thagrol's post after some searching. Apparently, no comments were attached in the forum itself to guarantee if it works. I have yet to buy a raspberry pi, and would like to double confirm before I go on further (it is expensive in my country and I'm on a tight budget)
It works. I wouldn't have shared it otherwise. Currrently 24 stars and three forks on git hub so someone else must be using it.

As for cost, you don't need to, and probably shouldn't, use a 4B for this. A zero with a WiFi or ethernet dongle you can route to the outside of the PC's case would be best. A zeroW(H) may work but that's dependent on WiFi signal strength and how good a faraday cage the PC case makes.

If you can't get hold of a zero, any Pi model will work subject to the current available from the PC's PSU. I'd try for a second hand B or B+ if money is tight. Or A/A+ but those are likely to be harder to find.

You don't have to use the same switch IC that I did. You could use reed relays, opto couplers, or connect the GPIO directly to the power and reset button front panel headers. If going for the last option, make sure you connect to the correct pin of the pair on the header and you'll need to do some experimentation on stopping side effects on the PC if/when the Pi reboots.
Thagrol,

Thank you so much for the detailed explanation. Will definitely look into a pi zero instead of getting a raspberry pi. That's a much better alternative for myself. I apologize if I have offended you in any way. Take care !

User avatar
thagrol
Posts: 2679
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Sun Mar 29, 2020 8:16 pm

FYI, I've just added some notes to that project on alternatives to the IC I originally used: https://github.com/thagrol/fakewake/blo ... natives.md
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

User avatar
neilgl
Posts: 1902
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Raspberry Pi to Remotely control power switch of PC? Advice + Help needed

Sun Mar 29, 2020 10:04 pm

OK go with what @thagrol said, and note that
Will definitely look into a pi zero instead of getting a raspberry pi
- these are just different models of (the excellent) raspberry pi.

Return to “Beginners”