Multiple 3D Printers Controlled with only One Raspberry Pi
Too many printers, not enough Raspberry Pis? Controls Three 3D Printers at once using Repetier Server…
Quick Links
Introduction
Like most of you I have been controlling my 3D printers with Octoprint for years. With each new printer came a new Raspberry Pi. So, when I got my 4th printer, I headed to my usual sources to get another Pi to act as a server. It is then that I discovered that the supply shortages of the last few years (circa 2022) had driven the price of a Pi well over $100 USD. I picked my jaw back off the ground and went looking for a solution that wouldn’t cost half the price of my cheapest printer. I started by looking at running multiple Octoprint instances per Pi. I found this could be done through some clever hacking, containers and dockers. Honestly though, I just wanted to print and avoid as many headaches as possible, so I kept looking. Eventually I stumbled on
This little software package was exactly what I was looking for. The free version could control up to 5 printers, allows for custom I/O operations, custom event driven G-Code and much more. Browsing around the site I also found that a ready to go Raspberry Pi image was available for download. This was definitely the easy button option. I decided to go for it and was blown away by how simple the whole process was. I salvaged a Raspberry Pi from one of my existing printers and was able to build up the rest of the server for less than $40 USD.
Requirements:
Before really setting my teeth into this project I clarified my goals. My three top requirements were:
- Control printing operations of at least three 3D printers with one Raspberry Pi
- Control power on/off for each printer independently
- Allow different printer’s power inputs to draw from different A/C lines
This last requirement (draw from different A/C lines) was created out of necessity. For years I have been running two printers on the same 15 amp circuit as the rest of my general office equipment (Computer, Monitors, Lights, etc). I had never done the math, but I knew I was getting close to maxing out the circuit. Before proceeding I opted to do a little science. I picked up this A/C plug-in current sensor from Amazon for only a few bucks:
With next day shipping I had the sensor in no time and got to sciencing. I worked through each printer at a time and collected the standby current draw (With no heating). Then the current draw while heating the hotend (Standby + hotend) and then finally with the heated bed and hotend on (Standby + Hotend + Heated Bed). With a little math to separate out the current draw contribution the following chart of current draw was generated:
Surprisingly my Ender 3 Max had the highest current draw at 4.5amps while my much bigger Kobra Max drew 4.25 amps. As expected the Ender 3 legacy (Gen 1), my smallest printer, drew the least at 3.25 amps. Adding them all together gave a total peak draw of ~12amps. This was under my 15 amp limit but wont allow for any margin nor anything else to live on the circuit. Since my printers do not live in isolation, I felt safe dedicating 6-7amps per circuit to printers which meant I would need at least 2 circuits for my server.
Design
Using the requirements derived above I created a rough system diagram for my expected implementation:
In this diagram you can see that we will use two different AC circuits. Circuit 1 will power a 5V supply for the Raspberry Pi and my largest printer. This circuit should top out at about 5-5.5amps leaving plenty for my computer and monitor that live on the same line. The second line will power my other two printers, topping out just under 8 amps. Each printer’s power will be controlled by an independent AC Relay, controlled via IO pin from the Raspberry Pi. Finally, each printer will connect to the Pi via serial-usb for logic and machine control. Based on that, I hopped into Fusion 360 and generated the following 3D printable design:
Files
3D printable files can be found on Thingiverse: Multiple 3D printer Controller, one Raspberry Pi by Hawking – Thingiverse
Bill Of Materials
As per my usual method, I scrounged through my junk drawer for parts but came up pretty empty. I headed over to Amazon and sourced out what I needed.
Item | Description | Qty |
---|---|---|
Raspberry Pi 4 | 1 | |
5V Switching Power Supply | 1 | |
5 V fan | 2 (Optional 1) | |
Raspberry Pi 3 Relay Hat | 1 | |
AC Socket w/ Pigtails | 1 pack of 3 | |
AC Power Plug w/ Fuse | 1 | |
AC Plug w/ Fuse and Switch | 1 |
You will also need filament to print your case and the normal random bolts and screws for assembly.
There are only two 3D printed parts. Both are sized to fit on a typical 200mm build plate and was easily printed on my Ender 3 (V1)
Build
After ordering and printing the parts assembly is pretty quick.
- Snap the 3 AC sockets into the Back plate of the case
- Screw the 2 AC plugs, the one with only a fuse and the one with a fuse and switch into the back case. I used small (3/8in) wood screws I had laying around.
- Mount the Raspberry Pi using 4 screws (Again, size appropriately, but I used screws I had laying around. I think M2s)
- Plug the Relay board into the Raspberry Pi and secure
- Mount the 5V fans. I opted to use only one fan, blowing on the Raspberry PI but I included mounts for a second fan if further case cooling is desired.
- Mount the 5V DC power supply. If the holes don’t line up for your supply, just use some foam double sided tape. This case isn’t going to see a lot of moving around and the tape will hold just fine for our application.
- Connect all of the wiring…. Lest go into a little more detail with a schematic (Use at your own risk):
Setting Up and Configuring the Server
Get your Pi handy and head over to Repetier-Server Downloads and grab the Raspberry Pi image. Follow their instructions and come back when your Raspberry Pi boots up successfully to the server.
Yours is going to look much emptier. Setting your printers up from here should be vanilla. Follow their instructions to add your printers.
Make sure your 3D printer controllers have power. Either over USB or via the built in AC lines. If the boards aren’t powered you will never find the serial ports during setup. This little tid bit took me a few hours to track down.
To control your printer’s via the now built in relays, you will need to add a few more settings. Start by going to the cog in the topmost menu bar and select
Now go to GPIO Pins:
You can see in my configuration I have added three functions that I have names Relay1, Relay2 and Relay3.
Do not add spaces to the names. The software will let you but you will have problems calling the functions later. So, NO SPACES IN NAMES. You can copy what I did above, but I’ll walk you through adding a custom one on your own. Under the function drop down, select “Set output on/off and give it a name “RelayX”.
Press “Create GPIO Operation”. Fill in the Display Name to match the Function Name, set the GPIO Pin (20, 21 or 26 for our board), select Invert Polarity and press “Save GPIO Action”:
Once you have all three Relays configured, head over to your first printer and select “Printer Settings” in the printer’s menu:
Select “G-Codes” and then “Event Dependent”:
For each of the following options, add the following lines of code:
- 1: Run on printer activation
- @gpio Relay1 On
- 2: Run on printer deactivation
- @gpio Relay1 Off
- 3: Run after job
- On last line: @gpio Relay1 Off
With the above complete for each printer your server should be complete with full control of all 3 printers from one Raspberry Pi.
Conclusion
With a Raspberry Pi now costing over $100 USD I think we can safely say having a PI dedicated to each printer is no longer practical. Thanks to the team at Repetier, we no longer have to. The software was easy to setup and a joy to run. If we didn’t want relay to control the whole system would be no harder than any other Octoprint setup. Adding relays was only difficult due to the extra hardware required. Hopefully the above tutorial, 3D printed part files and Bill of Materials will make your build a cinch.