HOW TO: Multiple 3D Printers Using OctoPrint 2019 – Raspberry Pi and Ender 3 Step by Step

OctoPrint is a great project for setting up 3D printers to control from a web based interface. Even when only using a single printer, the advantage to connecting a Raspberry Pi to your 3D printers is amazing:

  • Great UI to see your printer and it’s status
  • Allows you to connect to web cams to see progress, locally and remotely
  • A bunch of great plugins to control and monitor your printers – do fun stuff like post updates to a slack channel to keep track of prints and so much more
  • Drag files to print to the web interface instead of messing around with SD cards
  • Easily view print status, cancel prints, organize your upcoming prints
  • Check and modify temperatures, flow rate, feed rate, motors and fans
  • Issue GCode directly to the printer
  • Update the firmware of your 3D printer, directly from the OctoPrint interface
  • Learn a little Linux, and do that Raspberry Pi build you have been thinking about

Here is a step by step guide to get you up and running on OctoPrint using multiple 3D printers:

  1. Install OctoPrint
    1. Download the latest image found HERE
    2. Burn the image to an SD card using ETCHER
    3. Install PUTTY or use another SSH client (your OS may have one)
    4. Insert the SD in your Raspberry Pi, and power it up!
    5. Connect to the Pi using Putty – you may need to figure out it’s IP using your router admin interface
      1. PROTIP: Optional – configure your router to give the MAC ID or your Pi a static address and/or name to make it easier to connect in the future
    6. Follow the instruction above with one printer connected and verify that OctoPrint can control your first printer
      1. PROTIP: Get comfortable with OctoPrint first, use it for a print or two if this is your first time, as some things will make more sense later
      2. PROTIP: Install some plugins before copying below, in some cases this will make things easier down the road
      3. PROTIP: When you are done and happy with a single printer, create a backup in OctoPrint, and download it to your PC just in case
  2. Out of the box, OctoPrint can connect to multiple printers, but not to control them all at once – so we need to login to the Pi and get started copying some files and change some things to get new instances of OctoPrint running for each of your printers. The following details show 2 printers being connected, it certainly works for 3 or more – up to the performance limitations of your Pi – mileage may vary, but 3 works without a hitch for me
    1. Copy the OctoPrint directory
      1. cp -R /home/pi/.octoprint /home/pi/.octoprint2
    2. Copy the config script
      1. sudo cp /etc/default/octoprint /etc/default/octoprint2
    3. Modify the config script
      1. sudo nano /etc/default/octoprint2
        1. PROTIP: Ctrl-X to save when you are done in nano, Y to confirm, enter to confirm file name
    4. And change the port and arguments  to look like the 2 lines below (leave the “DAEMON=” line as it is, it is used by each of the new Octo-instances)
      1. PORT=5001
        DAEMON_ARGS="--port=5001 --config home/pi/.octoprint2/config.yaml --basedir /home/pi/.octoprint2"
    5. Copy the init Script
      1. sudo cp /etc/init.d/octoprint /etc/init.d/octoprint2
    6. Modify the init Script
      1. sudo nano /etc/init.d/octoprint2
    7. Change everything here to be octoprint2 (EXCEPT the DAEMON= line again) and save it like so:
      1. #!/bin/sh### BEGIN INIT INFO
        # Provides: octoprint2
        # Required-Start: $local_fs networking
        # Required-Stop:
        # Should-Start:
        # Should-Stop:
        # Default-Start: 2 3 4 5
        # Default-Stop: 0 1 6
        # Short-Description: OctoPrint2 daemon
        # Description: Starts the OctoPrint2 daemon with the user specified in
        # /etc/default/octoprint2.
        ### END INIT INFO# Author: Sami OlmariPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
        DESC="OctoPrint2 Daemon"
        NAME="OctoPrint2"
        DAEMON=/usr/bin/octoprint
        PIDFILE=/var/run/$NAME.pid
        PKGNAME=octoprint2
        ...
    8. Reload the init script
      1. sudo systemctl daemon-reload
    9. Let’s make it start every time automatically after booting
      1. sudo update-rc.d octoprint2 defaults
    10. Without a reboot you can just start it now
      1. sudo /etc/init.d/octoprint2 start
    11. And check the status like so:
      1. systemctl status octoprint2.service

That’s it! You should be able to log into your OctoPrint service on your Pi now via a remote browser from your PC. If the original (use the ip you determined before) was using the default port, you connected like this
http://192.168.1.150
And now your new printer should be ready to go on port 5001 like this:
http://192.168.1.150:5001

Remember, the IP address above is an example, you need to figure out what IP your Pi received on your network.

