Shutdown computer via motherboard pins with an esp8266 or Arduino with ethernet

Hello,

I want to be able to shut down my computer remotely. I can start it via Wake On LAN with an ESP8266 (WeMos Di1 mini board).

My priority is to protect my computer. For this reason, I decided to use an optocoupler (Vishay SFH610A-1 DIP-4) to protect it. Additionally, I will use an external USB power supply and not the computer’s power supply.

I want to use the attached circuit to shut down my computer. I did not choose the optocoupler based on anything. It was the only one available at the local store. Is it appropriate? I want to be able to use the power button as well. I selected the resistor based on the following values for the LED: Voltage: 1.25V, current: 20mA and the voltage for the ESP8266: 3.3V. I used the formula R = (3.3V-1.25V)/0.02A = 102,5 Ohm.
But I don’t know it the values are correct because I do not understand the datasheet completely. What is the difference between “Switching Saturated” and “Switching Non-saturated”. I added a link [1] to the datasheet at the end. The datasheet shows a circuit on page 5 which contains a resistor before the collector pin. What is the reason for this?

Another problem is that the manual of my motherboard does not specify which pin of the connector is + and which is -. Can I break something if I try it both ways? Is it possible to damage the motherboard with this circuit?

Additionally, but less important:
The ESP8266 cannot connect to the WIFI if the case is closed. Could you recommend me an Arduino with ethernet? I did consider a pure software solution, but it is not possible to shut down the computer via software if it is stuck and Intel decided that my CPU does not need vPro.

Links:

I would strongly recommend doing this in software. If your system has such stability problems that it can’t be trusted not to put itself into a non-working state, I would suggest that be the priority.

  • Connect via RDP (windows) or SSH (unix) and enter the appropriate shutdown command
  • Write a simple program to act as a server and respond to a certain request by executing the shutdown command.
  • Write a program to poll an external website for a command to shut down, and have another page on that site to tell it to change that setting.

DrAzzy:
I would strongly recommend doing this in software. If your system has such stability problems that it can't be trusted not to put itself into a non-working state, I would suggest that be the priority.

  • Connect via RDP (windows) or SSH (unix) and enter the appropriate shutdown command
  • Write a simple program to act as a server and respond to a certain request by executing the shutdown command.
  • Write a program to poll an external website for a command to shut down, and have another page on that site to tell it to change that setting.

+1000 using hardware means to cut of power to your PC is a horrible idea.

I can think of justifications for that approach, but I'm not convinced OP's situation is one of them

ieee488:
+1000 using hardware means to cut of power to your PC is a horrible idea.

Pressing the power button is not the same as cutting the power. The event is handled by the OS. You can even configure to ignore it. My computer usually connects to a vpn to join the network of my university, so that I can use it from there. Sometimes the vpn losses its connection. With this solution I could send a reboot message to the esp (which is not connected to the vpn but to an mqtt server) via a smartphone.

User321321:
Pressing the power button is not the same as cutting the power. The event is handled by the OS. You can even configure to ignore it. My computer usually connects to a vpn to join the network of my university, so that I can use it from there. Sometimes the vpn losses its connection. With this solution I could send a reboot message to the esp (which is not connected to the vpn but to an mqtt server) via a smartphone.

I am not going to argue with you.

You do what you want.

Not my problem to solve.

Does your computer have an ATX power supply?

Truth is I have forgotten how this works, so just look it over and see if anything makes sense.

I think you want to use the system panel connector and have the microcontroller short the power button pins with a tiny relay or an optocoupler.

I would start by making the VPN more fault tolerant. Look up heart beats and auto reconnection mechanics of the client.

The ESP outside the case could connect to the USB port and send a serial communication to the PC and a Python (or any other) receiving program can bounce the VPN.

If the computer has hung, then the ACPI Shutdown signal will not work either and a hard RESET will be required.

If you VPN is dying and your computer is locking up you are fixing the wrong issue or putting perfume on a pig, it still won't make it pretty.

Why not just open a port to the PC via your Internet router and use SSH from Uni to log into it? If you use private/public key authentication and forbid keyboard-interaction then it's pretty secure.

you all are right, RESET should be the last option. @venquessa I considered to open a port, but my provider uses a technique called "dual stack lite" and therefore it is not possible to open a port for the ipv4 protocol. Furthermore, my university does not support ipv6. But I will try the connection via usb to achieve: university -> mqtt server -> esp -(USB)> computer. Maybe I can reuse some of the java code from the Arduino IDE's serial monitor. Thank you.