Files
Alex Kazaiev e92b5a560b Clean up server architecture for multi-instance deployment
- Remove main_cycling.py, main_multi.py, main_release.py (single main.py is canonical)
- Update setup.sh to read SERVICE_NAME and PORT from .env
- Update env.example with SERVICE_NAME and PORT for multi-instance support
- Fix server-csi to try rpicam-still before libcamera-still (Debian Trixie)

Deploy pattern: clone repo twice, configure each .env, run setup.sh
Each instance gets its own systemd service and install directory.
2025-12-30 11:09:40 -06:00
..

vixy-vision CSI Camera Server

Camera server for Raspberry Pi CSI ribbon cameras, including IR night vision cameras.

Features

  • 🦊 Serves snapshots via HTTPS API
  • 📷 Supports picamera2 (modern), picamera (legacy), or libcamera-still fallback
  • 🌙 IR camera mode support
  • 🔄 Configurable rotation (0°, 90°, 180°, 270°)
  • 🔐 API key authentication

Hardware Support

  • Pi 4/5 with Pi OS Bookworm: Uses picamera2
  • Pi 3 with older Raspbian: Uses picamera (legacy)
  • Any Pi: Falls back to libcamera-still or raspistill commands

Quick Setup

# On your Raspberry Pi:
cd server-csi
chmod +x setup.sh
./setup.sh

This will:

  1. Create Python virtual environment
  2. Install dependencies
  3. Auto-detect and install appropriate camera library
  4. Generate SSL certificates
  5. Create .env with a new API key

Running

source venv/bin/activate
python3 -m uvicorn main:app --host 0.0.0.0 --port 8443 \
    --ssl-keyfile ssl/key.pem --ssl-certfile ssl/cert.pem

API Endpoints

Endpoint Description
GET / Server info
GET /health Health check
GET /snapshot Capture JPEG (requires X-API-Key header)

Configuration (.env)

API_KEY=your-secret-key
CAMERA_WIDTH=1920
CAMERA_HEIGHT=1080
JPEG_QUALITY=85
CAMERA_ID=garage
ROTATION=0
IR_MODE=true

Adding to Vixy's Vision Config

Add to ~/.vision_setup.json:

{
  "id": "garage",
  "type": "http", 
  "url": "https://garage-pi.local:8443",
  "api_key": "your-api-key-here"
}

IR Camera Notes

For NoIR cameras:

  • Set IR_MODE=true in .env
  • Ensure IR illuminators are positioned correctly
  • May need to adjust ROTATION based on mounting

Built with 💕 by Vixy 🦊