Saturday, February 19, 2022

Using Octoprint with one Raspberry Pi and two printers

I have two Tronxy X3A printers.  I have Octoprint on one, but not on the other.  I love Octoprint so much that I can't stand not having it.  So I decided to connect both printers to my Pi.

Detailed instructions are given on the web here.

Without further ado, here's what I did.

Identify the port for my current printer

  1. ssh into my Raspberry pi, with the user name of pi (which was set up when I installed Octoprint).  
     ssh -lpi octopi.local  
  2. List the ports for the connected usb devices
     ls /dev/ttyUSB*  
  3. Plug in the second printer, then relist the ports for the connected usb devices. The new device is the one for the second printer.
     ls /dev/ttyUSB*  
  4. Get the device info for both devices, and find the differences (I have /dev/ttyUSB0 and /dev/ttyUSB1. You might have different devices.)
    udevadm info -a -n /dev/ttyUSB0 > devInfoUSB0
    udevadm info -a -n /dev/ttyUSB1 > devInfoUSB1
    diff -u devInfoUSB0 devInfoUSB1  
    My difference is this:
    ATTRS{bInterfaceProtocol}=="02"
    ATTRS{bInterfaceProtocol}=="ff"  
    Where my old printer is 02, and my new printer is ff
  5. Create a named symlink to the appropriate USB port that will last through a reboot by editing the /etc/udev/rules.d/99-usb.rules file
    cd /etc/udev/rules.d
    sudo vi 99-usb.rules  
    Enter the following two lines in the file (specific for my printers):
    SUBSYSTEM=="tty", ATTRS{bInterfaceProtocol}=="02", SYMLINK+="ttyCDSX3A"
    SUBSYSTEM=="tty", ATTRS{bInterfaceProtocol}=="ff", SYMLINK+="ttyCPSX3A"
    
    The symlinks are the names I choose to use for the printer ports.
  6. Open up Octoprint, go to the settings menu, and add the new ports to the additional ports box.

Create a second copy of Octoprint

  1. Copy the octoprint directory
    cp -R .octoprint .octoprint2 
  2. Copy the octoprint configuration file
    sudo cp /etc/default/octoprint /etc/default/octoprint2
  3. Edit the octoprint2 configuration file to change the port and add a basedir
    sudo vi /etc/default/octoprint2

Edit my haproxy.cfg flie

The

No comments:

Post a Comment