Crates.io | prusacam |
lib.rs | prusacam |
version | 1.0.0 |
source | src |
created_at | 2024-05-30 15:48:35.991956 |
updated_at | 2024-05-30 15:48:35.991956 |
description | This is a simple daemon that periodically grabs images from local webcams and uploads them to Prusa Connect. |
homepage | https://github.com/spotzero/prusacam |
repository | https://github.com/spotzero/prusacam |
max_upload_size | |
id | 1257004 |
size | 42,964 |
This is a simple daemon that periodically grabs images from local webcams and uploads them to Prusa Connect.
If running on a Raspberry PI, it support the connection of a switch/toggle and LED and the camera uploading can be enabled with the switch (and the LED is turned on when uploading images and off when disabled),
Support taking periodic captures from multiple webcams and uploading them to Prusa Connect.
Supports the connection of a switch or toggle the the Raspberry Pi GPIO to act and an enable/disable of camera uploading.
Supports connection of an LED on the Raspberry Pi GPIO to at as an indicator of whether images are being uploaded.
Supports switching the camera on and off with signals.
Currently only supports Linux.
Install rust and run:
cargo build --bin prusacam
To build a binary for the old Raspberry Pi's, install "cross" with:
cargo install cross
And build with:
cross build --target arm-unknown-linux-gnueabihf -r --bin prusacam
The GPIO pin are configurable, but it worked for me with GPIO17 and GPIO18.
Warning: Messing around with the GPIO pin can fry your pi, and I'm not responsible for that.
Connect one off of the switch or toggle to GPIO17 and the other to ground.
GPIO17 will be set to pull-up, so when it's shorted to ground, prusacam will capture and upload images.
Connect the positive side of the LED to GPIO18, and the negative leg to a 330 ohm resistor, and then the resistor to ground.
The must be a config.yml file in the current working directory for prusacam to start. This config files control all the cameras and keys:
config.yml should look like this:
interval: 30 # Number of seconds between uploading.
gpio_switch: 17 # GPIO input pin for the switch/toggle.
gpio_led: 18 # GPIO output pin for the LED.
cameras: # An array of all the cameras, any number are supported and they'll be processed one at a time.
-
name: "My camera 0" # Camera name (what will appear in Prusa Connect)
device: /dev/video0 # Camera device
token: Camera 0's token # Camera's prusa connect token
fingerprint: Fingerprint - between 16 and 64 characters # Camera's fingerprint, just set it to some random characters (but at least 16 of them)
resolutionx: 1920 # The width of the image you want to capture (must be supported by the camera)
resolutiony: 1080 # The height of the image you want to capture (must be supported by the camera)
The prusacam binary can just be executed as is.
nohup ./prusacam &
prusacam
will listen for the signal USR1 to act as the camera toggle.
Just run: killall prusacam -USR1
or kill $PID -USR1
When a physical switch is connected and setup, both switches act like a three-way switch.
David Pascoe-Deslauriers @spotzero
This software is licensed under the Apache License 2.0, see LICENSE.txt