Remote gaming Rocket

Why pay double?

/ n3rd, Internet, Gaming, Arduino

Fast internet + remote wakeup of PC + Steam remote play = Remote gaming!

I want to play computer games on the road. I want to make use of the expensive gaming rig that collects dust at home. Just like the ever growing Steam library collects dusts. This guide explains how to to this - properly.

With the advent of Steam remote play, which is the successor to Steam In-Home streaming, Valve allows to stream gaming across the Internet.

So the idea is simple: Wake up my powerful gaming machine at home from anywhere on the planet, stream my games to any machine with a Steam client and game. When done, put the machine to sleep again.

This "guide" is only for those with access to their Motherboard, because we are going to add a piece of hardware to your machine. If you only have a Laptop, this might not be for you*.

Why bother, when Stadia is coming up?

Remember when you bought your games in a cardboard box, bundled with a printed manual, maybe a map and some other goodies? By now we got used to digitally "buying" our copies - Where buying is more like acquiring a license subject to the merit of the licensor. But still, you feel like you own the game. The game might sit in your Steam library and collects virtual dust, but it can be played when you want, even offline (of course, that is not what we aim to achieve today) years after your purchase at no extra cost.

With Stadia and other streaming services, you start renting games. Centrally served, centrally controlled in content and availability. No modding possible, no self-hosting, no guarantee the provider or producer won't pull the plug one day.

Imagine you bought Battlefield 4 and have enjoyed it for more than 4 years. You own the game, you can play whenever you want. As long as someone is willing to rent a server, you can play online. This can go on for as long as there's interest. Now imagine you are EA and you want to make your shareholders happy. People playing BF4 and being happy with it won't buy a new Battlefield which shitty ratings, like Battlefield V. Now imagine the world has moved to game streaming only. EA could just pull the plug on Battlefield 4 and force players to move on. Subscription is dependable income. This is interesting to shareholders, but as consumers we are forced to leave good things behind for the sake of consuming newer and more services. It's a losing battle, but at least remote streaming games we own is an attempt to keep the status-quo a bit longer. Until all publishers shift to streaming exclusives.

Methods for remote PC gaming

The following sections describe methods to access your library (remember, your library) from wherever you have proper Internet.

Wake up your PC: Wake-on-Lan and it's sibling, Wake-on-Wlan

If you have your PC connected via LAN to your home network, you might be able to use Wake-on-Lan for your machine, which allows you wake your machine via magic packets through your home router. That is the simplest way to wake up your machine remotely. More info can be found here.

Some Notebooks even have such a feature for Wake-on-Wlan, but I have not found any working solution on the Internet where it truly works.

For Wake-on-Wlan to work, the WiFi hardware needs to be powered and remain connected to the router at all times, even when the machine sleeps, so the router knows where to send a magic packet and the the machine receives it. Like said, I have not found a configuration where this works. I tried with a Dell XPS 9550 with integrated Wake-on-Wlan feature and I even tried it with matching hardware, an Asus RT-AC68U router and a Asus PCE-AC68 WiFi PCI-Express card. It just never worked. If you want to give it a try, check here.

But what if the PC is turned off

Both Wake-on-Lan and Wake-on-Wlan have issues: What happens if the machine is turned off? What happens if you need a hard reset? Both of these only work for sleeping machines. If you reboot, you might run into the problm of logging into the system - or worse: The system hangs with a blue screen and you are stranded on an island without being able to rescue your poor Windows which has done its best to crash, again.

Being just able to simply wake up a remote machine might not cut it. We get to that. We will solve this isse with hardware.

Stream your game: Steam Remote Play

With the successor of Steam In-Home-Streaming called Steam Remote Play, there's no need for a VPN, Hamachi or complicated Firewall rules. Just forward a couple of ports from your home router to your gaming rig.

Remote Play works quite nicely with a resolution of 1080p and an upstream of 12Mbit/s. Granted, with this your upstream needs to be a bit above German average (as of 2019), but more modern countries might have no problems with reaching such an upstream even in rural communities.

Remote Play is nothing for competitive Shooters, but I found latency suitable for RTS and casual Multiplayer. The difference in latency between streaming from my office to the living room inside the LAN was even comparable to the latency of streaming from Munich to Denmark.

