I couldn't get the script from p123ad to work on my Pi Zero W 2 with Camera Module 3 (all kinds of ffmpeg errors). There are several built-in tools for working with the camera now, so I tried to figure out if I could use one of those instead.
Behold this version, which uses the built-in libcamera-still tool to actually interact with the camera and save a JPEG. That image is then uploaded to Prusa Connect, same as the original script.
- Go to the Cameras section at https://connect.prusa3d.com
- Add a new camera by clicking "Add new other camera"
- Copy the generated Token
- Set up your Pi Zero W 2 with Raspian OS Lite (32-bit) (this may work with other combinations of Pi and OS but I haven't tested)
- Log into your Pi and create a shell script with
sudo nano /usr/local/bin/prusaconnect_upload_cam.shand swap outconnect-token-herein the script example with the Token you copied in step 3 - Change ownership of the script to the user you log into your pi with, for example if your user is
pithen run:sudo chown pi:pi /usr/local/bin/prusaconnect_upload_cam.sh - Make the script executable:
chmod +x /usr/local/bin/prusaconnect_upload_cam.sh - Start the script with
/usr/local/bin/prusaconnect_upload_cam.sh
If it works you should see no error messages, and a new image appearing in Prusa Connect every 10 seconds.
To run the script in the background and have it start automatically when your Pi starts:
- Create the service file with
sudo nano /etc/systemd/system/prusaconnect_upload_cam.service, paste the content from below and save. - Start the service:
sudo systemctl start prusaconnect_upload_cam.service. - Check if the service is running with
sudo systemctl status prusaconnect_upload_cam.service. - Enable the service to run at startup:
sudo systemctl enable prusaconnect_upload_cam.service.

I've been able to make it work, I figured out why I got some errors. Firstly, I messed up with my token. I spend way to much time figuring out why it didn't work, only to realize it had a ":" to much. It looked like this:
: "${CAMERA_TOKEN:=:connect-token-here}"So after correcting it and seeing that it worked, I cried about it for some time, and I continued to the next problem.
Since now it was broadcasting to my prusaconnect account, it was still upside down. So after some research I came across the solution. Instead of:
--rotate 180I used:
--camera.rotate 180Which now seems to work flawlessly.
I will post your script, but modified to my needs. Once I get home and I'm able to connect to my PI to copy everything and paste it here.
I want to thank you dearly for your help and posting the script, now I can happily watch what my printer is doing when I am away and need a quick print done before I get home!