Note: This post and the accompanying software packages have been updated several times since this was originally posted. The most up-to-date releases and instructions can always be found in the GitHub Repo. Update notes are appended to the end of this blog post.
I have a very power hungry desktop computer that I use for video editing and large file storage. When I’m travelling with my laptop, I obviously can’t carry all my files and data with me, so I occasionally use “remote desktop” to access my desktop from the road. I also use a Plex Media Server to stream content from my desktop computer. However, the computer has to be on for me to be able to do this. This means I need to leave the computer on all the time, just in case I need to access it. This wastes power, costs me money, and harms the environment. My Raspberry Pi, on the other hand, consumes a minuscule amount of power, and is always on anyways, serving other purposes. In this tutorial, I’ll show you how to run a simple mobile-friendly website from your Raspberry Pi that will allow you to remotely wake up your power-hungry computer, so you can remotely access it. When you’re done, just put it back to sleep from within the remote desktop service (or use the mobile app plus a small background server running on your desktop to put it back to sleep – this is described in the instructions). The app pings the computer from the Raspberry Pi to inform you of when the computer has woken up and established network connectivity. Follow along after the break…
Once you’re done setting up your Pi-Powered Wake/Sleep on LAN Server, here’s how it will work…
- From wherever you are in the world, navigate to your unique, dynamically updating URL (wol.example.com)
- You’ll be presented with a screen that looks like the one below (note, you may get a security popup first, if you choose to use a self-signed certificate to enable HTTPS – this is described in the instructions). From this screen, you can select which machine you want to control, and you can view its state (awake or asleep). You can add as many machines that you want to control. Here, you can see that “Phoenix Desktop” is currently awake, and I have the option to put it to sleep:
- Next, you’ll enter a passphrase that you’ve pre-chosen. If the wrong phrase is entered, a “denial” note will pop up, and you’ll be able to try again. If you enter the right phrase, the Raspberry Pi can send a “Wake Up” or “Sleep” command to the remote machine. It will then ping that computer and display the results in real-time, so that you know when the computer has finished booting or when it has finished going to sleep. Here, you can see what that screen looks like when I put “Phoenix Desktop” to sleep remotely:
- You’ll receive a confirmation message when the computer has finished waking up or going to sleep. If you just woke it up, you can now perform normal remote access tasks, like SSH, FTP, or Windows Remote Desktop.
Ready to set this up for yourself? Visit the GitHub Project Wiki to follow the detailed installation instructions.
- 7/20/2013: Added the ability to put the computer back to sleep using the mobile webapp. Instructions updates on the Wiki.
- 12/15/2013: The app now includes a dropdown that allows you to pick a computer. You can now Wake/Sleep as many computers as you want! Thanks to GitHub user ahodgey for submitting a Pull Request with most of this functionality (I made some updates to his pull request, and merged it into the master repository branch).
- 09/14/2015: The Raspberry Pi WOL software now supports SSL encryption, meaning you can connect over HTTPS using a self-signed certificate. Additional security measures have also been implemented to reduce the risk of XSS vulnerabilities. Thanks to GitHub user felixrr for the Pull Request! You can still use ordinary HTTP if desired, and updated instructions can be found on the Wiki.
- 01/24/2015: Software bumped to v2.0. Fixed lots of bugs, and confirmed working latest Raspbian Jessie release, with Apache 2.4.x (which had a bunch of breaking changes).