Power On PC with ESP32

Hi,

I am quite new in the microcontroller / programming field. I researched and did a lot of "basics" in ESP32 and Micropython.

Now I want to have a more stable WOL (Wake on LAN) replacement as a generic solution to power cylce a generic PC mainboard with an ESP32.

I hope this is the right category to get some feedback especially when it comes to the electronic / components part. Excuse my component drawing - not professional - but I hope understandable I currently have the following:

1) Power Cycle PC

That works, I can send a short signal from Pin13 for power on and a long signal for a "forceful shutdown". Question is the circuit good, anything missing or overkill?

2) Read Power Status

Original idea was to connect Pin32 to the "RESET" pin on the mainboard. But somehow this always outputs high/1 even when power is off.

My workaround is to use the Power LED. This works so far. Output is "1" when PC is running and "0" when I turned it off. Is the circuit below safe? Do I need the GND connection to the ESP32? Do I need any additional resistors or something?

Well, if you think that connector is safe enough (no extra voltage/current) you're ok, but dealing with other "externally" powered devices I better consider using optocouples to make sure the two sides are electrically isolated.

Thanks for the feedback! And regarding the "POWER_LED" readout this is also safe? Would it be sufficiant to leave the GND (LED-) out?

Yes, in theory you can do it, but when you connect an external signal you should test it before to see the compatibility of its voltage and current levels. In this case I suppose that LED signal works at TTL level 5V, so as ESP32 works with 3.3V signals natively you better put a level shifter to protect your ESP32 GPIOs.
A voltage divider could be the simpler solution.

No circuit can work without common ground connection, so the scheme 1 is wrong

But it works. I have it setup exactly this way.

No. it can't
How the ESP32 powered? From the same PC?

No ... in prototype setup from another PC via USB.

The transistor is opened by the voltage difference between the base and emitter. If it is connected to the controller with one wire, you cannot create any voltage difference. This means the scheme cannot work.

If something turns on and off for you according to this scheme, it’s an accident, just interference. Change anything in the circuit or just move the board to another location - it can stop working

Then i guess it uses the usb connection (which also has a ground?) to create the signal?

may be

Ok so I switched my thinking to optocouplers. This is my current idea:

Is R2 and R3 necessary?

On the IN esp32 pin, you need to turn on the internal pullup or it is better to install an external resistor to VCC.

I doubt so

1 Like

What grief did WoL give?

@b707 FETs are highly sensitive devices. You can turn them on with a tiny ESD. So it is possible to turn a FET on without source connected to GND. Note that using ESD on a FET, as well as operating one w/o GND is not recommended, at all.

BC547 is not FET, according with datasheet...

Me stupid? :rofl:

Yep, BJT is another species.

WOL does not work with my Mellanox ConnectX4 Fiber cards and it also does not offer (forceful) shutdown.

I plan to also use ESP32 C6 controller (Zigbee) so I can control a number of homelab computers also "wireless".

You got a point there.

Perhaps the SFP module is shutdown.

Anyway, your circuit seems ok, some software to control it and your good to go.

1 Like

So I connected everything according to the diagram, except R2/R3 (I left out), switched PIN32 with PIN14.

So far it works I only wonder is it correct the PIN 14 shows HIGH/1 when the mainboard is off and LOW/0 when the mainboard is running?

import machine
import time

# Define boot button on ESP32
button_pin = machine.Pin(0, machine.Pin.IN)
power_pin = machine.Pin(13, machine.Pin.OUT)
reset_pin = machine.Pin(14, machine.Pin.IN)
reset_pin.init(mode=machine.Pin.IN, pull=machine.Pin.PULL_UP)

# Main loop
while True:
    if button_pin.value() == 0:
        power_pin.on()
    else:
        power_pin.off()

    print("Power State:", reset_pin.value())

Hi, It seems this topic is related to the project that I am about to do. I am asking permission if I could make your project as a reference for my project?