OctoPrint for multiple printers and webcams

In this article, I will describe how to setup OctoPrint based on OctoPi on a Raspberry Pi 3 for multiple printers. For every printer, a separate OctoPrint instance with a different port must be started. If you want to use more than one webcam, you also have to start separate instances of MJPG-Streamer for each webcam. I have also added a link to another article where I give a short overview of how you can switch on and off your printers with the use of an n-channel relay module. First, we set up OctoPrint for just one printer and after that works, for multiple printers and webcams.

 

UPDATE from 22.12.2019 for OctoPi 0.17.0 (OctoPrint 1.3.12) running on Raspbian 10 Codename Buster.

I marked information for the old version 0.13.x in red. If you use the newest version 0.17.x ignore text blocks written in red.

Necessary Components

To run OctoPrint on a Raspberry Pi not many components are needed.

If you want to set it up by using a connected HDMI Monitor and a USB keyboard you also need the following

So far that's all you need to setup OctoPrint on your RPi. If you want to be able to switch your printers on and off you can also have a look at this article: "How to switch on and off your 3d printer with your Raspberry Pi"

Where to start with?

The first step is to install the OctoPi image on your SD card. There are a lot of tutorials out there that show how to do it. The steps are quite straight forward if you use a Windows OS.

If you are using a Linux OS then I recommend this site: https://www.raspberrypi.org/documentation/installation/installing-images/linux.md

After installing the firmware onto the SD card we should be able to do some configurations in the octopi-network.txt and octopi.txt file on the boot partition on the SD card. This is the only folder you can see under a Windows system. I had some problems making some configurations with that file. I wanted to create a wifi connection with a static IP but nothing worked as it should because I did a mistake. If you make any mistake with your wifi connection in that file before the first boot, you have to correct it later directly in your system. So it seems to me, that these files just used once after the first boot for creating the wifi connection. I recommend to not make any configurations for a wifi connection in that file. If you connect your RPi via an ethernet cable to your router you don't have to change anything if getting an IP over DHCP is okay for you. Therefore a DHCP server must be running in your network.

Connect a monitor via an HDMI cable to your RPi and also connect a USB keyboard to it. It is then possible to do the configuration locally without using the octopi-network.txt file or an SSH connection at this point.

Set up the wifi connection

VERSION 0.13.x

The configuration for the interfaces in this case for the wifi connection is done in /etc/network/interfaces

sudo nano /etc/network/interfaces

The wlan0 section gets modified to this:

auto wlan0
allow-hotplug wlan0
iface wlan0-raspbian inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
pre-up iw dev wlan0 set power_save off
post-down iw dev wlan0 set power_save on
wireless-power off

or for a static IP address to this

auto wlan0
allow-hotplug wlan0
iface wlan0-raspbian inet static
address 192.168.0.225
netmask 255.255.255.0
gateway 192.168.0.254
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
pre-up iw dev wlan0 set power_save off
post-down iw dev wlan0 set power_save on
wireless-power off

I also added some lines (the last 3) to prevent the wifi module from going into power-saving mode.
This was helpful because I got some weird connection problems. The rest of the interfaces file is untouched.
Some additional german information about how to prevent the wifi module from shutting down to power save mode can be found here: https://www.elektronik-kompendium.de/sites/raspberry-pi/1912231.htm

 

VERSION 0.17.x

In the newer Raspbian release, we need to set our configuration in /etc/dhcpcd.conf. Do not modify the /etc/network/interfaces.

sudo nano /etc/dhcpcd.conf

For a static eth0 IP and a static wlan0 IP, we just add the following to the end of the file.

interface eth0
static ip_address=192.168.0.126/24
static routers=192.168.0.254
static domain_name_servers=192.168.0.254 8.8.8.8 fd51:42f8:caae:d92e::1

interface wlan0
static ip_address=192.168.0.125/24
static routers=192.168.0.254
static domain_name_servers=192.168.0.254 8.8.8.8

ALL VERSIONS

