Device-side software for automated image capture on Raspberry Pi, integrated with the Reverse Engineering Lab platform.
This guide covers installing and configuring the plugin on Raspberry Pi devices. For platform-side camera management, see the Platform Documentation.
- Raspberry Pi 5 (recommended) or Pi 4
- Raspberry Pi Camera Module 3 (recommended) or v2
- MicroSD card (8GB or larger)
- Power supply (wall adapter or power bank)
- Network connection (Ethernet or WiFi)
- Camera mount (tripod, clamp, or custom)
- Raspberry Pi OS (64-bit recommended)
- Python 3.11+
- Network connectivity to RELab platform
-
Install Raspberry Pi OS: Follow the official installation guide
-
Enable camera interface:
sudo raspi-config # Navigate to: Interface Options → Camera → Enable sudo reboot -
Test camera:
libcamera-hello --preview
-
Clone repository:
git clone https://github.com/CMLPlatform/relab-rpi-cam-plugin.git cd relab-rpi-cam-plugin -
Run setup script:
./setup.sh
This automatically:
- Verifies environment configuration
- Sets up audio streaming capabilities
- Installs dependencies using
uv(a Python package manager) - Creates Python virtual environment
Before configuring your device, register it on the platform at the plugins/rpi-cam/cameras endpoint by providing:
- Name
- Camera API URL (e.g.,
http://your-pi-ip:8018) - Description (optional)
- Additional auth headers required to access the Camera API URL (optional)
💡 Save the returned API key - it will only be shown once.
-
Create configuration:
cp .env.example .env
-
Edit settings in
.env:# Your Pi's network details BASE_URL="http://your-pi-ip:8018" # Platform integration ALLOWED_CORS_ORIGINS=["http://127.0.0.1:8000", "https://your-platform.com"] AUTHORIZED_API_KEYS=["your-api-key-from-platform"]
Security Note: Keep API keys secure and never commit them to version control.
-
Launch camera API:
uv run fastapi run app/main.py --port 8018
-
Test installation:
- API documentation:
http://your-pi-ip:8018/docs - Live stream:
http://your-pi-ip:8018/stream/watch - Capture test: Use
/captureendpoint
- API documentation:
-
Verify platform connection:
- Access camera from main platform at the
/plugins/rpi-cam/camera/{camera_id}endpoint
- Access camera from main platform at the
- API documentation: Full interactive API available at
/docsendpoint - Live preview: Real-time camera feed at
/stream/watch - Manual capture: Test image capture using
/captureendpoint - Health monitoring: Check device status at
/status
Once configured, the camera can be operated from the main platform. See Platform Documentation for more details.
Camera not detected:
# Check camera connection
vcgencmd get_camera
# Test camera module
libcamera-hello --list-camerasAPI won't start:
- Check that port 8018 is available:
sudo netstat -tlnp | grep :8018 - Verify all dependencies installed correctly
- Review error logs for specific issues
- Test with debug mode:
uv run python app/main.py --log-level debug
Platform can't connect:
- Confirm API key matches platform registration
- Check CORS origins include platform URL
- Test network connectivity between Pi and platform
- Verify firewall rules on both sides
- Test API directly at
http://your-pi-ip:8018/docs
Poor image quality:
- Clean camera lens carefully
- Improve lighting conditions at capture location
- Check camera module connection to Pi
- Adjust camera settings through API parameters
# Install with development dependencies
uv sync
# Install pre-commit hooks
uv run pre-commit install
# Start development server with hot reload
uv run fastapi dev