Get a PC state and turn it on or off

quintellarosa
Posts: 1
Joined: Wed Jul 31, 2024 1:11 am

Get a PC state and turn it on or off

Postby quintellarosa » Wed Jul 31, 2024 1:32 am

Hi, there! Newbie, here.

I have a server at home which I want to know if it's turned on or off and, if necessary, turn it on or off. All by the internet.
This could be accomplished by a feature called Wake-on-LAN (WoL) by broadcasting a magic packet with a MAC Address label on it. This works from LAN, but routers do not forward that from WAN requests anymore.
So, here's my plan: to use an ESP32 to "read" the Power LED connector from the motherboard to check if the PC is turned on; and to use the motherboard's on/off connectors to turn the PC on.
I believe I can feed the ESP32 from the motherboard's aways-on 5V or some USB connector - which would also link the ESP32 ground to the motherboard's ground.
This way I could connect only the Power LED connector to one pin and check if it is HIGH. And use and opto-coupler to briefly short connect the Power ON conectors to turn the PC on.

My question: am I right? Could you please help me by correcting my mistakes, here?

MicroController
Posts: 1734
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Get a PC state and turn it on or off

Postby MicroController » Wed Jul 31, 2024 12:38 pm

Sounds pretty good.

Just a few minor notes:
1. Try and check if the always-on 5VSB can provide the ~500mA an ESP32 may draw momentarily.
2. Check how the power LED is powered (voltage) and controlled (high- vs. low-side switch) to determine how to connect it to an input of the 3.3V ESP32.
3. Since the ESP and the PC share GND, you can probably use a single transistor instead of an optocouple to 'short-circuit' the physical power button. Or, if the voltage across the power button is 3.3V or less, you can connect it directly to the ESP32. Optocouple should work fine though, just mind the polarity.

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: Get a PC state and turn it on or off

Postby jgustavoam » Thu Aug 01, 2024 11:52 pm

Quintellarosa you are correct.
I suggest using an optocoupler to monitor the power led and another optocoupler to turn on the PC (Power on button).
This way, the risk of interference can be minimized.
But you will have to make correct use of these components, since the ESP32 uses a voltage level of 3.3V.
If you have any questions, let me know.
Retired IBM Brasil
Electronic hobbyist since 1976.

Who is online

Users browsing this forum: Baidu [Spider] and 50 guests