Because we are using a WPA encrypted wifi connection we have to modify the /etc/wpa_supplicant/wpa_supplicant.conf file.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add a network which includes the SSID and the PSK of your wifi connection.

network={
ssid="beehive"
psk="supersecurekey"
}

After a reboot, the RPi should be able to connect to your router and you should be able to connect to it via SSH. Under a Windows system, you can use PuTTY or KiTTY for that.

Basic configuration

Some basic configurations like "Expanding Filesystem", "Change User Password", "Localisation Options" and more can be done by using the tool raspy-config.

sudo raspi-config

After you expanded the file-system (no longer necessary in OctoPi 0.17.x, expanding is done automatically) and have finished with the raspi-config configurations it is time to setup your OctoPrint user, your printer and the rest of the OctoPrint configuration. Therefore use your favorite browser to connect to the OctoPrint webserver:

http://<your pi's ip address>

The next steps are nearly self-explaining but there are also a lot of tutorials out there. A german tutorial can be found here: http://selbstgedruckt.de/octoprint_teil1/

Connect the different printers to the RPi

Now it is your turn! Connect your printers, set up its profiles, play around with OctoPrint. Set up every printer you have and create a working profile for every. At this stage, you are then able to plug in all of your printers but only able to connect to and print with one at once. During the first printer is printing, you are not able to connect to a second one without disconnecting the connection to your actually printing printer! When the first one has finished its job, then you are able to disconnect and connect to the second and print with this one. This is the reason why we need a separate instance for every printer, more about that later.

Create some udev rules for individual printer device names

It can be a mess to find the corresponding device for a specific printer. The device naming /dev/ttyUSB0 is generally made in sequential order. So, in this case, the first printer plugged in will get /dev/ttyUSB0 the second one /dev/ttyUSB1 and so on. It is not guaranteed, that this naming is the same after a reboot. So we will use udev to create some symlinks to devices that will have the same name and correspond to the same printer before and after a reboot. I use ttyMKC for my core printer and ttyANET for my Anet printer.

First, we have to determine the differences of the respective devices, so we can give udev some attributes so it can differ between the devices (printers). If you are lucky your devices differ in a lot of attributes. It can also be that they are nearly equal or complete equal! In my case, only the attributes "KERNELS" and "devpath" where different.

To determine the differences you can do it manually by looking at the outputs of udevamd for the different devices. The following command is for /dev/ttyUSB0.

udevadm info -q all -n /dev/ttyUSB0 --attribute-walk

You can also pipe the outputs to files and use diff to get the differences.

udevadm info -a -n /dev/ttyUSB0 > devInfoUSB0
udevadm info -a -n /dev/ttyUSB1 > devInfoUSB1
diff -u devInfoUSB0 devInfoUSB1

Then we create a file 99-usb.rules for the udev rules

cd /etc/udev/rules.d/ 
sudo nano 99-usb.rules

and insert the following two lines of code. Each line is a rule for each printer we want to use later.

These two lines will only work in my case! You have to use the attributes which differ in your case!

Not every attribute has to be different, but at least one attribute must be different!

SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", ATTRS{devpath}=="1.3", SYMLINK+="ttyANET"
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", ATTRS{devpath}=="1.5", SYMLINK+="ttyMKC"

Some more information about the udev rules can be found here: https://txlab.wordpress.com/2016/06/14/udev-rules-for-ttyusb-devices/

Setting up one more instance of OctoPrint

When your printers print over OctoPrint like they should and every printer has its individual device names e.g. /dev/ttyMKC and /dev/ttyANET we can go further to the next step, the setup of another instance of OctoPrint. Therefore 4 main steps are necessary:

First, we copy the OctoPrint directory

cp -R /home/pi/.octoprint /home/pi/.octoprint2

next copy the OctoPrint configuration script /etc/default/octoprint to /etc/default/octoprint2

sudo cp /etc/default/octoprint /etc/default/octoprint2

and modify the port and add a new basedir.

