Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Richie1972
#76916 Hi,
I'm using a Sonoff S20 for turning on my PC, but for turning off the PC I need to wait for it to shutdown first.
I could take a connection from one of the cables coming off the ATX psu (but don't want to go down this route).
So, one option would be using something like an ACS712 to monitor the current flowing through the mains cable. However, the only spare connection on the S20 is GPIO2. I am not bothered about reading the value generated by the ACS712, but just want an output to feed to the GPIO pin that is, for example 3.3v if enough current flows and 0v if only minimal current flowing.
Can anyone help guide me in the right direction on this?

Thanks,
Richie
User avatar
By Richie1972
#76924 Actually, after further investigation it's not GPIO2, but GPIO15 - looks like it has a pull down resistor and can have a lead soldered to get yo the connection.
So, just need some advice on how to get an output from the ACS712 that is low when low current flowing and high when high current flowing.

Thanks,
Richie
User avatar
By QuickFix
#76927 I'm sure this project is just a proof of concept, but in case it's not: you know about WOL?

Or do you have ay other reason to use this rather unusual detour? :?
User avatar
By Richie1972
#76930 I've used WOL extensively in the past, but this is not relevant here.
I've set PC to boot when power is applied, so the Sonoff switching on powers up the PC.
The problem is cutting off power when the PC has finished shutting down.
I have checked and confirmed power to USB still remains (there are no BIOS settings to prevent this).
I had wanted to avoid opening the PC as it is in a harness under the desk, so had thought of the current sensing option.
If this is not feasible, then I could take a feed from one of the Molex connectors to drive a relay to put 3.3v to GPIO15.

Thanks,
Richie