OctoPrint Dual 3D Printer Power Controller

by CHWTT in Workshop > 3D Printing

196 Views, 2 Favorites, 0 Comments

OctoPrint Dual 3D Printer Power Controller

Render C.png

In this Instructable, I'll show you how to make an all-in-one controller that contains a Raspberry Pi running OctoPrint, as well as a custom PCB with some power electronics that allow the OctoPi to control the mains power to two separate 3D printers/devices that use standard IEC C13 power cords.


Mandatory Disclaimer: This project does involve working with mains voltage. Mains voltage can, if worked with improperly, hurt you or start something like a fire. Additionally, although I think my design is sufficiently well-built to handle the currents that it's fused at and the voltages that are put through it, it hasn't passed any official safety certifications and that's a risk you have to accept if you choose to build this. Build at your own risk, but outside of that, have fun and make a cool device!

Supplies

Electronic Components:

I'd strongly recommend buying all these components from a known electronics components retailer, because it's really important that you use the exact same components that I did, otherwise you risk things not fitting or working properly.

2x Bulgin PX0675/63

2x Bulgin PX0580/63

4x Omron G5Q-1A4-EU DC5

4x Littelfuse 01110501Z


These are more generic components that can easily be found on sites like Amazon. However, if you're placing an order at a components retailer already, you can probably find some of these there so you can get cheaper pricing.

4x 3-Pin 5MM Pitch Screw Terminals

1x 1x4 2.54MM Male Header

2x 2N3904 Transistors

2x 470 Ohm 1/4W Resistors

2x 1N4007 Diodes

2x 8A 125/250VAC 5x20MM Fuses

4x Female to Female Jumper Wires

18AWG Wire

Heat Shrink Tubing

1x Raspberry Pi 4 2GB (Or 5, but a 5 is really overkill, and make sure you have a power supply for the Pi)


Mechanical Components:

M2.5 Hardware:

  1. 4x 20MM Standoffs
  2. 4x 15MM Standoffs
  3. OR 4x 35MM Standoffs if you have them
  4. 4x M2.5x6 Screws
  5. 4x M2.5 Nuts

M3 Hardware:

  1. 8x M3x6 Screws
  2. 8x M3x12 Screws with Countersunk Heads
  3. 8x M3 Nuts


Other:

IEC C13 to C14 Power Cords (From printer to control box)

3D Printed Case - I Provide the STL files in this Instructable so that you can either print these parts yourself, or if you're looking to get them printed for you, you can check out PCBWay (my YouTube sponsor) who can print them for you.

Custom PCB - Follow this link to the PCBWay shared project where you can directly order the custom PCBs from PCBWay like I did (Note that PCBWay is my YouTube sponsor).

Watch the Video!

Use OctoPrint to Control Your 3D Printer's Power!

I made a YouTube video on this project, please watch it before going any further, as I think it gives a good overview of what you're in for if you make this project, and I point out a few things in the video that may not be covered in the written tutorial.

Assemble the Custom PCB

Assembled PCB.png
PCB Fuse.png
Middle Pin Removed Terminal.png

Solder all of the components on to the custom PCB. This should include the 2N3904 transistors, 470 Ohm resistors, diodes, fuse clips/fuses, the relays, and the connectors.


About the fuses, although my silkscreen markings specify 125V fuses, if you're in a country that uses 220-240VAC mains power, use a 250V fuse. The rest of the board, assuming you're using the same sockets, relays, and terminals as I am, is built to handle 250V, so just select a matching fuse even though it goes against what my silkscreen says.


Some more notes about the connectors, the 4-pin 2.54mm header can be soldered like normal, however the 3-pin terminal blocks will need some work. I removed the center hole from the footprint for these connectors, because I liked the idea of having the two wires installed in them as far apart as possible, and I accomplished this by using the two end connections on the terminal blocks and removing the central connection. You can remove the central connection point by fully unscrewing the screw and then popping the terminal part out of the front of the block.

Test the Custom PCB

Testing PCB.png

This step is optional, however since this board works with mains voltage, I think that testing it before putting it under that kind of a load is a good idea.


