Skip to content
Check other posts

Relay operated power button

Published: at 12:55 AM

What you need:

Explanation:

A power button on a computer case lets electricity flow between two power pins upon it being pressed, which is when the motherboard detects the button is pressed and reacts accordingly.

A relay is a specific kind of switch which lets electricity flow conditionally upon the flow of electricity in another circuit. The voltages involved both in motherboard power pins and on Raspberry Pi are generally low to not damage both, but we’re taking extra precautions to electrically separate them both.

“5V relay module” here means that 5V is the voltage that is required for the relay module to work, while the controlling voltage can be lower. It being relay module it means it also has a flyback diode we’d otherwise have to provide ourselves.

Raspberry Pi’s GPIO pins are programmable and can be controlled through Python code, and operate on 3.3V. Raspberry Pi also provides 5V output, but this one is not controllable.

By

We can extend the power button functionality so Raspberry Pi can turn on and off our computer, while also still keeping the power button working.

Which is what I use to remotely turn on my computer on, by SSHing to rPi and running a script to turn the PC on while I’m away from home.

Why not Wake-On-LAN?

Wake-On-LAN has restrictions which makes it not as reliable as it could be, for example:

The ability to wake from a hybrid shutdown state (S4) (aka Fast Startup) or a soft powered-off state (S5) is unsupported in Windows 8 and above

The code and explanation for it in Part 2, when I get to writing it.