Harbor is a WebRTC-based camera streaming system designed for Raspberry Pi boats with relay server architecture.
The system consists of two main components:
- Runs on a central server/computer
- Relays WebRTC streams between boat clients and browser clients
- Provides web interface for viewing boat streams
- Manages boat connections and availability
- Runs on Raspberry Pi Zero (or other Pi models)
- Captures camera feed and streams via WebRTC
- Connects to Harbor server as a client
- Includes GPIO control for LEDs and motors
# Start the relay server
python3 app.py --host 0.0.0.0 --port 8080The server will be available at http://localhost:8080
# On the Raspberry Pi
python3 boat_app.py --server ws://your-harbor-server:8080 --boat-id my-boat-1pip install aiohttp aiortc websocketspip install aiohttp aiortc websockets picamera2 gpiozero--host: Host to bind to (default: 0.0.0.0)--port: Port to bind to (default: 8080)--cert: Path to TLS cert for HTTPS--key: Path to TLS key for HTTPS
--server: Harbor server URL (required)--width: Camera width (default: 160)--height: Camera height (default: 120)--fps: Camera FPS (default: 30)--boat-id: Unique boat identifier
- Start the Harbor server on your main computer
- Start boat clients on each Raspberry Pi
- Open the web interface at the server URL
- Select a boat from the dropdown
- Click "Connect" to start streaming
- WebRTC Streaming: Low-latency video streaming
- Multi-boat Support: Connect multiple boats to one server
- Web Interface: Modern responsive web UI
- GPIO Control: LED and motor control on boat clients
- Auto-discovery: Boats automatically register with server
- Fallback Modes: Demo mode when camera unavailable
harbor/
├── app.py # Main Harbor server application
├── boat_app.py # Boat client application
├── harbor/ # Harbor server package
│ ├── __init__.py
│ ├── client.py # Web interface HTML
│ ├── server.py # WebSocket server for boats/browsers
│ └── relay.py # WebRTC relay functionality
└── boat/ # Boat client package
├── __init__.py
├── client.py # Boat WebRTC client
├── video.py # Camera streaming
├── motor.py # Motor control
├── led.py # LED control
└── websocket.py # Local WebSocket server
- Boats need network access to reach the Harbor server
- WebRTC uses UDP for media streams
- WebSocket connections for signaling
- Default ports: 8080 (HTTP), 8443 (HTTPS if enabled)
- Ensure camera is enabled:
sudo raspi-config - Check picamera2 installation
- Verify camera permissions
- Check firewall settings
- Ensure boats can reach server IP
- Verify WebSocket connectivity
- Run with sudo if GPIO access fails
- Check pin assignments
- Verify gpiozero installation
The system is built with:
- aiohttp: Async web framework
- aiortc: WebRTC implementation
- picamera2: Raspberry Pi camera interface
- gpiozero: GPIO control library
This project is open source and available under the MIT License.