To test the board, use a multimeter and a bench power supply to power the board and activate the two different sets of relays, while making sure that the correct connections are closed/opened. To activate a set of relays, connect its control pin (either P1 or P2) to +5V with the board being powered of course. When P1 is enabled, the two screw terminals labeled P1 should have their two terminals connected, so the P1 L connector should have both of its connection points connected together and P1 N should have its two connection points connected together. The same goes for P2. If all is working properly, move on to the next step.

Connect the Pi to the PCB

PCB With Standoffs.png
Pi Electrical Connections.png

Here you should use all of the M2.5 mounting hardware and the jumper cables to connect the Raspberry Pi to the PCB. Make four 35MM standoffs by combining one 20MM standoff and one 15MM standoff four times (if you have 35MM standoffs already just use those) and then mount them to the four holes in the PCB for the Pi by using the M2.5 screws. The Pi will sit upside down on top of these four standoffs and be secured with some nuts when in the enclosure, but don't do this just yet, as we need to plug in some jumper cables and also the Pi blocks one of the PCB's mounting holes when it's mounted.


To connect the PCB to the Pi, use four of the female-to-female jumper cables to connect 5V on the PCB to 5V on the Pi, GND on the PCB to GND on the Pi, and P1 and P2 to any two GPIO pins on the Pi, just remember which ones you used. I connected P1 to GPIO 23 and P2 to GPIO 24 if you want to copy exactly what I did.

Mount the IEC Sockets in the Case

Sockets Mounted.png

Now we're going to take a moment away from the PCB and the Pi to mount the IEC sockets into the 3D printed case. Mount them using M3x12 screws with countersunk heads and some M3 nuts. Doing this step now is ideal because getting the nuts on for the bottom bolts in particular can be quite tricky, and the case is as empty as it will ever be at this point.

Mount the Custom PCB and Pi in the Case

Partially Mount PCB.png
Pi Mounted.png
Rest of PCB Screws.png

Next, take the custom PCB assembly with the four standoffs still attached to it and the Pi tethered to it by the wires and set it into the enclosure. Then, install the M3x6 screw in the corner of the board that's located closest to the Pi's headphone jack to secure it partially to the case. Then, take the Pi and wiggle it onto the standoffs and get all of its I/O lined up with the holes in the sides of the enclosure. Once the Pi is on the standoffs, you can secure it with the four M2.5 nuts, and you can also install the remaining three M3x6 screws that will mount the custom PCB to the case.

Wire Up the IEC Sockets

Partially Soldered IEC.png
Plug in IEC Cables.png
Soldered IEC.png

Use the 18AWG wire and heat shrink tubing to connect the IEC sockets to the screw terminals on the boards. The live and neutral connections on the IEC sockets should be labeled, and the silkscreen on the PCB also points to which wires go where. Just know that the male sockets (the two outer ones) are the ones that the "IN" connections should go to, and the "OUT" connections go to the female (two centermost) sockets. Plug in extra IEC cables that obviously aren't live to the sockets you're actively soldering on to mitigate the risk of melting one of the pins out of its correct spot.


After the live and neutral connections are made, use two more pieces of wire to connect the earth connections on the two rightmost sockets to each other and the earth connections on the two leftmost sockets.

Set Up the Pi's GPIO Pins in OctoPrint

GPIO Setup.png

I'm not including any information on how to install/setup basic OctoPrint, as other people have great tutorials on this, but after you have your basic OctoPrint image ready to go, install the plugin available at this link: GPIO Control


Then, once it's installed, go to its configuration section in OctoPrint's settings and add two buttons labeled Printer 1 Power and Printer 2 Power. Set the GPIO that they control to the GPIO's you connected to P1 and P2 respectively. When active, they should be high, and they should default to off so that when your OctoPi boots up, it doesn't automatically turn on the printers as well, unless you want that.

Close the Box and Give It a Test!

Close the Box.png

Attach the lid to the enclosure with four more M3x6 screws, plug in two regular power cables to the power in sockets on the box, and connect from the box to your 3D printers with the C13 to C14 power cables you ordered in the materials section. Also, make sure that the power switches on your 3D printers are left in the ON position. Then, connect to your Pi's webUI and press one of the buttons you made with GPIO control, and hopefully your correct 3D printer boots right up!