Wake Computer From Sleep WIFI Button


I’ve always setup my computer to be woken up from sleep via an app on my phone (Wol Wake on Lan Wan by Brobble, for anyone interested). But yesterday, I thought, I should just make a button that sits on my couch side table … that’s really where this button should be.
I use my computer as a media manager (using Plex, another app, to manage and stream to my smart TV). As I was thinking out loud that I wanted such an “Easy” button … I realized that I already had all the parts needed to make this happen.
 
All, you need is a Wifi enabled IoT controller (I have a bunch of ESP8266 from my cold brew coffee maker project, you can check out the progress on that project in the last few posts). A button, and a battery. (Banana for scale)
A few intricacies: the button is an Off-On click button. It is not an Off-(On) button … the brackets mean that it does not lock in that position. So the buttons that I have can only be click into either position. This is important to note for the type of code that I must program. Typically, for “trigger” type events like waking up your computer, you would want to have the “non-locking” button type, but with some creative programing, you can trigger the event at the transition point.
You can see and download my code here if you like.

 

The second odd thing, is the fact that the micro-controller itself behaves oddly when either the 0, 2, or 15 pins are at a ground state when booting up. This wouldn’t normally be a problem with an “intermittent On” button, but because I can have the button locked on, and it will have to be connected to one of those pins due to positioning, and the other side is at ground state … its just the perfect storm.
So, needless to say, even though I knew about the ESP8266 having issues with the GPIO0, GPIO2 and GPIO15 pins, I still fell into the trap and had to make sure to use a spare pin as a fake ground. This way I can leave it blank during boot, and then initialize it to be grounded (or Low) after boot.
So, now I have this handy little remote. all it does it wake up my computer by sending an FF-FF-FF-FF-FF-FF packet with the MAC address of my computer to the broadcast ip of 192.168.1.255 (note that when you send to the 255 address, all devices having 192.168.1.XXX will receive this packet), but because each device will only wake if you send its own MAC address, only my media computer wakes up.
Overall not a bad 1-2 hr project for anyone looking to make that media watching one step “easier” while keeping the energy/milage use to a minimum on your computer components.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s