feat: Add Raspberry Pi webcam capture and upload demo with install/uninstall scripts, config, and README.
This commit is contained in:
131
demo/README.md
Normal file
131
demo/README.md
Normal file
@@ -0,0 +1,131 @@
|
||||
# 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
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt install -y fswebcam curl
|
||||
```
|
||||
|
||||
### 2. Configure the Script
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
# 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`:
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
ls /dev/video*
|
||||
v4l2-ctl --list-devices
|
||||
```
|
||||
|
||||
### Test capture manually
|
||||
|
||||
```bash
|
||||
fswebcam -d /dev/video0 -r 1920x1080 --no-banner test.jpg
|
||||
```
|
||||
|
||||
### Check logs
|
||||
|
||||
```bash
|
||||
# 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:
|
||||
|
||||
```bash
|
||||
# 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.
|
||||
Reference in New Issue
Block a user