Controlling the power of your 3D printer with OctoPrint
- 5v Relay - SRD-05VDC-SL-C
- Dupont Connectors
- Dupont Crimps (to correctly crimp down the connectors to your wire)
- 22/4 shielded wire (There are better options and we only need 3 wires, this is just what I had on hand)
- M3*12mm Bolts and Nuts
I'm starting to look into controlling the power of my Ender 3 3D printer from my Raspberry Pi running OctoPrint. I was able to locate the PSU Control plugin for OctoPrint, so I think this is the route I am going to go.
This plugin is also available via the OctoPrint plugin manager.
Next I picked up some relays to allow the Pi to control power via the GPIO pins on the Pi.
I have modified a Relay mount to include some M3 style tabs so you can bolt the relay to the frame of your printer with T-Nuts.
I cut the 24volt Hot line coming from the PSU and placed the Relay between the PSU and Printers mainboard. This will allow me to keep my Octoprint Raspberry Pi on while turning the printer off and on via the OctoPrint web portal.
I have it set up this was, as my Raspberry Pi setup is powered off the Printer PSU.
The red wire is cut from this connection (coming from the printer) and the relay is connected with the 2 ends of the red wire.
The Normally Open and Closed (center location) terminals are used. Normally Open means the circuit will be Open by default, thus the Printer gets NO power. A signal from the Raspberry Pi is required to trip the relay and close the circuit, powering on the Printer.
You can use Normally Closed if you wish, this would mean the Printer always gets power by default and a signal from the Raspberry Pi is required to power OFF the printer.
The relay also has 3 pins located on the other side. These are for 5v power, ground and control signal all coming from the Raspberry Pi. I used a 4 conductor shielded cable to run power from the Raspberry Pi from the front of my printer, back to the relay in the rear under the bed.
I crimped on Dupont connections to each wire and hooked them up to the relay. In my case Yellow is the signal wire from the Raspberry Pi GPIO pins, Red is 5V from the Raspberry Pi and Black is Ground from the Raspberry Pi.
I connected my wires to the rear of the Raspberry Pi, but you can use the top pins if you wish, shown below.
Once everything is wired up, you can then download PSU Control from the OctoPrint Plugin Manager.
After the installation of PSU Control, you can reboot OctoPrint and configure the settings.
This is my current setup, be sure to set the GPIO Mode to BCM, and set your pin to 21 to match our setup, the remaining settings can be configured to your liking and a full write up of the options can be found on the OctoPrint PSU Control Site
Once everything is done, there will be a Lightning bolt icon in the Top Right of your OctoPrint UI, Click this to control the power of your Printer!
My current PSU Control settings in OctoPrint.