This design is still a working progress, although it's already up and running in my PC 👍 it's been great
I wanted to connect to my home PC from work, which already has Windows RDC setup and forwarded. However, I always find myself in the situation of forgetting to power on my PC before I leave.
WoL(Wake on LAN) is definitely a valid solution, I just need to send a magic
packet to my PC to turn it on but the issue is I do not have a Ethernet
connection to my PC, and WoL is almost impossible to do with WiFi cards.
Instead of using the WoL feature of my motherboard, espwol uses a
WiFi connected ESP8266 NodeMCU to received post requests and activates
a solid state relay(Optocoupler) to short the power button, just like how
you would power on a PC at home.
To create the push request through the internet, you could assign a static ip
for the ESP through your router and port forward the http port 80 to
the internet.
However, this is not recommended if you do not have authentication set up, which is what is in place now.
What I do is I connect through my server that has Open VPN setup with proper
authentication and then I can send a post request to e.g.192.168.0.100 just
like I'm at home.
I like to use POSTMAN to test my API's and its a easy way to send requests.

curl -X POST http://192.168.0.100/pushThe hardware of the solution is fairly simple consisting of only 3 components, of course, you need your jumpers, perf-boards or fancy sockets if you want.
NodeMCU v1.0(Or any other ESP based chip, for example aESP32)PC817Optocoupler (4N25,6N136,MOC3021,MOC3041,6N137could all work)150Ωresistor
The push button is not needed, its just there to repersent the power button on your PC
+5VandGNDtovinandGNDpin on ESPpin 1ofPC817to 150Ω resistor thenD0(akaGPIO16)pin 2ofPC817toGND- connect whatever connector you like for the input and output pins, I just used some standard two screw PCB termination blocks.
We also need two sets of connects from the PC to the ESP
-
Connect
GNDof power supply toGNDof ESP, you can find a GND wire on the24 pin,PCI-E,SATAor any kind of wire that comes out from your PSU, it's almost always a black one. -
Connect
+5Vto thevinof ESP. To do this, you need the always on+5vfrom your24 pinconnector to the mother board, its thepurplewire or pin9. -
What I did was simply cut the
purplewire on my24 pinatx connector and spliced in a wire that goes into my ESP. For the grounding, I just used an unusedSATAconnector.
The software of this design is very simple, I just need a server that connects
to my home WiFi and listens to POST requests on a endpoint. Since I will be
running this in my local network only, I didn't implement any security features,
but definitely a future TODO.
The server is written using aREST by @marcoschwartz which makes it super easy to create a end-point to send requests.
Theres only a couple of lines that I added to the boiler plate code of the library to make it work.
I'm using platform.io through VSCode but you can write the script in
ArduinoIDE; however, you you need to install the aREST library regardless.
// Define powerbutton pin
#define POWER_BUTTON_PIN D0
int push(String command)
{
digitalWrite(POWER_BUTTON_PIN, HIGH);
Serial.println("Button Pushed...");
delay(200);
digitalWrite(POWER_BUTTON_PIN, LOW);
return 1;
}
void setup(void)
{
...
// Initiate D0 as an output
pinMode(POWER_BUTTON_PIN, OUTPUT);
// Function to be exposed
rest.function("push", push);
...
}Please feel free to create a pull request if you want to add more features, fix a bug or add anything. Here are some ideas that I want to implement:
- Add authentication and security to
POST - Intercept and measure computer power state
- Add another channel for
RESETbutton - Create a WebUI for managing post Requests and host it through the ESP
- Setup ESP
Watchdogto save a bit of power