sudo nano /etc/default/octoprint2

 

VERSION 0.13.x

The changes look like this:

PORT=5001
DAEMON_ARGS="--host=$HOST --port=$PORT --basedir /home/pi/.octoprint2/"

 

VERSION 0.17.x

Some users have gotten problems with the configuration file. So now we also add the path to the configuration as an argument.

PORT=5001
DAEMON_ARGS="--host=$HOST --port=$PORT --config /home/pi/.octoprint2/config.yaml --basedir /home/pi/.octoprint2/"

Just in case, we also do this for the default script

sudo nano /etc/default/octoprint

the changes look like this:

PORT=5000
DAEMON_ARGS="--host=$HOST --port=$PORT --config /home/pi/.octoprint/config.yaml --basedir /home/pi/.octoprint/"

 

Get it reachable over the ports

With these daemon arguments and a properly configured HaProxy you will be able to connect to your printers with a path like this

http://<your pi's ip address>/mkc/ 

but not over its ports

http://<your pi's ip address>:5000

That is exactly what we normally want!

 

However, if you want to connect to it over its port one option, for now, is to remove the host from the arguments list:

PORT=5000
DAEMON_ARGS="--port=$PORT --config /home/pi/.octoprint/config.yaml --basedir /home/pi/.octoprint/"

Do the same for the script of the second instance as well.

Be aware, that open, reachable and network-wide ports are a kind of a security issue.

 

ALL VERSIONS

Next step to get a second instance automatically running after booting, let's copy the init script

sudo cp /etc/init.d/octoprint /etc/init.d/octoprint2

and modify the content a bit.

sudo nano /etc/init.d/octoprint2

You need to make some changes at the top of this file! Change every name from "octoprint" to "octoprint2" and "OctoPrint" to "OctoPrint2" but leave the line

DAEMON=/usr/bin/octoprint

untouched!

 

My file looks like this:

#!/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 OctoPrint daemon with the user specified in
# /etc/default/octoprint2.
### END INIT INFO

# Author: Sami Olmari

PATH=/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
SCRIPTNAME=/etc/init.d/$PKGNAME
...

OctoPi uses systemctl, so it is important to reload the daemon list after a new init script is added.

sudo systemctl daemon-reload

We also want that this starts automatically after booting, so we update the rc.d

sudo update-rc.d octoprint2 defaults

To start the service manual you can use

sudo /etc/init.d/octoprint2 start

To check if the octoprint2.service has been added successfully to systemctl run

systemctl status octoprint2.service

That's it for the moment if you don't get any errors it should work.

Take a beer and make a break. But be aware, at this point, you will not be able to reach your new octoprint instance, therefore you need to configure HaProxy first.

 

HaProxy Configuration

OctoPi uses HaProxy as a reverse proxy for mapping and security reasons.

 

VERSION 0.13.x

If HaProxy is disabled and not used

sudo /etc/init.d/haproxy stop

