Files
picUploadApi/demo

Raspberry Pi Webcam Capture Demo

Automated picture capture and upload for Raspberry Pi 3 with a USB webcam (Logitech 1080p).

Quick Setup (5 minutes)

1. Install Required Packages

sudo apt update && sudo apt install -y fswebcam curl

2. Configure the Script

# Copy the config template
cp picupper.conf.example picupper.conf

# Edit with your settings
nano picupper.conf

Update picupper.conf with your API key and camera settings.

3. Install & Enable

# Make scripts executable
chmod +x capture-upload.sh install.sh

# Run installer (sets up cron job)
./install.sh

That's it! Your Pi will now capture and upload one picture per minute.


Files Included

File Purpose
capture-upload.sh Main script - captures photo and uploads
picupper.conf.example Configuration template
install.sh Installer script (sets up cron)
uninstall.sh Removes cron job

Configuration Options

Edit picupper.conf:

# PicUpper server URL
API_URL="https://dev.seedheads.de/picUploadApi/upload"

# Your API key (from server admin)
API_KEY="your-api-key-here"

# Camera identifier (unique name for this Pi)
CAMERA_ID="rpi-webcam-1"

# Resolution (1920x1080 for full HD)
RESOLUTION="1920x1080"

# Video device (usually /dev/video0)
VIDEO_DEVICE="/dev/video0"

Manual Testing

# Test capture only (saves to /tmp)
./capture-upload.sh --test

# Run full capture and upload once
./capture-upload.sh

Troubleshooting

Check if webcam is detected

ls /dev/video*
v4l2-ctl --list-devices

Test capture manually

fswebcam -d /dev/video0 -r 1920x1080 --no-banner test.jpg

Check logs

# View recent capture logs
tail -f /var/log/picupper.log

Common Issues

Problem Solution
"No video device" Replug USB webcam, check dmesg
"Permission denied" Add user to video group: sudo usermod -aG video $USER
"Upload failed" Check API key and network connection

Changing Capture Frequency

Default is 1 picture per minute. To change:

# Edit cron job
crontab -e

Examples:

  • Every 5 minutes: */5 * * * * /home/pi/picupper-demo/capture-upload.sh
  • Every 30 seconds: Use the included systemd timer (see advanced setup)

Hardware Requirements

  • Raspberry Pi 3 (any model)
  • USB webcam (Logitech C920/C922/C270 recommended)
  • SD card with Raspberry Pi OS
  • Network connection (WiFi or Ethernet)

Network Notes

The script retries failed uploads and logs all attempts. If your Pi loses network, captures continue and uploads resume when connectivity returns.