Mosfet is probably unnecessary as esp32 pins can be in open collector (open drain) mode, which is floating at high output and connected to gnd at low output.
My acquaintance made similar device, also based on esp32 (or maybe esp8266) to prevent his cat to turn off computer by pressing power button located on top of computer case where cat likes to sit. One gpio pin is connected to power pin on motherboard, other is connected to power button on the computer case and the microcontroller passes “button press” only for specific pattern of multiple presses of power button.
Nice! Yeah, I wasn’t entirely sure about the exact requirements (you can find contradicting advice online) so I decided to err on the side of caution — I would like this solution to work for years to come :)
Similar cat problem, though it was more that he liked to rub against the corner of the computer case where the button was, and it was quite touch sensitive. Again, a piece of plastic and some tape!
Another way to go about it would be a remote controlled socket (e.g. some ESP8266 device running Tasmota), though that’s a bit dangerous with regard to accidentally turning it off while the machine is still powered up.
For sending one-off commands via MQTT or for scripting, I found mosquitto’s mosquitto_pub command line tool very helpful and much quicker then writing a Go/Python/whatever program. mosquitto_sub is also a great debugging tool
Mosfet is probably unnecessary as esp32 pins can be in open collector (open drain) mode, which is floating at high output and connected to gnd at low output.
My acquaintance made similar device, also based on esp32 (or maybe esp8266) to prevent his cat to turn off computer by pressing power button located on top of computer case where cat likes to sit. One gpio pin is connected to power pin on motherboard, other is connected to power button on the computer case and the microcontroller passes “button press” only for specific pattern of multiple presses of power button.
Nice! Yeah, I wasn’t entirely sure about the exact requirements (you can find contradicting advice online) so I decided to err on the side of caution — I would like this solution to work for years to come :)
I had the same cat problem. Solved it by taping a flat pice of plastic over the button and offering the cat a different place to sit :-)
Similar cat problem, though it was more that he liked to rub against the corner of the computer case where the button was, and it was quite touch sensitive. Again, a piece of plastic and some tape!
Another way to go about it would be a remote controlled socket (e.g. some ESP8266 device running Tasmota), though that’s a bit dangerous with regard to accidentally turning it off while the machine is still powered up.
For sending one-off commands via MQTT or for scripting, I found mosquitto’s mosquitto_pub command line tool very helpful and much quicker then writing a Go/Python/whatever program. mosquitto_sub is also a great debugging tool