Posts: 11
Joined: Sun May 15, 2016 10:41 am

Control PC ON/OFF with gpio

Sun May 15, 2016 10:58 am

Hey guys, wondered if anyone fancied helping a guy out. I have a cabinet set up with 6 raspberry pi's and one full pc motherboard. The full pc I shut-down and is really an "on demand" server for my VM's. I have been using WOL and pm-hibernate to wake up and shut-down the pc (the on-board network wont wake the pc from powered off) and just recently when using pm-hibernate I havent been able to wake it up unless using the button.

I would like to use one of the raspberry's to power on the pc using the gpio pins. After looking around and doing some research, everyone is saying to use an optoisiolator. Now, just to be clear, my electronics knowledge is no where near anything good, I can get by without blowing anything up, but I am still a noob and still learning. I understand what an optoisolator is, why i should be using one, and how one works. Saying that, in my mind I see a transistor as a viable solution, and I have a few different types to hand, where the optoisolators I dont......

Now does anybody mind telling me
a) If i can use a transisitor instead..
b) if not, why not??
c) if I can, are any of the transistors I have any good for what I want??
I have 2n2222 IRF44Z BC547 BC327 and IRF3205.

Many thanks in advance

User avatar
Posts: 804
Joined: Sat Feb 04, 2012 4:18 pm

Re: Control PC ON/OFF with gpio

Sun May 15, 2016 10:44 pm

In theory, ie I haven't tried it, but you could use a 2N2222 to switch the PSU on wire, often green, to ground. Given that this wire is connected to the motherboard, it should not represent a hazard. That said, you are dealing with something very close to mains so proceed with caution.

Posts: 11
Joined: Sun May 15, 2016 10:41 am

Re: Control PC ON/OFF with gpio

Mon May 16, 2016 9:31 am

Cheers for the reply Nick. I have a spare PSU knocking around I can test with first so will give it a go today. I hadn't thought of connection the it to the power_on on the PSU and I was thinking of hooking it up to the switch header on the motherboard.

Cheers Iain

User avatar
Posts: 5967
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Control PC ON/OFF with gpio

Mon May 16, 2016 10:05 am

To use a transistor driven by a Pi, you have to connect the ground of the Pi to one side of the switch on the PC ...
If the Pi is totally isolated, and if the switch connection is to the PC's ground, you'll be okay.

But can you be sure that, sometime in the future, you won't decide to connect the Pi to something else, that's connected to a different ground?
Even in the same house, different grounds can have voltages varying by several volts, particularly if a fault develops in your fridge, microwave, vacuum cleaner ... which could destroy your Pi.

Return to “Automation, sensing and robotics”