OK, bonus time now, this is optional, but makes things handy in the OctoPrint UI to figure out which printer is connected to which USB port. When the Pi boots, for example, USB0 may be assigned to printer 1, but next time to Printer 2 – so lets create some settings that make it easier to figure that out in OctoPrint.

  1. Use Putty, or whatever, to get connected again if you are not already there to the Pi
  2. Plug your printers in and fire them up
  3. Check out your udev info to figure out some of the differences between the connected devices to make some changes later. Here, for example, we can take a look at USB0:
    1. udevadm info -q all -n /dev/ttyUSB0 --attribute-walk
  4. Then, for example, take a look at USB1:
    1. udevadm info -q all -n /dev/ttyUSB1 --attribute-walk
  5. These commands will spill a bunch of info that you will need to differentiate each connection, my file below is just an example, but usually you can use the “idVendor” and “idProduct” and “devPath” attributes as the differences.
  6. Look at the first section with these attributes for EACH of these commands and make note of the attribute values for the 2 commands. If at least ONE of the 3 is different from the other 3, you are good to go and use the example below. If they are the same, you need to look through the attributes to fine ones that differ and include those
  7. OPTIONALLY – if you are familiar with “diff” you can pipe the commands to files, then use diff to show the differences and use it’s output to figure out what attributes you will use in our rules file below like this:
    1. udevadm info -a -n /dev/ttyUSB0 > devInfoUSB0
      udevadm info -a -n /dev/ttyUSB1 > devInfoUSB1
      diff -u devInfoUSB0 devInfoUSB1
  8. OK. Almost there. Lets create some rules! Now we just need to create symlinks to those attributes to some names that we can see in OctoPrint to make it easy to figure out what the heck we are connecting to. On the Pi, lets do this:
      1. cd /etc/udev/rules.d/
        sudo nano 99-usb.rules
  9. And paste/enter something like this in the file, ctrl-x to save again like above (remember, these are MY settings – use your attributes and values that we figured out above – there should be 3 lines in the file, the 3rd is an EXAMPLE for a 3rd printer, so if you are just doing 2, there should be something close to the first 2 lines): I have 3 printers here, I called them ttyEnder3_1, ttyEnder3_2, and ttyMonoMini. Name yours whatever makes sense to you for your printer types.

    1. SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", ATTRS{devpath}=="1.1.3", SYMLINK+="ttyENDER3_2"
      SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{devpath}=="1.3", SYMLINK+="ttyENDER3_1"
      SUBSYSTEM=="tty", ATTRS{idVendor}=="2974", ATTRS{idProduct}=="0503", ATTRS{devpath}=="1.1.2", SYMLINK+="ttyMonoMini"
  10. BONUS: Set your timezone if you haven’t already on the Pi before we reboot and take a look:
      1. cp /usr/share/zoneinfo/America/Chicago /etc/localtime
      2. OR like this:
      3. ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
  11. Either way you set that, if you are unsure of the zone, type up to the point you need to change it, and hit tab a couple of times for your options… So typing this:
    1. cp /usr/share/zoneinfo/
      will display this
      Africa/ CET Etc/ Greenwich Japan Navajo PST8PDT US/
      America/ Chile/ Europe/ Hongkong Kwajalein NZ right/ UTC
      Antarctica/ CST6CDT Factory HST leap-seconds.list NZ-CHAT ROC WET
      Arctic/ Cuba GB Iceland Libya Pacific/ ROK W-SU
      Asia/ EET GB-Eire Indian/ localtime Poland Singapore zone1970.tab
      Atlantic/ Egypt GMT Iran MET Portugal SystemV/ zone.tab
      Australia/ Eire GMT0 iso3166.tab Mexico/ posix/ Turkey Zulu
      Brazil/ EST GMT-0 Israel MST posixrules UCT
      Canada/ EST5EDT GMT+0 Jamaica MST7MDT PRC Universal
      And the same goes for the rest of the command to get yours right.
  12. Lets reboot, and browse to your URL’s again above, and configure each one to find the new device names in the serial settings.
    1. Click the Wrench icon in OctoPrint
    2. You should be in Printer->Serial Connection->General
    3. In the Additional Serial Ports box, lets add some rules to pick up the new device links, mine looks like this: 

Hit save, refresh your browser, and you should have new, way better names in your connection drop-down like this to differentiate your connections:

And that is it! I hope you find this helpful, let me know in the comments below if there are missing steps, or if you have better/other ways of doing some of the things here. Happy Printing!

4 thoughts on “HOW TO: Multiple 3D Printers Using OctoPrint 2019 – Raspberry Pi and Ender 3 Step by Step

  1. When I run sudo /etc/init.d/octoprint2 start it returns

    sudo: unable to execute /etc/init.d/octoprint2: No such file or directory

    When I run systemctl status octoprint2.service

    ● octoprint2.service – SYSV: Starts the OctoPrint2 daemon with the user specified in
    Loaded: loaded (/etc/init.d/octoprint2; generated; vendor preset: enabled)
    Active: inactive (dead)
    Docs: man:systemd-sysv-generator(8)

    What am I missing?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.