Skip to content

A remote power/reset switch for a PC, based around an ESP8266 NodeMCU module

License

Notifications You must be signed in to change notification settings

Kadigan/esp8266-remote-power-reset-switch

Repository files navigation

A remote power/reset "button" based on an ESP8266

It's essentially what it says on the tin: a remote reset/power "button" you connect to your WiFi. Automatically reconnects to WiFi when connection is lost.

This project was developed on NodeMCU v1.0 (lol1n board).

The optocouplers are wired in series; this should ensure that the polarity of the connection doesn't matter - but in case that doesn't work or that you see weird effects like PWR influencing RST (some boards may be more sensitive to this than others), your board's manual should tell you the correct polarity to use (if the board itself doesn't have it printed on the silkscreen - they often do).

If you decide to use relays instead (to ensure maximum electrical separation) - that's also doable, but you'll want to use a driver like a ULN2003 or something similar (ULN2003 is rated at 500 mA per output; if your coil requires more, wire a pair of outputs per coil – it's as simple as shorting adjacent inputs together, and adjacent outputs together). ULN2003 has 7 of these drivers and comes equipped with the reverse diodes for spike dissipation, so it's a single-chip solution. Not sure if a pull-down is necessary in this situation (or even for this board).

You can add a pin header to "pass-through" your existing power/reset switches if you want to, regardless of the solution you pick. It's what I did.

I would also recommend against using D0 for any outputs, because it seems to fluctuate on board start-up - it does something on that pin, and I didn't care enough to find out what (might have something to do with serial, YMMV). Don't use it if you don't want spurious activations on ESP boot.

Powering the ESP8266 up is entirely up to you – just keep in mind that if you power it from the PC you want to switch on, you'll want to hook into the +5VSB rail, so that it doesn't get shut off with the rest of the system. Also keep in mind that +5VSB is not guaranteed to come back up on mains restore – my power supplies (the ones where I cared to check, at least) usually didn't bring it back up, and required at least one physical power-up to restore its presence. Something to keep in mind. I powered my board using an external mains power supply.

The board is configured for power-button long-hold at 5 seconds. For modern boards, soft-off is usually at 4 seconds; older boards may require the full 8 second hold (would recommend 9 seconds in those cases) - adjust as necessary, it should be hard-coded into actions.cpp.

If you want to use this with an older, AT board – one that requires a physical switch to be turned on or off – then I would recommend a bi-stable coil on a "pass-through" mains voltage line instead. A generic relay will work just as well, but if you don't want the headache of having to keep a coil powered for extended periods of time, it's what I'd recommend. I used an RT424FO5 in another project that switches mains on and off, because it can run off of 5V (so I could have a common supply for it and the board), has a low DC set voltage if required, is rated at up to 8A at 250V AC, and can go up to 400V AC if required. Your mileage may vary. Remember to use a coil that is rated at mains voltage for your area, and size it up to your load (typ. PC loads are around the 800W mark nowadays).


The code exposes the following paths:

/ (+ any 404)             JSON info

/reset                    reset switch (always short, 100ms "push")

/power                    power switch, short pulse
/power/short              (same)

/power/long               power switch, hold (5s)

Lines used for the "switches" are D1 and D2.


Circuit essentials:

ESP8266 switch

About

A remote power/reset switch for a PC, based around an ESP8266 NodeMCU module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published