Controlling printer power from within OctoPrint

Im trying to use it with the pi, but cant get it to work. What should I connect where etc? I have tried using a mosfet and a GPIO pin to short the ground and GREEN wire, but its always powered on, even if i disconnect the ground from the mosfet

Could you please stick to one thread?

Multiple posts on one and the same issue does not provide a faster solution.

Im also stuck at whats the best option to remotely power off the printer. My pi is also powered from the printers psu. I thought about installing a relay between the 24v out of the psu but it will probably need to be a very heavy relay for the amps used by the printer.
My current plan is to place the relay before the psu, to switch the 230 volt. Plan is to see what happens when i just shut down the pi in the octoprint menu. Will it open the relay and shut down both devices? But how will i get my devices back to power up? Can I bypass the relay momentarily with a push button to start the pi and printer until octoprint is active and my relay is activated? Or will i face too much problems going in that direction?

Of course you can do this. Basically the whole system becomes a latching relay.
The Pi has a usefull feature just for that : see dtoverlay=gpio-poweroff (in config.txt) ; you will have to drive the relay with this pin (of course not directly)

1 Like

Great. Very helpful and i think exactly what i was looking for. Ill dive into some tutorials anout this option. Thx again