the webservers of the OctoPrint instances will be reachable on port 5000 and the second on port 5001 (e.g. http://<your pi's ip address>:5000)

I don't recommend to disable HaProxy because you will lose a needful security barrier. But for now, let it disabled.

 

VERSION 0.17.x

In the newest version to reach the instances over there ports, you have to remove the host from the daemon's arguments as described above.

As said before, it is normally not necessary and not recommended to reach them over their ports.

 

ALL VERSIONS

If you use multiple OctoPrint instances and you want to make them reachable as a directory name instead of using a port, this can and must be done using HaProxy. Therefore modify the /etc/haproxy.cfg for your needs.

First, make a backup of the original file.

sudo cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.old

Then open the config file.

sudo nano /etc/haproxy/haproxy.cfg

My haproxy.cfg looks like this and is configured for 3 printers also a CTC printer on port 5002:

global
maxconn 4096
user haproxy
group haproxy
log 127.0.0.1 local1 debug
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
option http-server-close
option forwardfor
maxconn 2000
timeout connect 5s
timeout client 15min
timeout server 15min
frontend public
bind *:80
bind 0.0.0.0:443 ssl crt /etc/ssl/snakeoil.pem
option forwardfor except 127.0.0.1

use_backend webcam if { path_beg /webcam/ }
use_backend mkc if { path_beg /mkc/ }
use_backend anet if { path_beg /anet/ }
use_backend ctc if { path_beg /ctc/ }
default_backend webcam
backend mkc
reqrep ^([^\ :]*)\ /mkc/(.*) \1\ /\2
option forwardfor
server octoprint1 127.0.0.1:5000
acl needs_scheme req.hdr_cnt(X-Scheme) eq 0
reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
reqadd X-Script-Name:\ /mkc
backend anet
reqrep ^([^\ :]*)\ /anet/(.*) \1\ /\2
option forwardfor
server octoprint1 127.0.0.1:5001
acl needs_scheme req.hdr_cnt(X-Scheme) eq 0
reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
reqadd X-Script-Name:\ /anet

backend ctc
reqrep ^([^\ :]*)\ /ctc/(.*) \1\ /\2
option forwardfor
server octoprint1 127.0.0.1:5002
acl needs_scheme req.hdr_cnt(X-Scheme) eq 0
reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
reqadd X-Script-Name:\ /ctc
backend webcam
reqrep ^([^\ :]*)\ /webcam/(.*) \1\ /\2
server webcam1 127.0.0.1:8080
errorfile 503 /etc/haproxy/errors/503-no-webcam.http

For each backend except for the webcam backend, it is important to define the correct X-Script-Name! I wasted a lot of time finding this necessary configuration parameter.

When you have added all your backends and updated the backend list in your frontend configuration block, you can restart HaProxy or just wait and do the next and last step first.

 

If you like to restart your second octoprint instance over the web interface, you need one more thing to change. Therefore open octoprint's config file

nano /home/pi/.octoprint2/config.yaml

and change the service name in the restart command to octoprint2.

serverRestartCommand: sudo service octoprint2 restart

 

After a reboot, you should be able to connect to your two instances with

http://<your pi's ip address>/mkc/
http://<your pi's ip address>/anet/

 

 

How to use a second webcam?

The first webcam which is connected gets most of the time the device name /dev/video0 the second the device name /dev/video1 and so on.

In the newest OctoPi version with the new Raspbian 10, they do a different video device handling than in the older version. I got 3 video devices even if there is no webcam or RaspiCam attached. For every new attached webcam (Logitech C270) I get 2 new devices. The first device is the video data and the second device provides metadata about the video data.

If you are not sure about the naming of your webcams, check it with one of the following commands by using them before your webcam is attached and after it is attached to the RPi.

ls /dev | grep "video*"
ls -l /dev/v4l/by-id

To test if you have found the correct device, start a mjpg_stream instance manually, but first, make sure that you have disabled all running webcamd services.

sudo systemctl stop webcamd
./mjpg_streamer -o "output_http.so -w ./www-octopi -p 8080 -n" -i "input_uvc.so -d /dev/videoX -r 640x480 -f 10"

If it works you should get a stream via VLC with this address.

http://<your pi's ip address>:8080/?action=stream

 

Now we ran into the same trouble as we started connecting the different printers to the RPi. We have to create udev rules to get a device name which is the same every time we restart the RPi.

To determine the differences we pipe the outputs to a file and use diff to get the differences. Be aware, that if your first attached webcam creates two devices, like video0 and video1 and your second webcam video2 and video3, you also have to find differences in the devices for the same camera. So first find differences from video0 (cam1) and video2 (cam2) then also find differences from video0 (cam1) and video1 (also cam1). The same for video2 (cam2) and video3 (also cam 2).

udevadm info -a -n /dev/video0 > /home/pi/devVideo0
udevadm info -a -n /dev/video1 > /home/pi/devVideo2
diff -u /home/pi/devVideo0 /home/pi/devVideo1

Then modify the 99-usb.rules file.

cd /etc/udev/rules.d/
sudo nano 99-usb.rules

and add the following two lines of code. Each line for each webcam we want to use. These two lines will only work in my case! You have to use attributes that differ in your case! Be careful with devpath attributes. Only use them if you find no other attributes that differ or if you know what you are doing!

SUBSYSTEM=="video4linux", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="0825", ATTRS{serial}=="69018540", ATTR{index}=="0", SYMLINK+="videoANET"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="0825", ATTRS{serial}=="C4898540", ATTR{index}=="0", SYMLINK+="videoMKC"

 

Now we can start the default instance of Mjpg-Streamer with the device parameter -p /dev/videoMKC and a second one with the device parameter -p /dev/videoANET. We can now make our settings in the daemon. First, make a backup and a copy for the second instance.

cd /root/bin/
sudo cp webcamd webcamd.old
sudo cp webcamd webcamd2
sudo nano webcamd

 

Because we use two daemons for each camera one, we cannot make our configuration in the /boot/octopi.txt file. We have to do the modifications direct in the daemon file but that's okay.

 

VERSION 0.13.x

We add the -d parameter and the device to the camera_usb_options variable and the port parameter to camera_http_options. This then looks like this:

camera_usb_options="-d /dev/videoMKC -r 640x480 -f 10"
camera_http_options="-p 8080 -n"

We also make the changes in the file of the second daemon.

sudo nano webcamd2

The modified file looks like this:

camera_usb_options="-d /dev/videoANET -r 640x480 -f 10"
camera_http_options="-p 8081 -n"

 

VERSION 0.17.x

You have 3 main options to get 1 camera per instance running, but be careful and do NOT use them at the same time!

Surely there is a simpler and proper way out there.

Take also care at this point, because every webcam configuration parameter which is set in the /boot/octopi.txt file will be used for every webcam daemon you start so the best is to add no camera configuration parameter in this file!

 

1.) Let's look at the first one (recommended!)

