I would like to use RPi to connect a jumper cable from PC Motherboard power switch to a GPIO pin and Ground to be able to turn the PC On/Off automatically and remotely.

Would it work and is it safe?

1 Answer 1


I would try to isolate the Pi from the PC as much as possible. I would either use a relay or an opto-isolator to do this.

However, before I started the project I would research into what sort of switch is necessary to turn the PC off safely to find out what voltages need to be used, and how long the switch is required to stay low in order to turn off the system safely.

For example, the machine I'm writing on needs to have the power switch held down for over 0.5 seconds in order to bring up the power-off dialog. Then the machine will shut down after 60 seconds. This is a laptop.

My tower machine ignores the power button (when the machine is on) unless I hold the button down for a few seconds in which case the machine is powered down unsafely. Perhaps there is a setting that would change this behavior.

  • Thanks. Yeah I have tried a relay and that works but I was wondering what would happen to both Pi and PC motherboard if I connected the power switch directly to Pi's gpio and ground. I tested using gpio and ground using multimeter and it does short the circuit.
    – IlirB
    Jun 28, 2018 at 17:42
  • When gpio is set to high the output is 3.3V and open circuit and when set to low the output is 0V and closed circuit
    – IlirB
    Jun 28, 2018 at 17:44
  • I don't know what the voltage levels are of a PC board. I do know that if you hold it down too long (on my tower) it does a hard reset, which you said you didn't want to do. These are what I'd research if I were doing this. Me, I'd communicate to the PC via USB or Ethernet and have a small service on the PC which would receive the data and shut it off correctly. But I'd rather program than do hardware, so that's me.
    – NomadMaker
    Jun 28, 2018 at 17:48
  • I totally agree, gracefully always first which I already have but in my case I need to handle crashes where shutting down correctly is not available also if it's powered off be able to turn it on (Wake on Lan is an option too). Sure need to figure out timing on how long to hold for power off/hard reset but that's trivial what I lack understanding is on hardware level could there be any damage if I were to connect the wires as I described?
    – IlirB
    Jun 28, 2018 at 20:31

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .