High-performance camera monitoring system optimized for Raspberry Pi observatory environments.
- Real-time camera feed with sub-500ms frame updates for telescope monitoring
- Dual capture modes: Fast video monitoring and long exposure snapshots
- Multi-client support with master/observer role management
- WebSocket streaming for low-latency observatory monitoring
- USB camera recovery - Automatic reconnection from hardware failures
- Connection limiting - Pi resource protection (max 5 concurrent connections)
- Session persistence - VPN-optimized 30-minute timeouts
- Memory efficient - Reduced cleanup frequency for Pi constraints
- Structured logging with loguru for production debugging
- Pi-optimized storage - 10MB rotation, 7-day retention, compression
- Remote access - Logs saved to
logsfor SSH access - Event tracking - USB recovery, session management, WebSocket errors
- Performance metrics - Frame rates, response times, resource usage
# Install dependencies
uv sync
# Run application
uv run obscamRun those commands from the repository root.
- Web Interface: http://localhost:5000
- API Endpoints: http://localhost:8000
- Force Master Mode: http://localhost:5000/?force_master=true
# Enable detailed debug logging (optional)
export OBSCAM_DEBUG=true# View live logs
tail -f logs/obscam.log
# Monitor errors only
tail -f logs/obscam-error.log
# Remote log access via SSH
ssh pi@your-observatory "tail -f logs/obscam.log"
# Download logs for analysis
scp pi@your-observatory:logs/*.log ./local-logs/logs/obscam.log- Main application log (INFO+)logs/obscam-error.log- Error-only log for quick issue identificationlogs/obscam-debug.log- Detailed debug log (debug mode only)
- Main/Error logs: 10MB rotation, 7-14 day retention
- Debug logs: 20MB rotation, 3-day retention
- Compression: gzip enabled to conserve Pi storage
- Cleanup: Automatic archived log removal
# Run the test suite
uv run pytest# Install git hooks once per clone
uv run pre-commit install
# Run all configured checks manually
uv run pre-commit run --all-filesBuilt following Pi-specific design principles:
- REUSE over CREATE - Leverage existing Flask/FastAPI threads
- MEMORY over DISK - Keep state in RAM, not databases
- CLIENT over SERVER - Push complexity to desktop browsers
- SIMPLE over FEATURE-RICH - Observatory needs reliability over features
- GRACEFUL DEGRADATION - Lower quality beats service failure
Camera not connecting:
# Check logs for USB errors
grep "usb_failure" logs/obscam.log
# Manual reconnection attempt
curl http://localhost:8000/api/connectWebSocket connection failures:
# Monitor WebSocket events
grep "WebSocket" logs/obscam.log
# Check connection limits
curl http://localhost:8000/api/healthSession management issues:
# View session events
grep "session_event" logs/obscam.log
# Force master transfer
curl -X POST http://localhost:8000/api/force-master/SESSION_ID# Monitor performance metrics
grep "Performance" logs/obscam.log
# View resource usage
grep "memory\|cpu" logs/obscam.log- Raspberry Pi 4 (recommended) or Pi 3B+
- ZWO ASI camera (ASI662MC tested)
- Stable network for remote monitoring
- microSD card (32GB+ recommended for log storage)
MIT License - Built for observatory automation and remote telescope monitoring.