Be sure that the /boot/octopi.conf.d folder does not exist, or comment the directory check routine (begin of file) like this:

#if [[ -d ${config_dir} ]]; then
# cfg_files+=( `ls ${config_dir}/*.txt` )
#fi

Comment the "# add video device into options" in the startUSB() function.

# add video device into options
#options="$options -d /dev/$device"

Now add the -d parameter and the device to the camera_usb_options variable like in the older version:

camera_usb_options="-d /dev/videoMKC -r 640x480 -f 10"
camera_http_options="-p 8080 -n

Do the same for the webcamd2 daemon except, change the device and the port.

 

2.) This second one uses a config file for each webcam, created in /boot (also recommended!).

sudo nano /boot/cam-mkc.txt

Add the camera configuration to this file.

camera="usb"
camera_usb_options="-d /dev/videoMKC -r 640x480 -f 10"
camera_raspi_options="-fps 10"
camera_http_webroot="./www-octopi"
camera_http_options="-p 8080 -n"

Change the config files path to your newly created file in the webcamd daemon.

cfg_files+=/boot/cam-mkc.txt

Also, comment the "# add video device into options" in the startUSB() function.

# add video device into options
#options="$options -d /dev/$device"

Don't forget to do the same for the second webcamd2 daemon.

 

3.) The third one uses another approach (NOT recommended ATM). Here we also use a config file for the camera. This method will work but during the first start of the service, the script possibly also tries to start other cameras, which leads to a nasty delay and an error during the startup, but it will work for the specified camera!

You also need to comment the "# add video device into options" in the startUSB() function.

# add video device into options
#options="$options -d /dev/$device"

Now create the /boot/octopi.conf.d directory if it not already exists

sudo mkdir /boot/octopi.conf.d

Also, create a config file with *.txt extension for your webcam in this new directory

sudo nano /boot/octopi.conf.d/mkc.txt

and add your camera config like this

camera="usb"
camera_usb_options="-d /dev/videoMKC -r 640x480 -f 10"
camera_raspi_options="-fps 10"
camera_http_webroot="./www-octopi"
camera_http_options="-p 8080 -n"

 

