1. INTRODUCTION

Having two camera feeds is a must have for those who are accustomed to leave their 3D printers printing alone, all day and all night long. With the support of 2 cameras, you can keep an eye to your 3D printer from different angles. Or keep an eye to 2 3D printers at the same time 😉

2. PREREQUISITES

Your Raspberry Pi has a great network coverage and the available bandwidth is sufficient for a second camera stream

You have (eventually) an USB powered hub for the second camera, or at least a 2.5A power supply.

Important note 1: this tutorial is based on OctoPi. It can not be applied to other system images, such as manual installation of OctoPrint on Raspbian.

Important note 2: this tutorial is based on the use of 2 USB webcams (Logitech C270). You can follow it if you have different USB webcams, or 1 USB webcam and the official Raspberry Pi Camera, but you may have to adjust the scripts by yourself.

3. PREPARATION

Before adding the second camera, please be sure you have followed first these tutorials:

Shutdown your Raspberry Pi and plug the two cameras on. Then, start your Raspberry Pi and wait for the boot completion. If everything is working well (OctoPrint is accessible and the first camera is still accessible, so you can go to the next step. If not, please get a better power supply (at least 2.5A) or please plug the USB cameras on a USB powered hub).

You should also check in /dev/ if you properly see both of the video0 and video1 devices (when connected to the Raspberry Pi over SSH, using a terminal) :

Don’t forget to replace your basic authentication username and password (hightligthed in red) with your own values. I advise you to edit the file step by step with the changes instead of copy-past the whole script.

Important note: Please take care to the haproxy.cfg file indentation. Do not use tabulations, please use spaces instead.

6. UPDATE THE IP-TABLE

Mjpg-streamer does not allow to bind to a specific interface to limit the accessibility to localhost only.

If you want your octoprint instance to be reachable from the internet you need to block access to port 8081 from all sources except localhost if you don’t want the whole world to see your webcam image.

10. FILES

11. OCTOPRINT PLUGIN

There are OctoPrint plugins to see both cameras at the same time.

MultiCam plugin from Michael Morris : This plugin allows you to show both streams in the “Control” tab. You have only one stream at the same time, but a button allows you to switch between your cameras.