Other streaming methods

There are other methods apart from Steam remote play: TeamViewer, RDP, SSH tunneling and few other streaming options. I found all of them either to be too costly or adding latency. Steam works fine. Steam also allows to start non-steam games, you can use it for streaming games from other digital platforms & emulators or even simply your Desktop and anything displayed there (Netflix?).

Remote wake-up, reboot, reset & shutdown

Wake-on-*lan does not solve the problems of remotely turning on and off. If you need to restart your machine for some reason, Wake-on-Land might not help you.

Hello IT
If you don't know this quote, this isn't for you.

In order to full control your machine I found a simple, but genius idea on the Interwebs: Interconnect a relay between the physical power button and the Motherboard:

wiring sketch by mekada of blynk.cc
Image courtesy blynk community user 'mekada'

Thus, as mentioned, for this to work you need a PC.

Build the solution

Now that we know we need more than Wake-on-*Lan, let's build ourselves a nice little box and project.

Required materials

Build the hardware

The first step is to acquire a relay and an ESP8266. For simplicity, reliability and availability, this guide only considers Wemos hardware. You can procure them easily from local tinker shops, amazon or aliexpress.

If you have acquired the relay shield, you need to solder it's spacers to it. This way it can sit on top of the d1 mini and not block it's WiFi signal. Then you stack it on top of the wemos d1 mini, connect both with nice solder points and the hardware part is almost done.

Relay and d1 mini connected
This is how it looks when you stack both together

Wire it up

The function of the power button in your PC: When you press the power button, a 5V circuit is closed for the duration of the press. What happens is based on BIOS settings, e.g. a long press can reset the PC, a 3s press put it to sleep.

As per sketch of mekada, the relay needs to sit between the power button and the motherboard.

Motherboard

First, you need to remove the wires over the power button, keeping them close. The female connectors of two wires connect the + and - of the PWR_SW header on the motherboard. You can then connect the two male connectors of the jumper wires to the middle and "NO" contacts of the relay

Power button

Interconnecting the wires of the disconnected power button require either two male/male jumper wires, or slipping off the female connector of a male/female jumper wire. Both methods work.

Stick a male connector into each the female connectors of the power button cables and the other end of these jumper wires meet their counterparts in the "NO" and middle contacts of the relay.

I removed the plastic cover of a female connector of a jumper wire and squeezed a male connector into the metal remains of the connector. This way I have a decent enough electrical and physical contact:
two connecter jumper wires
Kinda a hack, but good physical and electrical connection
all cables in, but in the wrong connector
Don't do this, read below

This image shows the nearly finished project, but I had the "NC" connector in use, which would require keeping the relay active to keep the circuit open. Don't just wire it up like in this image, use "NO". This way the relay is only "active" when closing the circuit.

Place it in the box

finished an in box
Hardware finished, (correctly) wired up and placed in PC

I created a little cardboard box for this little contraption. It's squared and nearly 3.7cm on all sides. It ain't pretty, but it is mine.

You want to place the thing inside your PC if you can ensure WiFi signals are not shielded. This way you can keep the jumper wires short. Before closing the PC case or hiding the relay stack, you still need to access the microUSB port of the d1 mini for programming and later powering.

Power the ESP8266 and Relay

Depending on your Motherboard, you can use a USB header or internal USB port to power the Wemos D1 mini (it powers the Relay as well). Check your BIOS if it allows to have the USB ports "hot" even when the system is turned off.

In my case I ran an USB cable to the outside of the case and into a leftover iPhone charger. This way I'm 100% independent of internal power.

BLYNK.io for control

Blynk describes itself as:

Blynk is a hardware-agnostic IoT platform with white-label mobile apps, private clouds, device management, data analytics, and machine learning.

It's a compellingly easy platform to use. All you need is to add to download the app for your mobile OS platform, create an account and add a very simple sketch.

I found it not to be necessary to change Firewall settings for blynk to reach the IoT device in your home network. Their app works from across the Internet and the local lan.

Blynk project

Create a new project in the blynk app. When doing so you will be sent an auth token via email, which we'll need later.

In the project add a new push button and have it point to output D1, configuration 0 to 1. Label the button to your liking.

