Prusa Connect Camera Server Using Viam
I have transitioned from using OctoPrint to Prusa Connect for all of my printers. Overall I have found the integration better for me as I only have Prusa printers and the Prusa's integration is seamless. One main disadvantage is being able to observe the printers with a camera.
Prusa's out of the box camera support didn't suit my needs. Currently Prusa Connect only supports using a phone as a camera across all their printer models. If you happen to have an older MK model (MK2.5, MK2.5S, MK3, MK3S, MK3S+.) you could use the RaspberryPi that is hosting PrusaLink + Prusa Connect, but you cannot use this method for the XL, Mini, or MK4 models.
So I set out to solve this problem by making a service that runs on Raspberry PI using Viam. Viam has built-in support for various camera types, automatically detects and configures cameras, and supports multiple cameras connected at the same time. If you have ever tried to setup your own camera streaming server on a Raspberry Pi, you know how frustrating this can be, and Viam makes it much easier.
The service I wrote takes snapshots from the camera and uploads the images to the Prusa Connect Camera API. At this time, Prusa Connect does not support video streaming. Their UI auto-refreshes images every 10 seconds which is reasonable enough to monitor and detect print failures.
You can read the full article and how-to on Instructables.
RE: Prusa Connect Camera Server Using Viam
Any chance on more detailed instructions on how to add / configure the json files. I am just not getting it.
RE: Prusa Connect Camera Server Using Viam
The article on the instructables talks about registering to viam service.
If you need something that is for free and can run locally then I would suggest https://nvtkaszpir.github.io/prusa-connect-camera-script/ to upload images to Prusa Connect. One of the articles there also shows a bit how to us mediamtx for streaming proxy server specially for local networks.
See my GitHub and printables.com for some 3d stuff that you may like.
RE: Prusa Connect Camera Server Using Viam
Thank you for the reply, I was able to get Viam set up and running on the raspberry Pi. The part I am having trouble with is Step 6 from the instructables link.. I can create the Prusa Connect module . I am lost on how to configure it with text box. I am not sure what text to add or how to input it. Everything I have tried so far does not work. My logs keep repeating "Waiting for module to complete startup and registration"
RE: Prusa Connect Camera Server Using Viam
Currently Prusa Connect only supports using a phone as a camera across all their printer models. If you happen to have an older MK model (MK2.5, MK2.5S, MK3, MK3S, MK3S+.) you could use the RaspberryPi that is hosting PrusaLink + Prusa Connect, but you cannot use this method for the XL, Mini, or MK4 models.
This isn't true - see this post in the MK4 forum: https://forum.prusa3d.com/forum/english-forum-original-prusa-i3-mk4-general-discussion-announcements-and-releases/mk4-rpi-webcam-with-prusa-connect/#post-706000
Prusa MK4 since Jan 2024, Printables: @MikeB_1505898
RE: Prusa Connect Camera Server Using Viam
I have been working my way through your great instructions but as a noob I am at a complete loss on how to add the token and fingerprint into the config. I am not sure if I do that through SSH or some other way. Can you please me additional details on how to do that.
Thanks
RE:
To whom are you addressing that question?
See my GitHub and printables.com for some 3d stuff that you may like.
RE: Prusa Connect Camera Server Using Viam
Sorry I was address the question to KaszpiR_
I like the read the instructions before I do them to make sure I understand. I have been working my through them and didnt make it far. I received this message.
mkdir: cannot create directory ‘/home/pi’: Permission denied
Any ideas?
RE: Prusa Connect Camera Server Using Viam
_KaszpiR_
I have made some great progress but have 2 questions, I am using ssh
1, I ran the set set -o allexport; source usb.env; set +o allexport./prusa-connect-camera.sh line and got the 204. How do I get out of that with out having to end my session and log back in.
2. I ran sudo systemctl start [email protected] and sudo systemctl status [email protected] and both gave error
Failed to start [email protected] - Prusa Connect Camera Script.
I am thinking it might from my 1st question
Thanks.
RE: Prusa Connect Camera Server Using Viam
1. The first command is just for thesting that it works. If you get 204 then it's good and then just Ctrl+c to abort it because the script is not intended to run in interactive mode but via syatemd
2. You need to look at systemctl status [email protected]
I suspect you need to rename usb.env to .usbenv and it should work
See my GitHub and printables.com for some 3d stuff that you may like.
RE: Prusa Connect Camera Server Using Viam
Try sudo journalctl -f -u [email protected]
Or see syslog logs
See my GitHub and printables.com for some 3d stuff that you may like.
RE: Prusa Connect Camera Server Using Viam
Thank you for the reply, I was able to get Viam set up and running on the raspberry Pi. The part I am having trouble with is Step 6 from the instructables link.. I can create the Prusa Connect module . I am lost on how to configure it with text box. I am not sure what text to add or how to input it. Everything I have tried so far does not work. My logs keep repeating "Waiting for module to complete startup and registration"
Hey @jeepgod sorry for the late reply. What do you have in the textbox currently in Viam? I can try to help debug. Make sure to omit any of the secrets you have there including the fingerprint and camera key.
RE: Prusa Connect Camera Server Using Viam
Currently Prusa Connect only supports using a phone as a camera across all their printer models. If you happen to have an older MK model (MK2.5, MK2.5S, MK3, MK3S, MK3S+.) you could use the RaspberryPi that is hosting PrusaLink + Prusa Connect, but you cannot use this method for the XL, Mini, or MK4 models.
This isn't true - see this post in the MK4 forum: https://forum.prusa3d.com/forum/english-forum-original-prusa-i3-mk4-general-discussion-announcements-and-releases/mk4-rpi-webcam-with-prusa-connect/#post-706000
Ok cool! Didn't realize this was possible. I wish I could edit my original post to clarify this but looks like I cannot 🙁
RE: Prusa Connect Camera Server Using Viam
The article on the instructables talks about registering to viam service.
If you need something that is for free and can run locally then I would suggest https://nvtkaszpir.github.io/prusa-connect-camera-script/ to upload images to Prusa Connect. One of the articles there also shows a bit how to us mediamtx for streaming proxy server specially for local networks.
Cool! I didn't know this was made either. One clarification: Viam is an online service but doesn't have a monthly base charge. The images are not stored on Viam so there isn't any cost associated with this project. Technically there is a download cost of the source code, but with the $5 free tier each month, it is free. You also don't need to registry with a credit card or any form of payment to start with.
Also, Viam runs locally on the raspberry pi. The online editor allows you to configure the cameras and see what the board is doing, including logs. The module I wrote transmits the image from the raspberry pi directly to Prusa, and is not routed through Viam. The online editor is merely a convenience feature that allows you to make changes without using ssh/scp/terminal to change the configuration.