prusa-cam – Prusa Connect Webcam Daemon

I wanted to dedicate my largely-unused Logitech C920 webcam to monitoring the prints I made with my Prusa printer, ideally through Prusa Connect, so that I could see snapshots without having to do a VPN/RDP session to my machine. After looking around a bit and printing a few interesting mounts, I settled for one that required disassembling the webcam itself but was able to be used on the left side of a Prusa enclosure (allowing for shorter cable exit from the enclosure) and in front of the Prusa enclosure LED light setup – awesome.

Since there was no Prusa-provided daemon that somehow connected to your webcam and published pictures to Prusa Connect forever, I loved having an excuse to write a Bash script, so I set out to conjure up my own daemon. A friend helped me flesh out the idea, proposed I write my program in Rust, but ultimately Bash was much simpler to work with for a first iteration.

With a bit of config, prusa-cam pings your printer locally as a liveness check, then checks if it’s active by calling your printer’s PrusaLink API status endpoint. If it returns that it’s printing, it’ll try to capture snapshots from your configured webcam using FFmpeg, then try to publish them to Prusa Connect using your credentials (fingerprint, token). If all is well, you should see snapshots every 10 seconds or so in Prusa Connect during a print session. It has error handling, in that if your printer goes offline, or if the script can’t publish to Prusa Connect, etc, it’ll log messages as appropriate, retry all operations in 10-second intervals, and indicate differentials in success/failure as appropriate, without spamming the log.

Having a webcam has potentially saved my printer at least once so far, when I tried overnighting a big build of a two-ball trackball (post on that later) using a lightweight PLA blend from Inland… I forgot to save the picture from Prusa Connect, was too busy panicking.

In the ideal case however, you passively monitor your build, and eventually end up with a nice snapshot of a set of freshly-baked cable organizers.


Comments

Leave a Reply

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