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.
Thanks for this guide
I got a Pi camera that died on arival so switched to a Webcam
Now you can use webcams with the above scritps but tweeked with different setups
Please see what I did
Setting Up a USB Webcam for Prusa Connect
Use a Raspberry Pi & Logitech C270 (or any USB webcam) to upload snapshots to Prusa Connect.
πΉ Features
β Automatically captures images every 10 seconds
β Uploads snapshots to Prusa Connect using API
β Runs continuously and restarts on boot
π Step 1: Install Required Software
fswebcam β Captures images from the Logitech C270
curl β Uploads images to Prusa Connect
Step 2: Test the Camera
If the file exists, the camera is working!
Step 3: Create the Upload Script
nano ~/prusa-camera-upload.shPaste this:
Replace your_prusa_camera_token with your actual Prusa Connect camera token.
If you donβt have a token yet, generate one in Prusa Connect.
Example:
CAMERA_TOKEN="apJ3t1lz2d3Zqm5RI2E9"Save and exit:
Press CTRL + X, then Y, then Enter.
Make the script executable:
chmod +x ~/prusa-camera-upload.shStep 4: Run the Script
~/prusa-camera-upload.shβ If successful, check Prusa Connect Web Cameras for updates.
β If it fails, check for errors
Step 5: Automate the Script on Boot
crontab -eAdd This at the buttom:
@reboot /home/pi/prusa-camera-upload.sh >/dev/null 2>&1Save and exit.
Restart cron:
sudo systemctl restart cronI also reboot the Pi:
sudo reboot nowThe script will automatically start on boot.
And here is my result