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 "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)
- Create a shell script
/usr/local/bin/prusaconnect_upload_cam.sh
swapping outconnect-token-here
with your actual token - Change ownership of the script to the user you log into your pi with, for example if your user is
pi
then 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 start it automatically.
- Create
/etc/systemd/system/prusaconnect_upload_cam.service
and paste the content from below. - 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:
sudo systemctl enable prusaconnect_upload_cam.service
.
Hi @ydu57120 You should have a utility named
nano
installed which is a text editor that works right in the terminal. As long as you're connected to the Pi you can create and edit the file at the same time with:Now you can paste in the script from above. When you're done editing, press
Ctrl-X
and then pressy
to save your changes and exit nano.Now the file exists, but it's owned by the root user. To make it owned by the same user you're logged in as (probably
pi
), that's what step 6 is for:See if that works!