Duet 2 and Duet 3 mainboards do not support a directly-connected web camera. However, you can buy a suitable Wifi or Ethernet IP camera and then configure Duet Web Control to include an image from the camera on the Print page.
Important: You must choose a camera that has the facility to return a static JPEG image in response to a HTTP request. Not all IP cameras have this facility. Sadly, none of the major browsers supports including a RTSP camera video stream in a web page.
This is known to work. You can use OctoPrint to host a video camera feed. However there is a lighter weight solution. Here is a summary of the process of installing MotionEyeOS on a RaspberryPi with a camera attached.
:update_config=1
:ctrl_interface=/var/run/wpa_supplicant
:network={
::scan_ssid=1
::ssid="HomeNetwork"
::vpsk="password"
:}
For more details on this setup process please visit https://betrue3d.dk
If using a Raspberry Pi cam, UV4L is a nice lightweight option, and has a built-in webserver for streaming. There’s a guide on Github here.
Roughly:
http://[raspberry pi ip address]:8080/stream/snapshot.jpeg?delay_s=0
http://[ip-address:port]/snapshot.cgi
http://[ip-address:port]/videostream.cgi?loginuse=[YourUserName]&loginpas=[YourPassword]
http://[ip-address:port]/index.htm
and click on Videostream mode, you can use the motors onboard the camera to focus on various parts of your print.The following instructions were contributed by forum user Foden.
Purchased some of these beauties, Amazon (Canada), for the house to replace my way more expensive - but dead - IP cameras. With the addition of a small/cheap 4-16GB SD card and an awesome hack from Github, I can link them to my existing home PVR. I've used Sighthound for years https://www.sighthound.com/, but you don't need to have any software to use these cameras with with Duet 2. All you need to do is extract the folder 'firmware_mod' from the Dafang zip file to the root of your sd card. Edit the file \config\usb_eth_driver.conf.dist (note: it may be wpa_supplicant.conf.dist that you need to edit and rename) and add your SSID and password (only 2.4 Ghz). Rename \config\usb_eth_driver.conf.dist\ to \config\usb_eth_driver.conf. That sets up your Wi-Fi connectivity. Once you figure out the cameras IP just enter it into your browser http://www.xxx.yyy.zzz, you will be prompted for the user name 'root' and password 'ismart12' - all lowercase. You can, and should, change the password straight away. Monkey around with the settings but make sure under the camera controls you have RTSP h264 server running. Probably don't need to change much. Then go to your Duet W-Fi under Settings / User Interface enter this for the camera address https://www.xxx.yyy.zzz/cgi-bin/currentpic.cgi - replacing www.xxx.yyy.zzz with the camera IP. Set the web cam update interval to your liking, mine is set at 1 sec. Save your settings and when printing the job status window will update with an image from your camera based on the update interval you entered.
The cameras will also work, generally, in low to no light, I forgot where i got the info but think it just needs a file in the config folder called 'autonight.conf.sw' and all it contains is '-S'
From 3.4 the Duet3D-provided Raspberry Pi images for Duet Software Framework come with the motion streaming service installed. A compatible camera can be connected to the Rapsberry Pi, and can then be used through DWC and controlled through the Motion Webcam Plugin.
This plugin runs the motion webcam streaming service as a DSF plugin. The main motion.conf
file is accessible via 0:/sys/motion.conf
.
Note that the default configuration uses the default /dev/video0
device node, which is generally applicable to external USB webcams. Depending on your choice of camera, extra customizations may be required.
To configure this service in DWC, go to the Settings
-> General
page and make the following changes:
Webcam URL
to http://[HOSTNAME]:8081/0/stream
Webcam update interval (in ms)
to 0
Job
-> Webcam
page to see your live streamCreate a ZIP file of every file but README.md
in this directory and make sure plugin.json
is at the root level. Once created, the ZIP can be installed as a third-party plugin.
Unfortunately the motion service outputs info and warning log messages even if the log level is initially set to not output these, so by default this plugin's configuration suppresses all the log messages and only sends them to the duetpluginservice
journal log.
To view the log of the motion service, open a Linux console (or connect over SSH) and run
journalctl -u duetpluginservice -f
Then restart the Motion Webcam Server plugin and look for potential errors.
To see all the output messages from the motion service directly in DWC, open plugin.json
and set sbcOutputRedirected
from false
to true
. Then build the plugin again and overwrite the existing installation.
Once the plugin is restarted, all the log messages are written to the DWC console.
If you need further details, you can reset log_level
in motion.conf
from 3
(critical) to 6
(notice). Note that a restart of the plugin is required whenever the config file is modified.