Why did I build it?
I use remote desktop a lot when I'm away from home, and have also recently set my computer up as a Plex media server (If you aren't familiar with Plex, it's an incredibly well finished, and free, package for managing and streaming films, tv and music on your computer).
The issue I found with this is that in order to use either of these services my computer obviously needs to be turned on. As I can occasionally be away from home for weeks on end, I hardly wanted to leave my computer on all that time, so I needed a way to switch it on when I was away.
I eventually want to install some remotely accessible home automation features to my house so thought why not build it all into one system.
So what does it involve?
Hardware wise, this couldn't be simpler (full list below), and involves an Arduino running as a server. The Arduino can be plugged anywhere into my home network and long story short, allows me to send a WOL magic packet from outside my internal network.
Using a fantastic service called Teleduino (Linked below), it was extremely easy to get the Arduino up and running as an internet accessible unit, effectively acting as a server. After speaking to Nathan (awesome guy) who created Teleduino, we worked on adapting the Teleduino script to allow remote sending of WOL.
The system we resulted in means allows you to send the Arduino a specific command, including a MAC address, and it will distribute a magic packet throughout the local network specifically for that MAC.
But how do I access it?
So I've got the device working, great, but how do I access it? Well as it has the ability to turn on multiple computers, I created a website for the exclusive use of me and my housemates. Each of us have our own log in details, and once logged in, we are presented with a list of any computers we are permitted to power on.
To power on a computer you need simply tap the name of a computer and the website sends a HTTP request to the Arduino including the MAC address of the specified computer. The Arduino kicks in and the computer powers on within seconds.
Ok great, but how do you know when your computer is ready to access?
Being the lazy guy I am, I didn't want to have to keep checking chrome remote desktop to see if my computer had loaded so I built a system into the website that will tell me once I can access my computer. This system is still under refinement, but at the moment, it goes a little something like this:
- User presses button on website and loading icon is displayed
- AJAX kicks in and begins checking a MySQL database comparing current timestamp against on on the DB
- My computer meanwhile has a script set to run on boot (Which seems to kick in around 5 seconds after the Windows log-in screen has displayed)
- Script loads a PHP page which updates the database entry with the current timestamp
- When the AJAX script finds that the current timestamp is within 60 seconds of the entry timestamp, it knows the computer has been powered on and updates the web page to reflect this.
Well currently the design for the website is overly basic, which isn't a problem, but I'd like to add a feature that, once the computer has loaded, the loading image is replaced with links to the apps that would be used to connect to it (eg Remote desktop or Plex).
i need more detail please????