configuring the push button in the blynk projectthe simple project interface

That is all you need for creating a simple button

Arduino Sketch

You need to install the ESP8266 board via Board manager to your Arduino IDE. Note: Version 2.4.2 is recommended over newer releases.

In addition, you need to install the blynk library - I used the library manager, even though the link above advises manual install.

Once you have it in place, you can use this sketch. Note the required changes:

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************

  Simple push notification example

  App project setup:
    Push widget

  Connect a button to pin 2 and GND...
  Pressing this button will also push a message! ;)
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG //uncomment if you want to debug

#include <ESP8266WiFi.h>
//#include <BlynkSimpleEsp8266_SSL.h> // somehow https connection sadly is not as reliable for me
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "<YOUR AUTH TOKEN>";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "<YOUR SSID>";
char pass[] = "<YOUR WIFI PASSWORD>";

unsigned long previousMillis = 0; // last time update
long interval = 3600000; // interval at which to do something (milliseconds)

void notifyOnButtonPress()
{
  // Invert state, since button is "Active LOW"
  int isButtonPressed = !digitalRead(1);
  if (isButtonPressed) {
    Serial.println("Button is pressed.");

    // Note:
    //   We allow 1 notification per 15 seconds for now.
    Blynk.notify("Yaaay... button is pressed!");
  }
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "188.166.206.43", 443);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Setup notification button on pin 2
  pinMode(1, INPUT_PULLUP);
  // Attach pin 2 interrupt to our handler
  attachInterrupt(digitalPinToInterrupt(1), notifyOnButtonPress, CHANGE);
}

void loop()
{
     unsigned long currentMillis = millis();

    if(currentMillis - previousMillis > interval) { // Reset the esp8266 every hour
     previousMillis = currentMillis;  
      Serial.println("Reset.."); 
      ESP.restart();
    }
  Blynk.run();
}

When you are ready, upload the sketch to your d1 mini, power cycle or press the reset button on the d1 mini and you are ready to go.

Testing the sketch: You might want to test your sketch without having the PC connected via jumper wires.

When you press the play button in our blynk project, the d1 mini should appear as online and pressing the button you created trigger the relay. Closing and opening of the relay emits an audible clicking sound from the relay. A sound reminiscent of the times when computers where made of such things. Listen to this "click", it's like the voice of grandfather's coming in over the morse line. The noise of the old IBM mainframes analyzing telephone calls for the word bomb. And with such a clicking sound your PC can now be turned on, put to sleep, turned off or reset (depending on your BIOS).

If the click comes and goes as intended, (re)connect the jumper wires to the PWR_SW connector headers and we are done.

Headless operation

Now that you can turn your PC on and off at will, you also want to game with it. Your graphics card wants to output Pixels onto a screen. When you are not at home, you may want to save energy by keeping your monitor off. Some Monitors inform the graphics card of their capabilities like resolution, color depth, refresh rate etc also when they don't have power connected (for example, my old Dell 20'' does this) while other screens don't deliver this service without power (for example my newer AOC Aegon screen).

This is a problem: The graphic card drivers might refuse to wake up the sleeping giant of your graphics card and Windows might only present you an 800x600 screen resolution when connecting remotely. With this resolution and now graphical acceleration, gaming is kinda useless.

You can test this by disconnecting power from your monitors, turning off your PC and booting up. If you then remotely connect to your desktop (TeamViewer works best for this), you can check available resolutions and if the graphics drivers detect your graphics card. If you monitor(s) is/are detected, you're in luck and you don't need to take further action for remote gaming. If not, read on.

Dongle to the rescue

When your screen does not send any information you need to help yourself out, unless you want to keep your screens powered on all the time or use a second dongle like contraption to power up a screen remotely.
Unfortunately, Windows 10 made it harder to create virtual monitors with virtual resolutions. I found it much easier to get an HDMI dongle pretending to be screen:

Dongle
A small device that fakes a monitor

You can procure such a dongle via amazon or aliexpress (much cheaper). Simply plug into an HDMI port of your graphics card when planing to access your machine remotely. I do not keep it plugged in when I am at home.

Next Post Previous Post

Blog Comments powered by Disqus.