For the second instance, you need to create a second directory and another config file in this new directory like for the first instance.

sudo mkdir /boot/octopi2.conf.
sudo nano /boot/octopi2.conf.d/anet.txt

and add your camera config

camera="usb"
camera_usb_options="-d /dev/videoANET -r 640x480 -f 10"
camera_raspi_options="-fps 10"
camera_http_webroot="./www-octopi"
camera_http_options="-p 8081 -n"

and change the directory path in the webcamd2 daemon.

config_dir="/boot/octopi2.conf.d"

 

 

Whatever method you have used, now you also need a modified copy of /etc/default/webcamd. So we make one and open it

cd /etc/default/
sudo cp webcamd webcamd2
sudo nano webcamd2

and change the DAEMON and LOG variable to this:

DAEMON=/root/bin/webcamd2
LOG=/var/log/webcamd2.log

 

 

VERSION 0.13.x

We also have to create a new /etc/init.d/ script for that second daemon. We choose the original on and copy it and then modify the copy.

cd /etc/init.d/
sudo cp webcamd webcamd2
sudo nano webcamd2

The head of the modified webcamd2 file looks like this:

#!/bin/sh
### BEGIN INIT INFO # Provides: webcamd2 # Required-Start: $local_fs networking # Required-Stop: # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: webcam2 daemon # Description: Starts the OctoPi webcam daemon with the user specified config in
# /etc/default/webcamd. ### END INIT INFO
# Author: Gina Haeussge
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="Webcam2 Daemon" NAME="webcamd2" DAEMON=/root/bin/webcamd2 USER=pi PIDFILE=/var/run/$NAME.pid PKGNAME=webcamd2 SCRIPTNAME=/etc/init.d/$PKGNAME LOG=/var/log/webcamd2.log ...

Now we come slowly but surely to an end but have to execute some more commands.

OctoPi uses systemctl like said before so we reload the daemon list again.

sudo systemctl daemon-reload

We also want that this daemon starts automatically during booting, so we update the rc.d

sudo update-rc.d webcamd2 defaults

To start the service manual you can use

sudo /etc/init.d/webcamd2 start

To check if the webcamd2.service has been added successfully to systemctl run

systemctl status webcamd2.service

 

 

VERSION 0.17.x

In this newer version, webcamd runs as a pure service, so we must treat it like one.

At first, copy the existing webcamd.service

sudo cp /etc/systemd/system/webcamd.service /etc/systemd/system/webcamd2.service

and modify its content

sudo nano /etc/systemd/system/webcamd2.service

to the following

[Unit]
Description=the OctoPi webcam2 daemon with the user specified config

[Service]
WorkingDirectory=/root/bin
ExecStart=/root/bin/webcamd2
Restart=always
Type=forking

[Install]
WantedBy=multi-user.target

You are ready to test the service.

sudo systemctl start webcamd2

If you want to check the status of the service.

sudo systemctl status webcamd2

We also want that this service starts automatically during booting

sudo systemctl enable myservice

 

 

Another step follows :) ... We have to make the new instance visible behind HaProxy.

sudo nano /etc/haproxy/haproxy.cfg

and add a new backend at the end of file

backend webcam2
reqrep ^([^\ :]*)\ /webcam2/(.*) \1\ /\2
server webcam1 127.0.0.1:8081
errorfile 503 /etc/haproxy/errors/503-no-webcam.http

and a new line under "frontend public"

use_backend webcam2 if { path_beg /webcam2/ }

restart HaProxy

sudo /etc/init.d/haproxy restart

and your webcam should be reachable under http://<your pi's ip address>/webcam2/

 

To use the second webcam stream directly in your OctoPrint web-interface you also have to adapt the stream path

/webcam2/?action=stream

in your OctoPrint Webcam & Timelapse settings.

 

If you want to create an instance for a third printer or webcam, just repeat the steps for the second one.