See the updated version here!
If you haven’t noticed, Raspberry pis that used to cost 35$ back in 2016 now cost much more if you can even find them. With my 3d printer collection growing and my use of automation, I needed a way to control multiple 3d printers from a single computer.
Fortunately, this is not my first serial app, and this is a very basic protocol. In most cases, you send a command and wait for an OK. Here is the script in the end. There are a few edge cases; Sometimes, the OK looks like it comes back out of order, meaning it would randomly hang, waiting for an OK that came in quick. As a workaround, I keep track of when the last OK was seen. If a command needs an OK and I have recently seen one, we move on. This seems to work just fine and prevents hanging. With that worked out, I now have a way to talk to many printers attached to a single computer.
This script takes a device path, character rate, and some Gcode and then spoon-feeds it to your printer.
./gcode_send -d /dev/ttyACM0 -b 115200 -f /path/to/something.gcode
Next, I added a wrapper script to simplify the printing process. The Dice script creates a few folders for each configured printer. The folder is named after the dev file. The character rate or baud rate is configured here.
Inside the printer’s main folder, you’ll find upload, printing, and done directories. You save your Gcode to the upload folder to start a print. It will be moved to the printing folder, and the Gcode send script will start. If you want to cancel a print, simply delete it from the printing folder. When your print finishes, it will be moved to the done directory.
To help automate some of this, I added a few scripts. This one looks for the last printed file in the done folder and moves it to upload to start a new print. I tied this into a Zigbee switch using my home-butler and home-assistant setup.
I also have a few helpful Gcode scripts. These can come in handy for filament loading or turning off the hot end.
If you plan to slice and Dice with Cure on the same computer, make sure to turn off USB printing in Cure’s addons. With that done, the scripts won’t fight over the serial connection.
As always, this is all GPL code and can be found here. Thanks for reading, bye.