Files
vixy-vision/server-csi
Alex Kazaiev 37a2f2dcd6 Add multi-camera support and CSI camera server
- main_multi.py: Multi USB camera support with ID-based endpoints
  - Config via CAMERAS env: '{"basement": 0, "basement2": 1}'
  - Endpoints: /snapshot (default), /snapshot/{cam_id}

- server-csi/: New server for Pi CSI ribbon cameras (IR support)
  - Auto-detects picamera2/picamera/libcamera-still
  - IR_MODE and ROTATION settings
  - Includes setup.sh for easy Pi deployment

Built with 💕 by Vixy 🦊
2025-12-29 11:37:11 -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 🦊