PC power switch over Internet via Arduino

I made this to use with the Custom Server I built. The problem is that I don’t need to use it 24/7 so I wanted to find a way to remotely turn it off/on. The most obvious way to do this is via Wake-on-Lan. This is supported by the motherboard and works fine if I’m on the same network, but seems impossible to do across the internet. I can’t find a way to get the WOL packet past my router intact.

So I decided to use an Arduino Uno board with an Ethernet Shield. Arduino is a low cost microprocessor that is programmed using a language similar to C, and is often used for education and small projects. The Ethernet Shield is an add on board that allows the Arduino to become an internet enabled device. I bought the shield on eBay.

The code behind this is a modified version of the example available from:
Pin Control Over the Internet – bildr.org
My Code

Using that example I changed it so that one pin went HIGH when the page was loaded. How is this useful at all to power on a pc? Well, when you press the power switch on a computer case what you are actually doing is shorting two pins on the motherboard supplying a pulse to the PWRSW+ pin. Putting a transistor between the pins and using the signal from the Arduino to activate it, an electronic switch can be made.

Thus the pc can be switched on demand from anywhere with an internet connection. As an extension I wanted¬† a way to see if the computer was already on before trying to start it. Conveniently the motherboard output for the PWR LED is ~5V when the computer is on. It’s as simple as reading this voltage into the Arduino’s ADC and writing an IF statement dependant on the input level.

NPN Transistor used as a switch

NPN Transistor used as a switch

LED Circuit Diagram

The power LED circuit

So I now have a way to remotely¬† power my server that is software independent of the server itself, useful if it’s blue screened or frozen. The Arduino is powered from a USB port so it’s a pretty tidy system.

Computer ON


White wires from the power switch pins, blue and purple from the power LED pins

The output on the control page.

The output on the control page.

Share Button

Leave a Comment

Filed under Projects

Leave a Reply

Your email address will not be published.